[Sablevm-developer] adventures in not understanding the java stack
Brought to you by:
egagnon
From: Chris P. <chr...@ma...> - 2004-01-17 05:20:04
|
Hello, In order for speculation to work, I require the following to be true for INVOKE<X> instructions: 1) the method has fully exited and the instruction after the INVOKE<X> is the next instruction to be executed when the height of stack.current_frame returns to the height before the INVOKE<X> (this handles the problem of recursion) 2) the stack after the INVOKE<X> is identical to the stack before the INVOKE<X>, except for possibly popped parameters (including a possible objectref) and a possibly pushed return value. I've found that the following can invalidate this: 1) An exception being thrown in the callee (or one of the callee's callees), or some other exception-related irregular control flow -- currently flagged at exception_handler: in interpreter.c, at ATHROW, and at INTERNAL_CALL_END 2) GC being called in the callee (or one of the callee's callees) -- flagged inside _svmf_stop_the_world() 3) The callee (or one of the callee's callees) being a native method. I can understand (1) -- irregular control flow means that the stack returns to the same height without the instruction after the INVOKE<X> being next I can understand (2) -- GC being called would change references on the stack, thus making requirement 2 fail but ... I don't understand (3). So ... can somebody explain (3) for me? Can native code affect stack values or control flow without going through the exception_handler: in interpreter.c or going through _svmf_stop_the_world? If so, where does it do it? Also, is there anything else you can think of that might break requirements 1 and 2? Cheers, and thanks for any suggestions, Chris |