Add support for standard classes with class data #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Class data is a powerful abstraction available to hidden classes, that makes linking live objects into constants trivial with condy. Unfortunately the class data system built into Java MethodHandles is currenly only usable by hidden classes. This PR add a similar system to standard classes loaded via the SingleClassGenerator. The design is similar to the existing DynamicClassLoader callsite bindings where the data is held in the classloader (this ensures safe memory visibility). The call site data is typically accessed via a bootstrap method added to the class definition which uses reflection to avoid any code dependencies in the generated class.
This PR adds a new ClassLoader implementation instead of modify the existing DynamicClassLoader. DynamicClassLoader is quite complex because it is designed to load multiple, possibly co-dependent, classes, and this complexity is not need for the SingleClassLoader.