RFR: 8276453: Undefined behavior in C1 LIR_OprDesc causes SEGV in fastdebug build [v5]

Man Cao manc at openjdk.java.net
Thu Nov 11 08:38:37 UTC 2021


On Thu, 11 Nov 2021 02:50:52 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> but to get only C1 times and more or less accurate time you need to run with -XX:TieredStopAtLevel=3 -XX:CICompilerCount=1 flags.

I'm rerunning the benchmarks with this flag to only run C1. Will upload result after it finishes.

> But it does allow strange things like pointer() to return invalid memory, so again, I think it's best not to allow that.

Would it be sufficient if we add a null check in the assertion like this?

LIR_OprPtr* pointer() const { assert(_value != 0 && is_pointer(), "nullness and type check"); return (LIR_OprPtr*)_value; }


Another note that we need `LIR_Opr() : _value(0) {}` is that we need a default constructor for the ease of array initialization like `LIR_Opr FrameMap::_caller_save_cpu_regs[] = {};`. We probably don't want to use `LIR_Opr() : _value(-1) {}` as with the illegalOpr() approach, because it is a behavior change.

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

PR: https://git.openjdk.java.net/jdk/pull/6221


More information about the hotspot-compiler-dev mailing list