8358696: Assert with extreme values for -XX:BciProfileWidth #26139
+3
−1
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.
Issue
Extreme values for BciProfileWidth flag such as
java -XX:BciProfileWidth=-1 -version
andjava -XX:BciProfileWidth=100000 -version
results in assert failureassert(allocates2(pc)) failed: not in CodeBuffer memory: 0x0000772b63a7a3a0 <= 0x0000772b63b75159 <= 0x0000772b63b75158
. This is observed in a x86 machine.Analysis
On debugging the issue, I found that increasing the size of the interpreter using the
InterpreterCodeSize
variable insrc/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
prevented the above mentioned assert from failing for large values of BciProfileWidth.Proposal
Considering the fact that larger BciProfileWidth results in slower profiling, I have proposed a range between 0 to 5000 to restrict the value for BciProfileWidth for x86 machines. This maximum value is based on modifying the
InterpreterCodeSize
variable insrc/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
using the smallestInterpreterCodeSize
for all the architectures. As for the lower bound, a value of -1 would be the same as 0, as this simply means no return bci's will be recorded in ret profile.Issue in AArch64
Additionally running the command
java -XX:BciProfileWidth= 10000 -version
(or larger values) results in a different failureassert(offset_ok_for_immed(offset(), size)) failed: must be, was: 32768, 3
on an AArch64 machine.This is an issue of maximum offset forldr/str
in AArch64 which can be fixed usingform_address
as mentioned in JDK-8342736. In my preliminary fix usingform_address
on AArch64 machine. I had to modify 3ldr
and 1str
instruction (in filesrc/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
at line number 926, 983, and 997). With this fix usingform_address
,BciProfileWidth
works for maximum of 5000 after which it crashes withassert(allocates2(pc)) failed: not in CodeBuffer memory: 0x0000772b63a7a3a0 <= 0x0000772b63b75159 <= 0x0000772b63b75158
. Without this fixBciProfileWidth
works for a maximum value of 1300. Currently, I have suggested to restrict the upper bound on AArch64 to 1000 instead of fixing it withform_address
.Question to reviewers
Do you think this is a reasonable fix ? For AArch64 do you suggest fixing using
form_address
? If yes, do I fix it under this PR or create another one ?Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26139/head:pull/26139
$ git checkout pull/26139
Update a local copy of the PR:
$ git checkout pull/26139
$ git pull https://git.openjdk.org/jdk.git pull/26139/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26139
View PR using the GUI difftool:
$ git pr show -t 26139
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26139.diff
Using Webrev
Link to Webrev Comment