JDK-6653858 : dynamic languages need to be able to load anonymous classes
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-01-23
  • Updated: 2019-02-22
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u14Fixed 7Fixed hs14Fixed
Related Reports
Relates :  
Relates :  
Description
http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm

One pain point in dynamic language implementation is managing
code dynamically.  Too often the JVM's class loaders and
naming conventions get in the way.

Desired features:
 - load an arbitrary class from bytecodes
 - put class in class hierarchy but *not* in any class loader
 - piggyback on a "host class" as if it were an inner class
 - element of the anonymous constant pool can be patched easily
 - string constants can be replaced by arbitrary objects in CP

Why the patching stuff?  Mainly, it makes some use cases much easier.
Second, the constant pool needed some internal patching anyway,
to anonymize the loaded class itself.  Also, if you are going
to use this seriously, you'll want to build anonymous classes
on top of pre-existing anonymous classes, and that requires patching.

Finally, generated code often needs to get to complex constants
(e.g., lists or tables) and this provides a hook to introduce
them directly via the CP.

We want to cut ClassLoaders and the system dictionary out of the loop.
This means there will be fewer locks and no GC entanglements.
Drop the last object, and the class goes away too, just as it should.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/a45484ea312d
13-11-2008