-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JEP-370 (Part 1) #8330
Support JEP-370 (Part 1) #8330
Conversation
Does it pass an empty array for the |
Are these changes sufficient to run the new varhandles? Is this PR providing the framework / outline on which additional changes will be required? |
jcl/src/java.base/share/classes/java/lang/invoke/MemberName.java
Outdated
Show resolved
Hide resolved
jcl/src/java.base/share/classes/java/lang/invoke/VarHandle.java
Outdated
Show resolved
Hide resolved
No, these changes should build the new varhandles. We should also be able to run the new varhandles and corresponding tests but the stubs would throw These changes are dependent on ibmruntimes/openj9-openjdk-jdk14#6. For the first commit |
3657f3f
to
c89c2ff
Compare
Adding notes based on our conversation Friday:
|
These changes are ready to be reviewed. The |
Depends on ibmruntimes/openj9-openjdk-jdk14#6. |
VarHandles.makeMemoryAddressViewHandle is needed to support JEP-370. To consume OpenJDK's VarHandles without any amends, we need to use the following OpenJDK classes: 1) AddressVarHandleGenerator 2) VarHandleByteArrayBase 3) VarHandleMemoryAddressBase JEP-370 is a Java 14 feature. So, the empty OpenJ9 stubs for the above classes have been removed or disabled in Java 14. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
OpenJDK's VarForm is needed to support JEP-370. So, the empty OpenJ9 stub for VarForm is disabled in Java 14. A new VarHandle constructor is also needed to support JEP-370. VarHandle(VarForm varForm) { /* TODO: Translate {VarForm varForm} -> {Class<?> fieldType, * Class<?>[] coordinateTypes, MethodHandle[] handleTable, * int modifiers} */ } Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
VarHandles.makeFieldHandle relies upon following methods: - MethodHandleNatives.objectFieldOffset - MethodHandleNatives.staticFieldBase - MethodHandleNatives.staticFieldOffset Stubs for the above three methods are added in OpenJ9's MethodHandleNatives. OpenJ9's FieldVarHandle doesn't depend on VarHandles.makeFieldHandle. OpenJ9 has its own implementation to support FieldVarHandle. So, the above methods do not need to be implemented. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Java classes generated from X-VarHandle*.template implement the VarHandle.accessModeTypeUncached abstract method. This method has been introduced in OpenJ9's VarHandle to support JEP-370. OpenJ9's implementation of ArrayVarHandle, FieldVarHandle and ViewVarHandle do not utilize VarHandle.accessModeTypeUncached. So, they implement this method as an empty stub. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
MemberName(Method method) constructor is needed to support OpenJ9. boolean isStatic() method is added to build VarHandles.makeFieldHandle. It does not need an implementation since OpenJ9 implements its own FieldVarHandle and does not rely upon VarHandles.makeFieldHandle. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
In OpenJDK's AddressVarHandleGenerator, returnInsn and loadInsn methods rely upon LambdaForm.BasicType. The following values are added in LambdaForm.BasicType enum: I_TYPE, J_TYPE, F_TYPE, D_TYPE and V_TYPE, in order to support the above functions. BasicType.basicType(Class<?> cls) will need to be implemented in order to support JEP-370. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
AddressVarHandleGenerator.addAccessModeTypeMethod accesses a field named "at" in VarHandle.AccessMode enum. This field is currently named as "signatureType". It is renamed from "signatureType" to "at" in order to support JEP-370. SignatureType enum values are renamed to work with AddressVarHandleGenerator and VarForm: 1) getter -> GET 2) setter -> SET 3) compareAndSet -> COMPARE_AND_SET 4) compareAndExchange -> COMPARE_AND_EXCHANGE 5) getAndSet -> GET_AND_UPDATE 6) invalid removed since it is unused. Also, enum SignatureType is renamed to AccessType in order to work with VarForm and AddressVarHandleGenerator. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
AccessMode.methodNameToAccessMode is of type Map<String, AccessMode>. It is introduced to support VarForm.linkFromStatic. It needs to be initialized properly. Currently, it is initialized to null. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
X-VarHandle.java.template exists in the java.lang.invoke package directory. VarHandle.AIOOBE_SUPPLIER is needed to build the Java classes generated by the above template. OpenJ9 does not utilize the Java classes generated from the above template since it has its own implementation. So, VarHandle.AIOOBE_SUPPLIER is initialized to null. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Jenkins test sanity zlinux jdk14 depends ibmruntimes/openj9-openjdk-jdk14#6 |
Jenkins test sanity zlinux jdk11 |
Build_JDK14_s390x_linux_Personal failure:
ibmruntimes/openj9-openjdk-jdk14#6 should generate |
@AdamBrousseau Unable to reproduce this failure locally. |
LFTM
Can you reproduce in an internal personal build? |
no, it passes in an internal personal build.
can't tell from the log.
yes if the issue is recurring. A complete identical job in ibmruntimes/openj9-openjdk-jdk14#6 passed. I am guessing that a restart should resolve the issue. |
Jenkins test sanity zlinux jdk14 depends ibmruntimes/openj9-openjdk-jdk14#6 |
Restarted the build based on @AdamBrousseau's comment that a restart should resolve the failure. @babsingh what order do these need to be delivered in? Or does delivering one (oj9 or extensions) break the build till the other is available? |
See the comments in ibmruntimes/openj9-openjdk-jdk14#6 (comment) Jenkins test sanity zlinux jdk14 depends ibmruntimes/openj9-openjdk-jdk14#6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Related: #8292.
1. Remove empty stubs and use OpenJDK classes
VarHandles.makeMemoryAddressViewHandle
is needed to support JEP-370.To consume OpenJDK's
VarHandles
without any amends, we need to use the followingOpenJDK classes:
AddressVarHandleGenerator
VarHandleByteArrayBase
VarHandleMemoryAddressBase
JEP-370 is a Java 14 feature. So, the empty OpenJ9 stubs for the above
classes have been removed or disabled in Java 14.
2. Use OpenJDK's
VarForm
and support a newVarHandle
constructorOpenJDK's
VarForm
is needed to support JEP-370. So, the empty OpenJ9stub for
VarForm
is disabled in Java 14.A new
VarHandle
constructor is also needed to support JEP-370.3. Support
VarHandles.makeFieldHandle
VarHandles.makeFieldHandle
relies upon following methods:MethodHandleNatives.objectFieldOffset
MethodHandleNatives.staticFieldBase
MethodHandleNatives.staticFieldOffset
Stubs for the above three methods are added in OpenJ9's
MethodHandleNatives
.OpenJ9's
FieldVarHandle
doesn't depend onVarHandles.makeFieldHandle
.OpenJ9 has its own implementation to support
FieldVarHandle
. So, theabove methods do not need to be implemented.
4. Support abstract method
accessModeTypeUncached
in OpenJ9'sVarHandle
Java classes generated from X-VarHandle*.template implement the
VarHandle.accessModeTypeUncached
abstract method.This method has been introduced in OpenJ9's
VarHandle
to support JEP-370.OpenJ9's implementation of
ArrayVarHandle
,FieldVarHandle
andViewVarHandle
do not utilize
VarHandle.accessModeTypeUncached
. So, they implement thismethod as an empty stub.
5. Update
MemberName
to support JEP-370MemberName(Method method)
constructor is needed to support OpenJ9.boolean isStatic()
method is added to buildVarHandles.makeFieldHandle
. It doesnot need an implementation since OpenJ9 implements its own
FieldVarHandle
anddoes not rely upon
VarHandles.makeFieldHandle
.6. Extend
LambdaForm.BasicType
to support JEP-370In OpenJDK's
AddressVarHandleGenerator
,returnInsn
andloadInsn
rely uponLambdaForm.BasicType
.The following values are added in
LambdaForm.BasicType
enum:I_TYPE
,J_TYPE
,F_TYPE
,D_TYPE
andV_TYPE
, in order to support the above functions.BasicType.basicType(Class<?> cls)
will need to be implemented in order tosupport JEP-370.
7. Update
AccessMode
andSignatureType
in VarHandle to support JEP-370AddressVarHandleGenerator.addAccessModeTypeMethod
accesses a field namedat
in
VarHandle.AccessMode
enum. This field is currently named assignatureType
.It is renamed from
signatureType
toat
in order to support JEP-370.SignatureType
enum values are renamed to work withAddressVarHandleGenerator
and
VarForm
:Also, enum
SignatureType
is renamed toAccessType
in order to work withVarForm
and
AddressVarHandleGenerator
.8. Add
AccessMode.methodNameToAccessMode
to supportVarForm
AccessMode.methodNameToAccessMode
is of typeMap<String, AccessMode>
.It is introduced to support
VarForm.linkFromStatic
. It needs to be initializedproperly. Currently, it is initialized to
null
.9. Add
VarHandle.AIOOBE_SUPPLIER
to support X-VarHandle.java.templateX-VarHandle.java.template exists in the
java.lang.invoke
package directory.VarHandle.AIOOBE_SUPPLIER
is needed to build the Java classes generated by theabove template.
OpenJ9 does not utilize the Java classes generated from the above template
since it has its own implementation.
So,
VarHandle.AIOOBE_SUPPLIER
is initialized tonull
.Signed-off-by: Babneet Singh sbabneet@ca.ibm.com