RFR: 8331185: Enable compiler memory limits in debug builds [v2]

Thomas Stuefe stuefe at openjdk.org
Mon Apr 29 11:25:21 UTC 2024


> See [1] for previous discussions.
> 
> We'd like to introduce a default memory limit for compilations in debug builds. That way, we can catch pathological compiler errors that have an unreasonably high per-compilation memory footprint early during testing.
> 
> The default limit affects all compilations, unless the method is subject to a memory limit set from command line. Meaning, `-XX:CompileCommand=MemLimit,...` overrules the default.
> 
> Examples:
> 
> This lowers the memlimit for j.l.String methods - all methods will have the default 1GB limit in a debug JVM. Only j.l.String will run with a 100M limit: `-XX:CompileCommand=MemLimit,java.lang.String::*,100m`
> 
> This disables the default memlimit globally: `-XX:CompileCommand=MemLimit,*.*,0`
> 
> 
> ---
> 
> The patch:
> 
> 1) adds a debug-only default memory limit of **1GB** (as proposed by @vnkozlov). The limit action is "crash", meaning we will assert.
> 2) To test the mechanics, we now print out the memory limit for each compilation in the compilation cost record.
> 3) Adapted and extended tests
> 
> I also fixed up some copyrights that I overlooked last year when adding the compiler memory statistics this patch builds atop of.
> 
> 
> Tested:
> 
> - manually on Mac m1 (debug and release)
> - GHAs are running
> - but Oracle will do more testing before this goes in
> 
> [1] https://mail.openjdk.org/pipermail/hotspot-compiler-dev/2024-April/074787.html

Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:

 - Merge branch 'master' into compiler-default-limit
 - Disable memory limit for compiler/c2/TestFindNode.java until JDK-8331283 is fixed
 - Merge branch 'master' into compiler-default-limit
 - adapt tests
 - fix printout for mem limit
 - also print limit when printing compilation mem histo
 - default limit

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18969/files
  - new: https://git.openjdk.org/jdk/pull/18969/files/b9d9d5eb..eb547f60

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18969&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18969&range=00-01

  Stats: 4568 lines in 157 files changed: 2089 ins; 1993 del; 486 mod
  Patch: https://git.openjdk.org/jdk/pull/18969.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18969/head:pull/18969

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


More information about the hotspot-compiler-dev mailing list