JDK-8304884: Update Bytecodes data to be mostly compile time constants#13179
JDK-8304884: Update Bytecodes data to be mostly compile time constants#13179jcking wants to merge 6 commits intoopenjdk:masterfrom
Conversation
Signed-off-by: Justin King <jcking@google.com>
Signed-off-by: Justin King <jcking@google.com>
|
👋 Welcome back jcking! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
Not a review, but I want to point out that Bytecodes::_flags is declared as a jchar and defined as an unsigned short, might probably be helpful and less confusing to make it an unsigned short in both places. No comment on the other changes |
Signed-off-by: Justin King <jcking@google.com>
Switched to |
coleenp
left a comment
There was a problem hiding this comment.
This seems reasonable. Some suggested changes.
| #undef BYTECODE_JAVA_CODE | ||
| }; | ||
|
|
||
| jchar Bytecodes::_flags[(1<<BitsPerByte)*2]; |
There was a problem hiding this comment.
Why is this not _flags[Bytecodes::number_of_codes] ?
There was a problem hiding this comment.
It should probably be Bytecodes::number_of_codes * 2. Two entry per byte-code. One for the normal format and one for wide. Wasn't sure if it was safe or some code was relying on there being exactly 512 entries even if bytecode count is less than 256.
There was a problem hiding this comment.
When this was put in (JDK-6939207) the flags were arranged so that the two forms were at index N and N+256 rather than index N and N+number_of_codes. That seems to remain the case today - just grep for 1<<BitsPerByte
Signed-off-by: Justin King <jcking@google.com>
Signed-off-by: Justin King <jcking@google.com>
|
/reviewers 2 |
dholmes-ora
left a comment
There was a problem hiding this comment.
Changes seem okay - unfortunately a lot of noise in the PR diff that obscures actual changes.
A couple of queries.
Thanks.
| } | ||
| }; | ||
|
|
||
| #define STRING_SIZE(string) StringLiteralSize::invoke(string) |
There was a problem hiding this comment.
Can't you simply use:
#define STRING_SIZE(string) (sizeof(string) - 1)
?
There was a problem hiding this comment.
No, due to nullptr for the wide_format. That was my first instinct as well, then I saw nullptr.
Signed-off-by: Justin King <jcking@google.com>
| #undef BYTECODE_JAVA_CODE | ||
| }; | ||
|
|
||
| jchar Bytecodes::_flags[(1<<BitsPerByte)*2]; |
|
@jcking This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 31 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 32ef452.
Your commit was automatically rebased without conflicts. |
Change uses a few tricks to make most of the data in Bytecodes compile time constant, avoiding the overhead during VM initialization.
Bytecodes:_flagslikely can be made compile time constant as well usingconstexprtricks, but that is out of scope for this specific PR.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13179/head:pull/13179$ git checkout pull/13179Update a local copy of the PR:
$ git checkout pull/13179$ git pull https://git.openjdk.org/jdk.git pull/13179/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13179View PR using the GUI difftool:
$ git pr show -t 13179Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13179.diff