Skip to content
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 for OpenJDK LambdaForm #9496

Merged
merged 6 commits into from
Jul 17, 2020
Merged

Conversation

babsingh
Copy link
Contributor

@babsingh babsingh commented May 8, 2020

1. Add new JCL flag: OPENJDK_METHODHANDLES

A new JCL flag, OPENJDK_METHODHANDLES, is introduced to enable/disable
support for OpenJDK MethodHandles. Currently, it is declared in an
unused set so that it stays disabled.

2. Enable OpenJDK LambdaForm

Supporting OpenJDK LambdaForm is the next step in adopting OpenJDK
MethodHandles.

Few OpenJ9 classes are disabled. This enables the OpenJDK variant of
those classes. The newly enabled OpenJDK classes are used to support
OpenJDK LambdaForm.

3. Add field/method stubs to support the compilation of OpenJDK LambdaForm

4. Update enum VarHandle.AccessType to work with OpenJDK LambdaForm

Note: OpenJ9 VarHandle will be replaced with OpenJDK VarHandle once
OpenJDK MethodHandles are adopted by OpenJ9.

5. Support VarHandle(VarForm ...) constructor with OpenJDK MemberName

  • VarHandle(VarForm ...) supported without version restriction
  • OpenJDK VarForm always enabled
  • VarHandle(VarForm ...) supported with OpenJ9 and OpenJDK MemberName
  • Key methods implemented in OpenJ9 MemberName to support VarHandle

6. Support VarHandle with OpenJDK and OpenJ9 MethodType

MethodType.dropFirstParameterType not available in OpenJDK MethodType.

Related: #7352, #9456

Co-authored-by: Jack Lu Jack.S.Lu@ibm.com
Signed-off-by: Babneet Singh sbabneet@ca.ibm.com

@babsingh babsingh force-pushed the lambdaform branch 3 times, most recently from af4d324 to daa2992 Compare May 8, 2020 15:42
@babsingh babsingh changed the title Lambdaform Support and Enable OpenJDK LambdaForm May 8, 2020
@babsingh babsingh changed the title Support and Enable OpenJDK LambdaForm Support for OpenJDK LambdaForm May 8, 2020
@babsingh
Copy link
Contributor Author

babsingh commented May 8, 2020

@fengxue-IS ...

  • This PR depends on the OpenJDK MemberName and MethodType changes: https://github.com/fengxue-IS/openj9/commits/avacadoinvoke.
  • You will need to rebase MemberName and VarHandle.
  • The new JCL flag is named OPENJDK_METHODHANDLES. You can add a similar native flag in j9cfg.h.in for the VM and JIT changes.
  • JEP370 in JDK14 depends on the native functions in MemberName and MethodHandleNatives. You can use JEP370 to test your implementation of those native functions.
  • I will work on the invokebasic bytecode, next.

@babsingh
Copy link
Contributor Author

babsingh commented May 8, 2020

@DanHeidinga I have drafted these changes so that they can be merged. Ultimately, all the new code introduced in this pull request can be removed/disabled once the OpenJDK MethodHandles are adopted.

@babsingh babsingh marked this pull request as ready for review May 8, 2020 16:25
A new JCL flag, OPENJDK_METHODHANDLES, is introduced to enable/disable
support for OpenJDK MethodHandles. Currently, it is declared in an
unused set so that it stays disabled.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Supporting OpenJDK LambdaForm is the next step in adopting OpenJDK
MethodHandles.

In this commit, few OpenJ9 classes are disabled. This enables the
OpenJDK variant of those classes. The newly enabled OpenJDK classes are
used to support OpenJDK LambdaForm.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Note: OpenJ9 VarHandle will be replaced with OpenJDK VarHandle once 
OpenJDK MethodHandles are adopted by OpenJ9.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh babsingh force-pushed the lambdaform branch 3 times, most recently from 7f3ac88 to 716b35a Compare July 6, 2020 18:30
@babsingh
Copy link
Contributor Author

babsingh commented Jul 6, 2020

@DanHeidinga Conflicts have been resolved, and IF defs have been re-added. This PR is ready to be reviewed/merged.

I had removed the IF defs to adopt all the OpenJDK VarHandles across Java11+ using the OpenJ9 VarHandle class. I wanted to extend the JEP370 work, where we added support for MemoryAddressViewVarHandles, to all OpenJDK VarHandles. This will allow us to get rid of the OpenJ9 VarHandles. Some work/issues are still pending to achieve this goal. I will remove the IF defs once we are ready to consume all OpenJDK VarHandles. This work is low priority, and won't be pursued until OpenJDK MethodHandles are adopted.

- VarHandle(VarForm ...) supported without version restriction
- OpenJDK VarForm always enabled
- VarHandle(VarForm ...) supported with OpenJ9 and OpenJDK MemberName
- Key methods implemented in OpenJ9 MemberName to support VarHandle

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
MethodType.dropFirstParameterType not available in OpenJDK MethodType.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@pshipton
Copy link
Member

pshipton commented Jul 7, 2020

@babsingh is this still relevant?

@babsingh
Copy link
Contributor Author

babsingh commented Jul 7, 2020

is this still relevant?

yes, i am waiting for someone to merge these changes.

@pshipton pshipton requested a review from DanHeidinga July 7, 2020 17:25
@babsingh
Copy link
Contributor Author

babsingh commented Jul 9, 2020

@gacholio can you please review these changes? these changes are for adopting OpenJDK MethodHandles.

@gacholio
Copy link
Contributor

Why are these changes necessary? Are we not replacing the entire MH hierarchy in which case just ifdef out all of our classes.

@babsingh
Copy link
Contributor Author

Why are these changes necessary? Are we not replacing the entire MH hierarchy in which case just ifdef out all of our classes.

We still keep OpenJ9 VarHandles. Some of these changes allow OpenJ9 VarHandles to work with OpenJDK MemberName.

This work was done incrementally. So, this PR was created (2 months ago) after the LambdaForm checkpoint was reached. The remaining MH hierarchy is disabled here: #10094, which was created 2 weeks ago. After this PR is merged, I will be rebasing #10094 along with a request for it to be merged.

@gacholio
Copy link
Contributor

jenkins test sanity,extended zlinux jdk11

@gacholio
Copy link
Contributor

@babsingh Can you see what's wrong here?

@babsingh
Copy link
Contributor Author

babsingh commented Jul 17, 2020

Only one failure was seen in Test_openjdk11_j9_extended.functional_s390x_linux_Personal:

03:44:50  SoftMxTest: Softmx OOM Callback triggered, adjusted softmx up to avoid OOM:536870912
03:44:50  FAILED: testExpandHeapUntilOOM
03:44:50  java.lang.OutOfMemoryError: Java heap space
03:44:50  	at org.testng.internal.Invoker.invokeMethod(Invoker.java:610)
03:44:50  	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)
03:44:50  	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)
...

@gacholio This failure is unrelated to my changes since it is also happening elsewhere, #10189.

@gacholio gacholio merged commit 240c62d into eclipse-openj9:master Jul 17, 2020
@babsingh babsingh deleted the lambdaform branch August 17, 2020 02:27
@babsingh babsingh restored the lambdaform branch August 17, 2020 02:27
@babsingh babsingh deleted the lambdaform branch January 29, 2021 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants