JDK-8209825 : guarantee(false) failed: wrong number of expression stack elements during deopt
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:11,12
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2018-08-22
Updated:2022-02-01
Resolved:2018-08-24
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
I hit this guarantee while using -XX:+VerifyStack. The problem is similar to JDK-8148871. I've added a test case to TestVerifyStackAfterDeopt.java to reproduce it.
It looks like "top_frame_expression_stack_adjustment" should take care of the fact that bytecodes like anewarray deopt in an "almost finished" state. However, if the following bytecode is an invoke, we do:
next_mask_expression_stack_size = invoke.size_of_parameters();
but I don't see where we take into account the stack size before or after the invoke. The above line assumes that stack is empty when we pushed the parameters.
22-08-2018
ILW = Guarantee failure with verification code, with -XX:+VerifyStack, no workaround = MLH = P4
22-08-2018
I'm guessing the problem is that both C1 and C2 pop the size value off the stack before generating the frame state for the slow call. There is no bci that exactly matches this state.
It seems like for the top frame, we should try to match the interpreter "state after", so we need to adjust by the size pushed by the bytecode.