Request for review 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleen.phillimore at oracle.com
Sun Nov 11 19:51:26 PST 2012
This change creates a ClassLoaderData object for each JSR 292 anonymous
class, so that the metadata and mirror object for the anonymous class
can be reclaimed when the anonymous class is no longer referenced.
The java_lang_ClassLoader object for the anonymous class is the same as
its host_class. Most of this change is to break the assumption that
there's a 1-1 relationship between java_lang_ClassLoader Java objects
and ClassLoaderData metadata objects in the VM. Also, nmethods and
other things that were strong roots for java_lang_ClassLoader objects
have to also be strong roots for java_lang_Class objects for anonymous
There were also changes to move the dependencies out of the
java_lang_ClassLoader object to the ClassLoaderData type. This type is
preallocated so that CMS will have card marks to track additions to the
dependencies. Please check this, Stefan!
Also, in this change is the addition of mirrors to the interpreter frame
and a test case that shows why this is necessary. An interpreter frame
can be running while it's class loader is unloaded in some special
circumstances. It is easier to do this with JSR292 static MethodHandle
code. Some people are looking for a platform independent way to do
this, by changing code in GC. While this target-dependent interpreter
code is unfortunate, the concept is simple. If the latter effort
succeeds, we can remove the mirror from the interpreter frame later. A
note to openjdk developers - I added this mirror to zero but not to
shark. More testing is necessary.
Please review the following change:
Summary: Add ClassLoaderData object for each anonymous class with
metaspaces to allocate in. Add mirror interpreter frame.
Tested with Nashorn tests, NSK full testlist, dacapo with CMS and G1.
More information about the hotspot-dev