Discussion: Add ability to have compiler option bits in OpenJ9 #20314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opening this draft PR for discussion purposes.
Motivation
Whenever we need to guard exclusively OpenJ9 compiler code with an -Xjit/-Xaot option bit, we have to open a PR in the Eclipse OMR repo. This is both tedious (as it involves 2 PRs) and adds unnecessary noise to the Eclipse OMR project. I decided to try and prototype option bits in OpenJ9, and it's actually fairly straightforward to implement.
Implementation Details
This draft PR demonstrates how to do so. It only needs the following change in OMR:
However, this change in OMR is, IMO, not only OK to implement, but also functionally necessary as well as strengthens conceptual integrity.
_feBase
is the JITConfig (and not theTR_FrontEnd
/TR_J9VMBase
), but furthermore,SET_OPTION_BIT
/RESET_OPTION_BIT
needs theprocessOptionSet
paramjitBase
to be aTR::Options
object; in fact to set bits in the JITConfig, there exists theset32BitNumericInJitConfig
method. For these reasons, even though_feOptions
is passed toprocessOption
, the base must be theTR::Options
object, and not anything else, both for functional and conceptual integrity reasons.Criticism
This implementation doesn't fully conform to the extensible classes philosophy, since
_j9options
isn't an extension of_options
My main purpose was to demonstrate that option bits can exist in OpenJ9; the implementation in this PR is just one way of ensuring overlapping enums literals are not possible.
This is just a stop gap; a better solution should be implemented
While this is a fair point, I'm also being pragmatic about distinguishing what should happen and what can happen. For example, #16289 proposed enabling merging of
-Xjit
options in JDK25 (as per the comments), but because that seemed to so far out at the time, there was hope that we'd have sorted out how-Xjit
options should be by JDK25. However, that is unlikely to happen unless someone champions the effort and completes it in the next 9 months.So, if something simple like this that is a relative small amount of work that
then I don't think something like this should be discouraged.