This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

RE: Array marking


I was also never quite sure what the garbage collector was supposed to do
with
class objects.  Jeff's analysis sounds right to me.  There also seemed to be
an
issue with some other VMs that classes would be routinely collected, and
then
have to be routinely reloaded, resulting in substantial overhead.

Random observations:

- a 1 bit in the descriptor causes the corresponding pointer to be scanned
conservatively.  If it points outside the heap, it continues to be ignored.
Neither statically allocated vtables nor anything else outside the garbage
collected heap is scanned, unless it is in the root set.  If we don't know 
whether a vtable is dynamically allocated, setting the bit is safe.  The
cost
of doing so is small, if there are other pointers in the same cache line. 

- I haven't checked, but it seems to me that if the vtables are in a
writable
segment, they are being scanned conservatively as part of the root set.  If
they are not writable, how does the class pointer get there?

Hans

-----Original Message-----
From: Jeff Sturm [mailto:jsturm@sigma6.com]
Sent: Friday, April 28, 2000 7:58 AM
To: Bryce McKinlay
Cc: minyard@acm.org; java-discuss@sourceware.cygnus.com; Boehm, Hans
Subject: Re: Array marking


Bryce McKinlay wrote:
> - given that the first bit (ie the vtable pointer bit) of the mark
> descriptors generated by the compiler is currently allways `1',
> the gc may be trying to scan statically created vtables (?) -
> wasted cycles. This could easily be changed to allways be `0',

I take it "statically created vtables" implies native classes, not
interpreted (bytecode) classes here.

> but in that case:
> - the gc needs to know to mark the Class object pointed to by the
> first word of the vtable.

It should not be necessary to mark the Class object at all.  A class may
not be collected before its classloader is collected.  The system
classloader can never be collected.  Therefore classes loaded by the
system classloader are never eligible for collection anyway.  That
includes all native classes, right?

For this to work one of the GC roots must include all native classes, so
marking the class from the object vtable seems redundant.

-- 
Jeff Sturm
jsturm@sigma6.com

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