Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
The work for supporting OpenJDK MethodHandles (JSR292) in OpenJ9 is ongoing. Below is the list of TODOs for the MethodHandleResolver class:
[ ] (1) Investigate if an equivalent for lookup.accessCheckArgRetTypes is needed for OpenJDK MH.
[ ] (2) In resolveInvokeDynamic, result[0] either stores a MemberName or Throwable. This leads to a type check in the interpreter or the object stored in result[0]. Investigate if the Throwable can be wrapped in a MemberName. This will help prevent type checks in the interpreter since result[0] will always be a MemberName. This will improve performance.
[ ] (3) Validate if new MethodHandles.Lookup(Class<?>) (OpenJDK) is equivalent to new MethodHandles.Lookup(Class<?>, boolean) (OpenJ9) once test builds are enabled.
[ ] (4) Validate if Lookup.IMPL_LOOKUP.revealDirect(bsm).getName() (OpenJDK) behaves similar to MethodHandle.getMethodName() (OpenJ9) once test builds are enabled.
[ ] (5) Investigate if MethodHandleNatives.linkMethodHandleConstant (in OpenJDK) is an alternative for sendResolveMethodHandle (in OpenJ9). If so, use MethodHandleNatives.linkMethodHandleConstant for OpenJDK MethodHandles since it accounts for all the error checking. Then, we won't need to find an alternative for lookup.accessCheckArgRetTypes.
[ ] (6) In https://github.com/eclipse/openj9/pull/11371, MethodHandleResolver.sendResolveMethodHandle starts using MethodHandleNatives.linkMethodHandleConstant in order to resolve OJDK MHs. As per https://github.com/eclipse/openj9/pull/11371#issuecomment-749747332, it is tentatively believed that Lookup.accessCheckArgRetTypes == VerifyAccess.isMemberAccessible. Due to lack of a test case, we were unable to concretely prove this relationship. During functional testing, any missing IllegalAccessErrors may be due to Lookup.accessCheckArgRetTypes != VerifyAccess.isMemberAccessible. If such a case arises, then the appropriate access check should be added after deriving the access check location from the RI.
The work for supporting OpenJDK MethodHandles (JSR292) in OpenJ9 is ongoing. Below is the list of TODOs for the MethodHandleResolver class:
lookup.accessCheckArgRetTypes
is needed for OpenJDK MH.resolveInvokeDynamic
,result[0]
either stores aMemberName
orThrowable
. This leads to a type check in the interpreter or the object stored inresult[0]
. Investigate if theThrowable
can be wrapped in aMemberName
. This will help prevent type checks in the interpreter sinceresult[0]
will always be aMemberName
. This will improve performance.new MethodHandles.Lookup(Class<?>)
(OpenJDK) is equivalent tonew MethodHandles.Lookup(Class<?>, boolean)
(OpenJ9) once test builds are enabled.Lookup.IMPL_LOOKUP.revealDirect(bsm).getName()
(OpenJDK) behaves similar toMethodHandle.getMethodName()
(OpenJ9) once test builds are enabled.MethodHandleNatives.linkMethodHandleConstant
(in OpenJDK) is an alternative forsendResolveMethodHandle
(in OpenJ9). If so, useMethodHandleNatives.linkMethodHandleConstant
for OpenJDK MethodHandles since it accounts for all the error checking. Then, we won't need to find an alternative forlookup.accessCheckArgRetTypes
.MethodHandleResolver.sendResolveMethodHandle
starts usingMethodHandleNatives.linkMethodHandleConstant
in order to resolve OJDK MHs. As per https://github.com/eclipse/openj9/pull/11371#issuecomment-749747332, it is tentatively believed thatLookup.accessCheckArgRetTypes == VerifyAccess.isMemberAccessible
. Due to lack of a test case, we were unable to concretely prove this relationship. During functional testing, any missingIllegalAccessError
s may be due toLookup.accessCheckArgRetTypes != VerifyAccess.isMemberAccessible
. If such a case arises, then the appropriate access check should be added after deriving the access check location from the RI.Related: https://github.com/eclipse/openj9/issues/7352, https://github.com/eclipse/openj9/pull/10830