RFR: 8333805: Replaying compilation with null static final fields results in a crash

Roland Westrelin roland at openjdk.org
Fri Jun 7 15:30:40 UTC 2024


When dumping a replay file, if a static field is null the "null"
string is appended to the line for the field. When replaying the
compilation, this breaks for:

- string fields: instead of null, the field is initialized with a
  "null" string
  
- object fields: the jvm crashes because it treats "null" as a class
  name.
  
- array fields: the jvm crashes because it expects an array length
  where the "null" string is.
  
This patch fixes it by:

- leaving out the "null" string when the field is null. When the
  compilation is replayed, the missing field value is taken as meaning
  the field is null.
  
- setting the length to -1 for a null array which on the replay side
  is used as an indication that the field is null.
  
I also noticed, for object arrays, that the actual type of the array
(for a non null field) is included in the replay file (given it can
differ from the field type) but not used when replaying. I changed
that.

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

Commit messages:
 - test & fix

Changes: https://git.openjdk.org/jdk/pull/19601/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19601&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333805
  Stats: 156 lines in 3 files changed: 112 ins; 21 del; 23 mod
  Patch: https://git.openjdk.org/jdk/pull/19601.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19601/head:pull/19601

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


More information about the hotspot-compiler-dev mailing list