Replace some Valhalla flags with JAVA_SPEC_VERSION >= 28 - #24503
Replace some Valhalla flags with JAVA_SPEC_VERSION >= 28#24503keithc-ca wants to merge 3 commits into
Conversation
Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
|
I question the clang-format check: Why should two spaces be expected after that #endif /* defined(J9VM_OPT_JITSERVER) */ |
|
This PR is touching JIT and GC code, inviting @hzongaro and @dmitripivkine to review. |
|
Personally I am not a fan of this kind of changes. Definitions like |
| #endif /* JAVA_SPEC_VERSION >= 20 */ | ||
|
|
||
| #if ((20 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION <= 23)) || defined(J9VM_OPT_VALHALLA_VALUE_TYPES) | ||
| #if ((20 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION <= 23)) || (JAVA_SPEC_VERSION >= 28) |
There was a problem hiding this comment.
It seems that JVM_VirtualThreadHideFrames has been removed since JDK24. so there is no need to use || (JAVA_SPEC_VERSION >= 28) here.
Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
Signed-off-by: Keith W. Campbell <keithc@ca.ibm.com>
I agree Im not a fan of the of replacing feature flags with JDKVERSION flags. It removes valuable information and makes it harder to understand the code. |
That ship sailed years ago. We have many, many JPEs/features guarded by the Java version in which they were first introduced. Adopting a different stance for JEPs 401 & 539 creates inconsistency. I can rework this to keep the flags in (generated) |
| areValueTypesEnabled(J9JavaVM *vm) | ||
| { | ||
| #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) | ||
| #if JAVA_SPEC_VERSION >= 28 | ||
| return TRUE; | ||
| #else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
| #else /* JAVA_SPEC_VERSION >= 28 */ | ||
| return FALSE; | ||
| #endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ | ||
| #endif /* JAVA_SPEC_VERSION >= 28 */ |
There was a problem hiding this comment.
As this is a preview feature, will we need a way of turning the feature on or off from the command line? We'd previously just relied on its being always enabled or always disabled with J9VM_OPT_VALHALLA_VALUE_TYPES.
There was a problem hiding this comment.
As this is a preview feature, will we need a way of turning the feature on or off from the command line?
The option to control this is --enable-preview. I think we can add a check here whether preview is enabled or not, but this can be done in a separate PR.
There was a problem hiding this comment.
That's a good observation. I expect the right answer would be to check for
J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_PREVIEW)in this and similarly sensitive functions. I think that deserves to be a separate change.
hzongaro
left a comment
There was a problem hiding this comment.
The JIT compiler changes look fine to me. I'm OK with either JAVA_SPEC_VERSION >= 28 or defined(J9VM_OPT_VALHALLA_...).
I dont think this makes it any more inconsistent. We still use flags like In any case, I dont think consistency is a reason to make things worse. Especially for a feature as complex as this, keeping the original flags makes it easier to find relevant code. If consistency is desired, Im more inclined to go the other way and re-introduce the feature flags. |
|
I wondering what we are going to do (after this change) if this feature is going to be postponed in Java 28, even it has been announced? |
Uses of these flags are replaced by
JAVA_SPEC_VERSION >= 28:INLINE-TYPESJ9VM_OPT_VALHALLA_STRICT_FIELDSJ9VM_OPT_VALHALLA_VALUE_TYPESIn some conditions, the Valhalla portion disappears; e.g.
(JAVA_SPEC_VERSION >= 16) | INLINE-TYPESsimplifies toJAVA_SPEC_VERSION >= 16.Issue: #24484.