RFR: 8263375: Support stack watermarks in Zero VM [v2]
Aleksey Shipilev
shade at openjdk.java.net
Wed Sep 1 11:12:20 UTC 2021
On Mon, 12 Jul 2021 11:59:46 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/cpu/zero/zeroInterpreter_zero.cpp line 205:
>>
>>> 203: // Notify the stack watermarks machinery that we are unwinding.
>>> 204: // Should do this before resetting the frame anchor.
>>> 205: stack_watermark_unwind_check(thread);
>>
>> I wonder if this should maybe move down a bit to where we inspect the reason we left the interpreter loop. There are multiple reasons and only some involve unwinding. I'm thinking BytecodeInterpreter::return_from_method and BytecodeInterpreter::do_osr
>>
>> Regarding BytecodeInterpreter::throwing_exception the current contract for exception handing is that an unwind handler is called *after* unwinding instead. We have some exception handler function in the interpreter runtime that gets called after unwinding with an exception into an interpreted frame. Hopefully that still gets called when using zero. Worth double checking.
>
> Thanks! I'll take a look after I am back from extended time off.
>
> Zero does not actually do OSR anymore (Zero gradually eroded to interpreter-only mode), so only return_from_method might need handling. I'll see what happens in throwing_exception case; worst case I think I can set up a one-off frame anchor and call the unwind handler with it.
OK, I think for `throwing_exception` case you mean `InterpreterRuntime::exception_handler_for_exception` that is called to do `StackWatermarkSet::after_unwind`. That thing is [called](https://github.com/openjdk/jdk/blob/0e14bf70cf6e482a2ec7d13ed37df0bee911740d/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp#L2492) from Zero during exception throwing, similar to the places in `TemplateInterpreter`-s for other arches.
New commit now only calls stack watermark check for `return_from_method` and `do_osr`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4728
More information about the hotspot-dev
mailing list