Skip to content

Commit

Permalink
Disable use of method handle for core reflection in JDK21 and above
Browse files Browse the repository at this point in the history
In JEP 416, core reflection was re-implemented with Method Handles with the
purpose of simplifying adding new language features. While analyzing
performance of workload based on large enterprise based application, I observed
that this was causing visible performance degradation. Disabling the use of
direct method handles for reflection calls while we are working on improving
the performance with direct method handles.

Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
  • Loading branch information
r30shah committed Sep 13, 2024
1 parent 9226fd3 commit 42fb9ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,12 @@ private static void ensureProperties(boolean isInitialization) {
initializedProperties.put("native.encoding", platformEncoding); //$NON-NLS-1$
/*[ENDIF] JAVA_SPEC_VERSION >= 17 */

/*[IF JAVA_SPEC_VERSION == 21]*/
if (null == initializedProperties.get("jdk.reflect.useDirectMethodHandle")) {
initializedProperties.put("jdk.reflect.useDirectMethodHandle", "false");
}
/*[ENDIF] JAVA_SPEC_VERSION == 21 */

/*[IF (JAVA_SPEC_VERSION >= 21) & (PLATFORM-mz31 | PLATFORM-mz64)]*/
initializedProperties.put("com.ibm.autocvt", zOSAutoConvert); //$NON-NLS-1$
/*[ENDIF] (JAVA_SPEC_VERSION >= 21) & (PLATFORM-mz31 | PLATFORM-mz64) */
Expand Down

0 comments on commit 42fb9ab

Please sign in to comment.