RFR: 8326615: C1/C2 don't handle allocation failure properly during initialization (RuntimeStub::new_runtime_stub fatal crash) [v8]

Damon Fenacci dfenacci at openjdk.org
Thu Aug 29 06:34:54 UTC 2024


> # 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.

Damon Fenacci has updated the pull request incrementally with two additional commits since the last revision:

 - JDK-8326615: fix min code cache calculation
 - JDK-8326615: remove empty line from problemlist

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/19280/files
  - new: https://git.openjdk.org/jdk/pull/19280/files/f79d0a31..0ea93c08

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19280&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19280&range=06-07

  Stats: 8 lines in 4 files changed: 2 ins; 3 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/19280.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19280/head:pull/19280

PR: https://git.openjdk.org/jdk/pull/19280


More information about the hotspot-compiler-dev mailing list