-
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
JEP-370 Implementation (Part 3) #8501
Conversation
21a245c
to
d721d80
Compare
d721d80
to
1d24c19
Compare
1d24c19
to
5efc135
Compare
@DanHeidinga Rebased this pull request since #8414 is merged (#8414 (comment)). |
Jenkins test sanity plinux jdk11,jdk14 |
jenkins compile win jdk8,jdk14 |
Pls rebase to pick up #8583 |
5efc135
to
3a4672a
Compare
Rebased. @AdamBrousseau do we apply the pull request changes on top of openj9/master? are rebases required? |
Rebases are not required. We use the merge ref of the PR which is a merge of the PR into master. That being said, GitHub has publicly stated these are an undocumented, unsupported feature of a PR and they encourage users to create the merge themselves. I believe it is because when something is merged to master, not every pr is updated automatically by default. Certain events need to happen on a PR in order for the ref to be refreshed. |
jenkins compile win jdk8 |
plinux PR testing is https://ci.eclipse.org/openj9/job/PullRequest-OpenJ9/2729/ |
Past PR testing has found that sometimes (often?) a rebase is required to pick up other changes. I could have tried it without the rebase, but I know the rebase will fix it. |
https://ci.eclipse.org/openj9/job/PullRequest-OpenJ9/2729/: the plinux failure is a segfault in Jep359Tests_0, which is reported in #8582. This failure happens even without the changes of this pull request. |
OpenJDK implementation of ByteArrayViewHandle and ByteBufferViewHandle is used to support JEP-370 in Java14+. OpenJ9 ViewHandles don't handle memory scopes properly. Example: try (MemorySegment segment = MemorySegment.allocateNative(bytes)) { ByteBuffer byteBuffer = segment.asByteBuffer(); MethodHandle handle = Derived from ByteBuffer & ByteBufferViewHandle; handle.invoke(); } Invoking handle.invoke() outside the memory scope should result in IllegalStateException, which is thrown from jdk.internal.foreign.MemoryScope. With OpenJ9 ViewHandles, the IllegalStateException is not thrown. The aforementioned behavior is achieved by using OpenJDK ViewHandles. The deficiency in OpenJ9 ViewHandles could not be identified. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
In OpenJ9, derived VarHandle classes define all AccessMode operations, and UnsupportedOperationException is thrown from the operation methods that are not supported. All OpenJ9 VarHandle.handleTable entries are non-null when supporting derived OpenJ9 VarHandle classes. In OpenJDK, derived VarHandle classes do not define unsupported AccessMode operations. Thus, OpenJ9 VarHandle.handleTable entries are null for unsupported AccessMode operations when supporting derived OpenJDK VarHandle classes. VarHandle.accessModeType relies upon VarHandle.handleTable to derive the AccessMode MethodType. When supporting derived OpenJDK VarHandle classes, accessModeTypeUncached is used to retrieve the AccessMode MethodType in case VarHandle.handleTable entries are null. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
a894bae
to
1f80a9f
Compare
1f80a9f
to
8b055be
Compare
Currently, investigating the failing extended tests in Test_openjdk14_j9_extended.functional_x86-64_windows_Personal-2:
|
8b055be
to
8caf911
Compare
The assertion failures in VarHandle_0 are addressed in the following commit:
|
8caf911
to
1802734
Compare
All failures seen in the extended functional test suite have been addressed. |
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.
@gacholio Anything major I missed in the interpreter changes?
@DanHeidinga I suggested one trivial change. It might be better to move all of this code out of the interpreter - just do the update/call/hasbeenupdated in the interpreter itself. |
@babsingh Can you update the code to move most of this out of the interpreter as GAC suggested? |
You'll need to use the J9AllocateObject API instead of the inline allocate. |
@gacholio @DanHeidinga any suggestions on where the new function should be added? VMHelpers.hpp? |
exceptionsupport.cpp - the whole idea is that it not be inlined into the interpreter. |
1802734
to
1b56e1a
Compare
@DanHeidinga Moved code out of the interpreter as per @gacholio's suggestion. New code is added to the following commit:
|
Yeah, literal means the direct string. If it's a |
OpenJ9 VarHandle.handleTable entries are null for unsupported AccessMode operations when supporting derived OpenJDK VarHandle classes. VM_MHInterpreter::dispatchLoop and BytecodeInterpreter::invokevarhandle look up entries in VarHandle.handleTable to invoke the operation method. A null handleTable entry reflects a unsupported AccessMode operation. In this case, an UnsupportedOperationException should be thrown. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
OpenJ9 VarHandle.handleTable entries are null for unsupported AccessMode operations when supporting derived OpenJDK VarHandle classes. When supporting derived OpenJDK VarHandle classes, accessModeTypeUncached is used to retrieve the AccessMode MethodType in case VarHandle.handleTable entries are null. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
OpenJ9 ViewVarHandles have their own implementation for the isAccessModeSupported method. OpenJDK ViewVarHandles are used in OpenJ9 Java 14+ which rely upon VarHandle.isAccessModeSupported instead of having their own isAccessModeSupported implementation. VarHandle.isAccessModeSupported is updated to support OpenJDK VarHandles, which rely upon OpenJ9's VarHandle(VarForm varForm) constructor. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
1b56e1a
to
0c32d79
Compare
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
Jenkins test sanity zlinux jdk14,jdk11 |
Jenkins test extended win jdk14 |
Closes: #8292.
1. Use OpenJDK
ViewHandle
s in Java14+ to support JEP-370OpenJDK implementation of
ByteArrayViewHandle
andByteBufferViewHandle
is used to support JEP-370 in Java14+.
OpenJ9
ViewHandle
s don't handle memory scopes properly. Example:Invoking
handle.invoke()
outside the memory scope should result inIllegalStateException
, which is thrown fromjdk.internal.foreign.MemoryScope
.With OpenJ9
ViewHandle
s, theIllegalStateException
is not thrown. Thecorrect behavior is achieved by using OpenJDK
ViewHandle
s.The deficiency in OpenJ9
ViewHandle
s could not be identified.2. Handle
NULL
VarHandle.handleTable
entries inVarHandle.accessModeType
3. Handle
NULL
VarHandle.handleTable
entries in(Bytecode|MH)Interpreter
4. Handle
NULL
VarHandle.handleTable
entries inVarHandle.toMethodHandle
5. Support
isAccessModeSupportedHelper
method withVarForm
constructorOpenJ9
ViewVarHandle
s have their own implementation for theisAccessModeSupported
method. OpenJDKViewVarHandle
s are used in OpenJ9Java 14+ which rely upon
VarHandle.isAccessModeSupported
instead ofhaving their own
isAccessModeSupported
implementation.VarHandle.isAccessModeSupported
is updated to support OpenJDKVarHandle
s, which rely upon OpenJ9'sVarHandle(VarForm varForm)
constructor.
Signed-off-by: Babneet Singh sbabneet@ca.ibm.com