GC question

Andreas Huber ahuber at ping.at
Thu Nov 5 10:46:53 PST 1998


On Thu, 5 Nov 1998 10:06:56 -0700 (MST), Godmar Back wrote:

>> 
>> The reason I'm asking this is that I'm trying to figure out a way to
>> make the gc work with native threads that don't allow a thread to
>> inspect another thread's stack.
>>
>
>The answer is two-fold:  
>a) convert all native methods to JNI.  This is on the TODO list anyway.
>   Note, however, that there is a performance trade-off that is to be
>   explored.
>b) Make the gc precise as described.
>
>However, your statement: "that don't allow inspection of another
>thread's stack" seems a bit too strong.  Even if you have the information
>I mentioned, the collector thread would still have to inspect another
>thread's stack to read the actual references from there.
>Maybe what you mean is that you're unable to obtain the stack pointer
>of another thread (as would be the case if you used standard pthreads?)

Yes, that's what I meant. Looking through the source I see that method
locals are allocated using alloca(). I thought I could just allocate
two more words containing the size and a link to the callers locals.
This list would be rooted in jthread_t. The locals would be unlinked
before returning to the caller and in case of an exception.
TwalkThread() could then traverse the list calling walkConservative()
for each node. As a side effect, counting the frames would also work.
This, of course, only works if native methods and the VM cooperate.

Andreas




More information about the kaffe mailing list