[Gc] GC + Windows Mobile + Threads + Patch for WINCE

biosli biosli at hotmail.com
Mon Aug 24 06:24:22 PDT 2009


Dear Sir:My English is poor, I apologize.But GC is SO GREAT, I can not help myself doing something for it.
And I appreciate your kind patience. >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?

I am not familiar with building under command line… I will try to learn it as soon as possible.mm... config.h I should try it next time. Thanks!!

>> 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"?;Yes, there is DebugBreak called every time.

>- WaitForSingleObject() fails due to invalid handle, so what are the values returned by GC_CreateThread()?I output the handle values, and the values put in WaitForSingleObject is same as the values returned by GC_CreateThread. I did some farther test:case 1:---------------------------------------------------------------------- C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/test-revBASE.svn002.tmp.c     Aug 24 20:11:50 2009+++ D:/WorkBackup/My_Test_Project/bdwgc/tests/test.c Aug 24 20:10:58 2009@@ -1534,21 +1545,20 @@ # if NTHREADS > 0    for (i = 0; i < NTHREADS; i++) {     h[i] = GC_CreateThread(NULL, 0, thr_run_one_test, 0, 0, &thread_id);+       GC_printf("Thread create handle: %x\n", (int)h[i]);     if (h[i] == (HANDLE)NULL) {       (void)GC_printf("Thread creation failed %d\n", (int)GetLastError());       FAIL;     }+       GC_printf("Thread wait handle: %x\n", (int)h[i]);+       if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) {+              (void)GC_printf("Thread wait!
 failed %d\n", (int)GetLastError());+              FAIL;+       }    } # endif /* NTHREADS > 0 */   run_one_test();-# if NTHREADS > 0-   for (i = 0; i < NTHREADS; i++) {-    if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) {-      (void)GC_printf("Thread wait failed %d\n", (int)GetLastError());-      FAIL;-    }-   }-# endif /* NTHREADS > 0 */+ # ifdef MSWINCE     PostMessage(win_handle, WM_CLOSE, 0, 0);     if (WaitForSingleObject(win_thr_h, INFINITE) != WAIT_OBJECT_0)------------------------------------------------------------------The program crashed in GC_mark_from: current = *(word *)current_p;(in mark.c line:835)Becouse (*current_p) is 0.It happens in many case.(enter typed_test in thread, enter check_heap_stats in main thread ....)But the WaitForSingleObject worked without any errors. Case 2:Based case 1, I did another test:------------------------------------------------------------------ C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/tes-revBASE.svn003.tmp.c      Aug 2!
4 20:45:12 2009+++ D:/WorkBackup/My_Test_Project/bdwgc/tests/test.c Aug 24 20:43:43 2009@@ -1412,7 +1423,6 @@  DWORD __stdcall thr_run_one_test(void *arg) {-  run_one_test();   return 0; } @@ -1534,21 +1544,21 @@ # if NTHREADS > 0    for (i = 0; i < NTHREADS; i++) {     h[i] = GC_CreateThread(NULL, 0, thr_run_one_test, 0, 0, &thread_id);+       GC_printf("Thread create handle: %x\n", (int)h[i]);     if (h[i] == (HANDLE)NULL) {       (void)GC_printf("Thread creation failed %d\n", (int)GetLastError());       FAIL;     }+       Sleep(500);+       GC_printf("Thread wait handle: %x\n", (int)h[i]);+       if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) {+              (void)GC_printf("Thread wait failed %d\n", (int)GetLastError());+              FAIL;+       }    } # endif /* NTHREADS > 0 */   run_one_test();-# if NTHREADS > 0-   for (i = 0; i < NTHREADS; i++) {-    if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) {-      (void)GC_printf("Thread wait failed %d\n!
", (int)GetLastError());-      FAIL;-    }-   }-# endif /* NTHREADS > 0 */+ # ifdef MSWINCE     PostMessage(win_handle, WM_CLOSE, 0, 0);     if (WaitForSingleObject(win_thr_h, INFINITE) != WAIT_OBJECT_0)------------------------------------------------------------The thread did nothing, and exited as soon as it was created.Then main thread was sleeping when the thread exited.The the warning “Thread wait failed 6” is show up. So, I check MSDN: (http://msdn.microsoft.com/en-us/library/aa450988.aspx)I saw that: “Waiting on an invalid handle causes WaitForSingleObject to return WAIT_FAILED”Is that reason of that warning? >I also did the following change to win32_threads.c (WinMain()):>…

I merge the code to my work copy.

 

 

>> Unexpected heap growth - collector may be broken

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

 >> 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)?

I found nether GC_HAVE_BUILTIN_BACKTRACE nor GC_CAN_SAVE_CALL_STACKS are defined.I think the error fr_savfp undefined because when defined SAVE_CALL_CHAIN, it make FR_SAVFP and FR_SAVPC defined at same time. But fr_savfp only could be used under LINUX.
 
_________________________________________________________________
张三挖到了元宝,小美又掉进陷阱了,快来MClub与好友齐乐乐!立刻访问!
http://club.msn.cn/?from=3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20090824/e3175e88/attachment-0001.htm


More information about the Gc mailing list