8328085: C2: Use after free in PhaseChaitin::Register_Allocate() #22200
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.
This change removes the ResourceMark from
PhaseChaitin::merge_multidefs()
because it frees memory that is used in the caller methodPhaseChaitin::Register_Allocate
.My comment on the JBS item explains the details.
Testing
I was able to reproduce the issue on ppc64le but not on x86_64 running applications/ctw/modules/java_desktop.java. The issue didn't reproduce with this pr.
ResourceArea Sizes
I've traced maximum ResourceArea size after returning from
PhaseChaitin::merge_multidefs()
(see first commit).I haven't found a significant difference.
Below you can see the last trace line from each run.
x86_64: 3 Runs Dacapo Tomcat 5 Iterations
Baseline
Run 1: [24.222s][info][newcode] New maximum for resource area size: 3274 KB
Run 2: [21.317s][info][newcode] New maximum for resource area size: 3274 KB
Run 3: [37.400s][info][newcode] New maximum for resource area size: 3336 KB
PR
Run 1: [35.002s][info][newcode] New maximum for resource area size: 3363 KB
Run 2: [21.332s][info][newcode] New maximum for resource area size: 3274 KB
Run 3: [36.050s][info][newcode] New maximum for resource area size: 3286 KB
x86_64: 3 Runs applications/ctw/modules/java_desktop.java
Baseline
Run 1: [29.876s][info][newcode] New maximum for resource area size: 3143 KB
Run 2: [29.631s][info][newcode] New maximum for resource area size: 3111 KB
Run 3: [29.227s][info][newcode] New maximum for resource area size: 3142 KB
PR
Run 1: [29.755s][info][newcode] New maximum for resource area size: 3175 KB
Run 2: [28.964s][info][newcode] New maximum for resource area size: 3143 KB
Run 3: [28.863s][info][newcode] New maximum for resource area size: 3143 KB
PPC: 3 Runs Dacapo Tomcat 5 Iterations
Baseline
Run 1: [20.041s][info][newcode] New maximum for resource area size: 3474 KB
Run 2: [20.581s][info][newcode] New maximum for resource area size: 3474 KB
Run 3: [20.367s][info][newcode] New maximum for resource area size: 3474 KB
PR
Run 1: [20.520s][info][newcode] New maximum for resource area size: 3506 KB
Run 2: [20.918s][info][newcode] New maximum for resource area size: 3506 KB
Run 3: [20.994s][info][newcode] New maximum for resource area size: 3505 KB
PPC: 3 Runs applications/ctw/modules/java_desktop.java
Baseline
Run 1: [71.992s][info][newcode] New maximum for resource area size: 3483 KB
Run 2: [55.808s][info][newcode] New maximum for resource area size: 3483 KB
Run 3: [29.252s][info][newcode] New maximum for resource area size: 1684 KB
PR
Run 1: [55.996s][info][newcode] New maximum for resource area size: 3515 KB
Run 2: [30.384s][info][newcode] New maximum for resource area size: 2849 KB
Run 3: [65.671s][info][newcode] New maximum for resource area size: 3547 KB
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22200/head:pull/22200
$ git checkout pull/22200
Update a local copy of the PR:
$ git checkout pull/22200
$ git pull https://git.openjdk.org/jdk.git pull/22200/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22200
View PR using the GUI difftool:
$ git pr show -t 22200
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22200.diff