Skip to content

Introduce a constantPool cache - #22907

Merged
gacholio merged 1 commit into
eclipse-openj9:masterfrom
tajila:opt
Nov 18, 2025
Merged

gacholio merged 1 commit into
eclipse-openj9:masterfrom
tajila:opt

Conversation

@tajila

@tajila tajila commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Cache the constantPool object off the j.l.Class after the first
invocation of Access::getConstantPool. Given that the ConstantPool
instance is associated with a single version of the class, as soon as
the class is redefined the cache is invalidated and disabled.

@tajila

tajila commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

jenkisn test sanity alinux64 jdk21

@tajila

tajila commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity alinux64 jdk21

@tajila

tajila commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

investigating the test failures

Comment thread runtime/jcl/common/java_lang_Access.c Outdated
@tajila
tajila force-pushed the opt branch 3 times, most recently from 7dd6b83 to 1975eef Compare November 10, 2025 16:54
Comment thread runtime/jcl/common/java_lang_Access.c Outdated
@@ -83,6 +84,15 @@ Java_java_lang_Access_getConstantPool(JNIEnv *env, jclass unusedClass, jobject c
/* and set the private constantPoolOop member */
constantPoolOop = JCL_CACHE_GET(env, FID_sun_reflect_ConstantPool_constantPoolOop);
(*env)->SetObjectField(env, constantPool, constantPoolOop, classToIntrospect);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would this not be more efficient done internally? You could avoid multiple trips through enter/exit VM.

@tajila
tajila force-pushed the opt branch 20 times, most recently from b617406 to 38314f3 Compare November 13, 2025 18:38
@tajila
tajila force-pushed the opt branch 4 times, most recently from d451588 to 0ba1e51 Compare November 13, 2025 19:22
@tajila

tajila commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity alinux64 jdk21

@tajila

tajila commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity win jdk8

@tajila

tajila commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity.functional win jdk8

Comment thread runtime/jcl/common/java_lang_Access.c
Cache the constantPool object off the j.l.Class after the first
invocation of Access::getConstantPool. Given that the ConstantPool
instance is associated with a single version of the class, as soon as
the class is redefined the cache is invalidated and disabled.

Signed-off-by: tajila <atobia@ca.ibm.com>
@tajila

tajila commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity.functional win jdk8

@tajila

tajila commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity,extended.functional,extended.openjdk alinux64 jdk21

@tajila

tajila commented Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

jenkins test sanity xlinux jdk17

@tajila

tajila commented Nov 17, 2025

Copy link
Copy Markdown
Contributor Author

None of the failures are related to these changes

@tajila
tajila marked this pull request as ready for review November 17, 2025 20:04
@gacholio
gacholio merged commit 4071623 into eclipse-openj9:master Nov 18, 2025
11 of 13 checks passed
@keithc-ca

Copy link
Copy Markdown
Contributor

The failure here on jdk21

[2025-11-14T21:42:04.966Z] ----------- Stack Backtrace -----------
[2025-11-14T21:42:04.966Z] Java_sun_reflect_ConstantPool_getUTF8At0+0x64 (0x0000FFFFA427F3C4 [libjclse29.so+0x4c3c4])
[2025-11-14T21:42:04.966Z]  (0x0000FFFEB44C4BA0 [<unknown>+0x0])
[2025-11-14T21:42:04.966Z] ---------------------------------------
[2025-11-14T21:42:04.966Z] JVMDUMP039I Processing dump event "gpf", detail "" at 2025/11/14 21:41:55 - please wait.

seems more than a little similar to the failure in ibmruntimes/openj9-openjdk-jdk21#385: https://openj9-jenkins.osuosl.org/job/Test_openjdk21_j9_sanity.openjdk_aarch64_mac_Personal_testList_0/245/console

12:39:10  Caused by: java.lang.NullPointerException: constantPoolOop is null
12:39:10  	at java.base/jdk.internal.reflect.ConstantPool.getUTF8At(ConstantPool.java:71)
12:39:10  	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:240)
12:39:10  	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
12:39:10  	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)

@gacholio @tajila Thoughts?

@keithc-ca

Copy link
Copy Markdown
Contributor

Testing for ibmruntimes/openj9-openjdk-jdk17#565 is failing likewise; see https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.openjdk_ppc64le_linux_Personal_testList_0/67/consoleText

[2025-11-18T17:32:59.808Z] Caused by: java.lang.NullPointerException: constantPoolOop is null
[2025-11-18T17:32:59.808Z] 	at java.base/jdk.internal.reflect.ConstantPool.getUTF8At0(Native Method)
[2025-11-18T17:32:59.808Z] 	at java.base/jdk.internal.reflect.ConstantPool.getUTF8At(ConstantPool.java:71)
[2025-11-18T17:32:59.808Z] 	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:240)
[2025-11-18T17:32:59.808Z] 	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
[2025-11-18T17:32:59.808Z] 	at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)

@keithc-ca

Copy link
Copy Markdown
Contributor

The failure is new: https://openj9-jenkins.osuosl.org/job/PullRequest-OpenJDK21/138 passed (without this change).

@pshipton

Copy link
Copy Markdown
Member

Reverted via #22971

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants