jdk
jdk copied to clipboard
8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash)
Issue
The test compiler/startup/StartupOutput.java
fails intermittently due to a crash after correctly printing the error Initial size of CodeCache is too small
(the test limits the code cache using k-XX:InitialCodeCacheSize=1024K -XX:ReservedCodeCacheSize=1200k`).
The appearance of the issue is very dependent on thread scheduling. The original report happens during C1 initialization but C2 initialization is affected as well.
Causes
There is one occurrence during C1 initialization and one during C2 initialization where a call to RuntimeStub::new_runtime_stub
can fail fatally if there is not enough space left.
For C1: Compiler::init_c1_runtime
-> Runtime1::initialize
-> Runtime1::generate_blob_for
-> Runtime1::generate_blob
-> RuntimeStub::new_runtime_stub
.
For C2: C2Compiler::initialize
-> OptoRuntime::generate
-> OptoRuntime::generate_stub
-> Compile::Compile
-> Compile::Code_Gen
-> PhaseOutput::install
-> PhaseOutput::install_stub
-> RuntimeStub::new_runtime_stub
.
Solution
https://github.com/openjdk/jdk/pull/15970 introduced an optional argument to RuntimeStub::new_runtime_stub
to determine if it fails fatally or not. We can take advantage of it to avoid crashing and instead pass the information about the success or failure of the allocation up the (C1 and C2 initialization) call stack up to where we can set the compilations as failed.
Progress
- [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [ ] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash) (Bug - P4)(⚠️ The fixVersion in this issue is [24] but the fixVersion in .jcheck/conf is 23, a new backport will be created when this pr is integrated.)
Reviewers
- Tobias Hartmann (@TobiHartmann - Reviewer) ⚠️ Review applies to f16d9910
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19280/head:pull/19280
$ git checkout pull/19280
Update a local copy of the PR:
$ git checkout pull/19280
$ git pull https://git.openjdk.org/jdk.git pull/19280/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19280
View PR using the GUI difftool:
$ git pr show -t 19280
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19280.diff