This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Boehm GC support addition for debugging


Bryce McKinlay wrote:

        * include/boehm-gc.h (_Jv_SuspendThread): Declare.
        (_Jv_ResumeThread): Declare.
        * boehm-gc.cc (_Jv_SuspnedThread): New function.
        (_Jv_ResumeThread): New function.

Grr. Now I have a problem with this:


+ void
+ _Jv_SuspendThread (pthread_t thread)
+ {
+   if (thread == pthread_self ())
+     GC_suspend_self ();
+   else
+     GC_suspend_thread (thread);
+ }
+
+ void
+ _Jv_ResumeThread (pthread_t thread)
+ {
+   GC_resume_thread (thread);
+ }

This going to break non-pthreads builds. There doesn't appear to be any abstract platform-independent threading convention between the GC and gcj. The GC uses GC_thread (which is private to the GC), and gcj uses either java.lang.Thread or _Jv_Thread_t.

Alas, it looks like we have a couple of options:

1) Place ifdefs around the code for all the various cases. I presume these are pthreads, win32, and ???

2) Make GC_thread and GC_lookup_thread public in the GC

3) Abstract what the GC wants in posix-threads.cc (_Jv_Thread_t->data->thread) and win32-threads.cc (_Jv_Thread_t->data->thread_obj). Still have to do #1, though...

4) Something else I've missed

Sorry about the can of worms. I should have sought a solution to this before posting my patch. I'll keep digging.

Keith


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]