Re[8]: [Gc] GC + Windows Mobile + Threads + Patch for WINCE

Ivan Maidanski ivmai at mail.ru
Mon Aug 24 02:49:49 PDT 2009


Hi!

biosli <biosli at hotmail.com> wrote:
> Last letter you wrote:
> > I set env var GC_MAXIMUM_HEAP_SIZE=25000000 and it works for me well (on Win32).
> > Could you try this config: -Ox -DALL_INTERIOR_POINTERS -DNO_DEBUGGING -DSMALL_CONFIG -DGC_THREADS -D_WIN32_WCE -DUNDER_CE -Iinclude
> I add the configs to stdafx.h
> -------after add configs---------stdafx.h--------
> #ifdef _MT
> #  define GC_THREADS 1
> #endif
> //  
> #ifndef SMALL_CONFIG
> #   define SMALL_CONFIG
> #endif //SMALL_CONFIG
>  
> #ifndef NO_DEBUGGING
> #   define NO_DEBUGGING 
> 
> #endif //NO_DEBUGGING
>  
> Un-comment the ALL_INTERIOR_POINTERS in gc_priv.h:
> -/*#define ALL_INTERIOR_POINTERS*/ 
> +#define ALL_INTERIOR_POINTERS

Why not just use command line args (-D<macroname>) or use config.h (with defined HAVE_CONFIG_H) instead of patching source get a desired build config?

> And build the project under wince platform (same as add _WIN32_WCE and UNDER_CE)
>  
> The test_libgc is running further, enter the mktree function, then could get no more memory.(GC_wince_get_mem in os_dep.c).
>  
> Then I defined VERY_SMALL_CONFIG, and the test passed.
> Output result:
> Thread wait failed 6
> Thread wait failed 6
> Thread wait failed 6

This is unclear:
- Is DebugBreak() called after each "Thread wait failed"?;
- WaitForSingleObject() fails due to invalid handle, so what are the values returned by GC_CreateThread()?

I also did the following change to win32_threads.c (WinMain()):

    if (thread_h != NULL)
    {
	WaitForSingleObject (thread_h, INFINITE);
	GetExitCodeThread (thread_h, &exit_code);
	CloseHandle (thread_h);
    }

->
    if (thread_h != NULL)
    {
	if (WaitForSingleObject (thread_h, INFINITE) == WAIT_FAILED)
            ABORT("WaitForSingleObject(main_thread) failed");
	GetExitCodeThread (thread_h, &exit_code);
	CloseHandle (thread_h);
    } else {
        ABORT("GC_CreateThread(main_thread) failed");
    }


> Received WM_CLOSE, closing window
> The thread 'GC_win32_start' (0xeed20a86) has exited with code 0 (0x0).
> Completed 6 tests
> Allocated 802768 collectable objects
> Allocated 1212 uncollectable objects
> Allocated 0 atomic objects
> Allocated 0 stubborn objects
> Finalized 1649/1649 objects - finalization is probably ok
> Total number of bytes allocated is 24109758
> Final heap size is 18325504 bytes

Here all is ok.

> Unexpected heap growth - collector may be broken

"Unexpected heap growth" typically doesn't mean it's broken (just the condition is too restrictive).

> Collector appears to work
> The thread 'GC_win32_start' (0x2ee7728a) has exited with code 0 (0x0).
>  
> Could you share your thoughts on the test result?

> By the way, I saw you changed the gc.h for backtrace, as following:
> --- CVS_plus_112_and_114/bdwgc/include/gc.h     2009-08-08 12:17:42.000000000 +0400
> +++ updated/bdwgc/include/gc.h      2009-08-20 19:33:10.000000000 +0400
> @@ -524,10 +524,9 @@
>  #endif
>  
>  #if defined(_MSC_VER) && _MSC_VER >= 1200 /* version 12.0+ (MSVC 6.0+)  */ \
> -    && !defined(_AMD64_)
> -# ifndef GC_HAVE_NO_BUILTIN_BACKTRACE
> -#   define GC_HAVE_BUILTIN_BACKTRACE
> -# endif
> +   && !defined(_AMD64_) && !defined(GC_HAVE_NO_BUILTIN_BACKTRACE) \
> +   && !defined(_WIN32_WCE) && !defined(GC_HAVE_BUILTIN_BACKTRACE)
> +# define GC_HAVE_BUILTIN_BACKTRACE
>  #endif
> I found it was could not passed compiling. The error as below:
> 1>os_dep.c
> 1>..\..\os_dep.c(4098) : error C4013: 'GC_save_regs_in_stack' undefined; assuming extern returning int
> 1>..\..\os_dep.c(4099) : error C2037: left of 'fr_savfp' specifies undefined struct/union 'frame'
> 1>..\..\os_dep.c(4104) : error C2037: left of 'fr_savfp' specifies undefined struct/union 'frame'
> 1>..\..\os_dep.c(4107) : error C2037: left of 'fr_savpc' specifies undefined struct/union 'frame'

Could you tell me (assuming the above patch applied) whether GC_HAVE_BUILTIN_BACKTRACE and GC_CAN_SAVE_CALL_STACKS are some there got defined (and where if yes)?

Bye.


More information about the Gc mailing list