You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New contant pool type ‘Constant_Dynamic’ used to describe a dynamically computed constant which can be a primitive of ref. This value is produced by calling a bootstrap method. The constant is only computed once. In multithreaded scenarios, as soon as a value is computed all other subsequent ones are discarded (there is only one winner). Similarly, for recursive scenarios the deepest nested call wins.
CONSTANT_Dynamic_info {
u1 tag;
u2 bootstrap_method_attr_index;
u2 name_and_type_index;
}
The ‘tag’ is the type of ConstantPool entry (17). ‘bootstrap_method_attr_index’ is the index of the bootstrap method in the bootstrap method table in the class file. ‘name_and_type_index’ index into the constant pool that must be a ‘Constant_NameAndType_info’ structure.
Resolution for ConstantDynamic is:
• Bootsrap MethodHandle is resolved (specified by symbolic reference). Exception may be thrown if failure occurs when resolving methodHandle
• Array is created of size n + 3 where n are the static args (n >= 0). Array initialized to null.
o This stage can be optimized out so long as there are no behavior changes
• First arg of array is the lookup object
• Second arg is the Name (j.l.String) in name_and_type_index
• Third arg is a Class derived from the field descriptor in name_and_type_index
• The rest of the args are the static args listed at bootstrap_method_attr_index. Exception may be thrown
• If the symbolic reference being resolved is also a static arg or references itself via other static args then a StackOverflowError is thrown
• The bootstrapMethodHandle is invoked (mh.invokeWithArguments(argsArray)). Exception/Error may be thrown
• The result from the boostrapMethodHandle is validated. For condy this converts the result to the type specified by the field descriptor in name_and_type_index
Once resolution is performed the value is cached in the constant pool. If an error/exception occurs the same failure must be thrown every time the constant pool entry is referenced. A Constant_Dynamic entry may be loaded by ldc instruction.
J9 Implementation
Goal is to reuse as much of the invokeDynamic functionality as possible. As a result some of the invokeDynmaic functionality and layout will have to be changed
The text was updated successfully, but these errors were encountered:
DanHeidinga
changed the title
Add support for ConstantDynamic constant pool entries
[Condy] Add support for ConstantDynamic constant pool entries
Feb 27, 2018
http://cr.openjdk.java.net/~dlsmith/constant-dynamic.html
The following have to be done in order
The rest can be done simultaneously
Background
New contant pool type ‘Constant_Dynamic’ used to describe a dynamically computed constant which can be a primitive of ref. This value is produced by calling a bootstrap method. The constant is only computed once. In multithreaded scenarios, as soon as a value is computed all other subsequent ones are discarded (there is only one winner). Similarly, for recursive scenarios the deepest nested call wins.
The ‘tag’ is the type of ConstantPool entry (17). ‘bootstrap_method_attr_index’ is the index of the bootstrap method in the bootstrap method table in the class file. ‘name_and_type_index’ index into the constant pool that must be a ‘Constant_NameAndType_info’ structure.
Resolution for ConstantDynamic is:
• Bootsrap MethodHandle is resolved (specified by symbolic reference). Exception may be thrown if failure occurs when resolving methodHandle
• Array is created of size n + 3 where n are the static args (n >= 0). Array initialized to null.
o This stage can be optimized out so long as there are no behavior changes
• First arg of array is the lookup object
• Second arg is the Name (j.l.String) in name_and_type_index
• Third arg is a Class derived from the field descriptor in name_and_type_index
• The rest of the args are the static args listed at bootstrap_method_attr_index. Exception may be thrown
• If the symbolic reference being resolved is also a static arg or references itself via other static args then a StackOverflowError is thrown
• The bootstrapMethodHandle is invoked (mh.invokeWithArguments(argsArray)). Exception/Error may be thrown
• The result from the boostrapMethodHandle is validated. For condy this converts the result to the type specified by the field descriptor in name_and_type_index
Once resolution is performed the value is cached in the constant pool. If an error/exception occurs the same failure must be thrown every time the constant pool entry is referenced. A Constant_Dynamic entry may be loaded by ldc instruction.
J9 Implementation
Goal is to reuse as much of the invokeDynamic functionality as possible. As a result some of the invokeDynmaic functionality and layout will have to be changed
The text was updated successfully, but these errors were encountered: