This is the mail archive of the
mailing list for the Java project.
Re: Array marking
Jeff Sturm wrote:
> 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.
Right, a vtable that is generated ahead of time by the compiler. vtables
are heap allocated in the case of interpreted classes, and also array
> > 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.
I've read that somewhere too. I think libgcj maintains a single linked list
of all loaded classes, where as what we really need is independent lists
for each ClassLoader. Thats okay, we can fix that later.
> 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?
Currently, yes. It has been suggested that it might be nice to be able to
collect dynamically loaded native classes by unloading the .so they were
loaded from once all classes in it are unreachable. We could implement this
by creating a ClassLoader instance for each .so that gets dynamically
loaded (via Class.forName), and calling dlclose() in its finalizer.
[ bryce ]