[lworld] RFR: 8280524: [lworld] Interpreter incorrectly handles uninitialized static inline type field

Tobias Hartmann thartmann at openjdk.java.net
Tue Jan 25 11:03:32 UTC 2022


Code in the interpreter that's supposed to check if the type of a static, null-free inline type field is initialized assumes that `rcx` contains the `InlineKlass*`. However, `rcx` is only initialized for non-static fields:
https://github.com/openjdk/valhalla/blob/ba87b167f2fe2327508a06ec8652c6ddaa9402c1/src/hotspot/cpu/x86/templateTable_x86.cpp#L2939-L2943

As a result, the check spuriously fails, leading to an "impossible" NPE because the null value is not replaced by the default value. This patch also fixes an unrelated issue where an `instanceHandle` should be used instead of an `instanceOop`.

I found this with compiler stress testing and initially assumed that it is a compiler bug. The patch was contributed by @fparain.

Thanks,
Tobias

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

Commit messages:
 - 8280524: [lworld] Interpreter incorrectly handles uninitialized static inline type field

Changes: https://git.openjdk.java.net/valhalla/pull/617/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=617&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8280524
  Stats: 6 lines in 2 files changed: 1 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/617.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/617/head:pull/617

PR: https://git.openjdk.java.net/valhalla/pull/617



More information about the valhalla-dev mailing list