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

JDK22 new API support #18296

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Conversation

JasonFengJ9
Copy link
Member

@JasonFengJ9 JasonFengJ9 commented Oct 17, 2023

JDK22 new API support

Implemented JavaLangAccess APIs: ensureNativeAccess(Module mod, Class<?> clzOwner, String methodName, Class<?> clzCaller), bytesCompatible(String str, Charset charset), copyToSegmentRaw(String str, MemorySegment ms, long offset);
Updated LinkerOptions.isCritical() usage;
Limited JEP 442 tests to JDK21;
Created Java22andUp for JDK22 JEP 454 tests.

required by

Signed-off-by: Jason Feng [email protected]

Copy link
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change to Linker.Option.isTrivial(), the test code in test/functional/Java21andUp/src/org/openj9/test/jep442 will no longer compile.

FYI @ChengJin01

@ChengJin01
Copy link

ChengJin01 commented Oct 17, 2023

With the change to Linker.Option.isTrivial(), the test code in test/functional/Java21andUp/src/org/openj9/test/jep442 will no longer compile.

We will need to disable the jep442 directory for JDK22 (given JEP442 is only intended for JDK21) and create a new directory Java22andUp/src/org/openj9/test/jep454 (https://openjdk.org/jeps/454 in #17872) for JDK22.

@JasonFengJ9
Copy link
Member Author

Moved the JEP 442 test from Java21andUp to Java21Only.
Created Java22andUp for JEP 454 test, and updated JDK22 API usages.

@keithc-ca
Copy link
Contributor

The --enable-preview option is not needed for any of the tests currently in Java22andUp.

@JasonFengJ9
Copy link
Member Author

Removed --enable-preview for Jep454 test which is the only test suite in Java22andUp currently.

@keithc-ca
Copy link
Contributor

Several of the tests for Java22+ fail like this:

java.lang.invoke.WrongMethodTypeException: cannot convert MethodHandle(VarHandle,MemorySegment,long,int)void to (VarHandle,MemorySegment,int)void
	at java.base/java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:903)
	at java.base/java.lang.invoke.MethodHandle.asType(MethodHandle.java:870)
	at org.openj9.test.jep454.downcall.InvalidDownCallTests.test_heapSegmentForStructArgument(InvalidDownCallTests.java:180)

The VarHandle returned by MemoryLayout.varHandle() has a different signature; a second parameter of type long (the base offset) is now expected; see [1].

[1] https://github.com/ibmruntimes/openj9-openjdk-jdk/blob/openj9-staging/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java#L499

Implemented JavaLangAccess APIs: ensureNativeAccess(Module mod, Class<?>
clzOwner, String methodName, Class<?> clzCaller), bytesCompatible(String
str, Charset charset), copyToSegmentRaw(String str, MemorySegment ms,
long offset);
Updated LinkerOptions.isCritical() usage;
Limited JEP 442 tests to JDK21;
Created Java22andUp for JDK22 JEP 454 tests.

Signed-off-by: Jason Feng <[email protected]>
@JasonFengJ9
Copy link
Member Author

Jep454Tests_testLinkerFfi_UpCall_0,Jep454Tests_testLinkerFfi_DownCall_0 passed an internal grinder

@keithc-ca
Copy link
Contributor

Jenkins test sanity zlinux jdk21

@keithc-ca
Copy link
Contributor

The failure of cmdLineTester_criu_jitserverPostRestore_3 is unrelated to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants