@@ -1792,7 +1792,7 @@ private boolean genDynamicInvokeHelper(ResolvedJavaMethod target, int cpi, int o
17921792
17931793 }
17941794
1795- boolean hasReceiver = ( opcode == INVOKEDYNAMIC ) ? false : !target .isStatic ();
1795+ boolean hasReceiver = opcode != INVOKEDYNAMIC && !target .isStatic ();
17961796 ValueNode [] args = frameState .popArguments (target .getSignature ().getParameterCount (hasReceiver ));
17971797 if (hasReceiver ) {
17981798 appendInvoke (InvokeKind .Virtual , target , args , null );
@@ -2089,12 +2089,7 @@ private static boolean checkPartialIntrinsicExit(ValueNode[] originalArgs, Value
20892089 protected Invoke createNonInlinedInvoke (ExceptionEdgeAction exceptionEdge , int invokeBci , ValueNode [] invokeArgs , ResolvedJavaMethod targetMethod ,
20902090 InvokeKind invokeKind , JavaKind resultType , JavaType returnType , JavaTypeProfile profile ) {
20912091
2092- StampPair returnStamp = graphBuilderConfig .getPlugins ().getOverridingStamp (this , returnType , false );
2093- if (returnStamp == null ) {
2094- returnStamp = StampFactory .forDeclaredType (graph .getAssumptions (), returnType , false );
2095- }
2096-
2097- MethodCallTargetNode callTarget = graph .add (createMethodCallTarget (invokeKind , targetMethod , invokeArgs , returnStamp , profile ));
2092+ MethodCallTargetNode callTarget = graph .add (createMethodCallTarget (invokeKind , targetMethod , invokeArgs , returnType , profile ));
20982093 Invoke invoke = createNonInlinedInvoke (exceptionEdge , invokeBci , callTarget , resultType );
20992094
21002095 for (InlineInvokePlugin plugin : graphBuilderConfig .getPlugins ().getInlineInvokePlugins ()) {
@@ -2105,11 +2100,14 @@ protected Invoke createNonInlinedInvoke(ExceptionEdgeAction exceptionEdge, int i
21052100 }
21062101
21072102 protected Invoke createNonInlinedInvoke (ExceptionEdgeAction exceptionEdge , int invokeBci , CallTargetNode callTarget , JavaKind resultType ) {
2103+ Invoke invoke ;
21082104 if (exceptionEdge == ExceptionEdgeAction .OMIT ) {
2109- return createInvoke (invokeBci , callTarget , resultType );
2105+ invoke = append ( createInvoke (invokeBci , callTarget , resultType ) );
21102106 } else {
2111- return createInvokeWithException (invokeBci , callTarget , resultType , exceptionEdge );
2107+ invoke = append ( createInvokeWithException (invokeBci , callTarget , resultType , exceptionEdge ) );
21122108 }
2109+ invoke .setStateAfter (createFrameState (stream .nextBCI (), invoke ));
2110+ return invoke ;
21132111 }
21142112
21152113 /**
@@ -2675,14 +2673,22 @@ private ValueNode processCalleeReturn(ResolvedJavaMethod targetMethod, InliningS
26752673 return null ;
26762674 }
26772675
2676+ public MethodCallTargetNode createMethodCallTarget (InvokeKind invokeKind , ResolvedJavaMethod targetMethod , ValueNode [] args , JavaType returnType , JavaTypeProfile profile ) {
2677+ StampPair returnStamp = graphBuilderConfig .getPlugins ().getOverridingStamp (this , returnType , false );
2678+ if (returnStamp == null ) {
2679+ returnStamp = StampFactory .forDeclaredType (graph .getAssumptions (), returnType , false );
2680+ }
2681+
2682+ return createMethodCallTarget (invokeKind , targetMethod , args , returnStamp , profile );
2683+ }
2684+
26782685 public MethodCallTargetNode createMethodCallTarget (InvokeKind invokeKind , ResolvedJavaMethod targetMethod , ValueNode [] args , StampPair returnStamp , JavaTypeProfile profile ) {
26792686 return new MethodCallTargetNode (invokeKind , targetMethod , args , returnStamp , profile );
26802687 }
26812688
26822689 protected InvokeNode createInvoke (int invokeBci , CallTargetNode callTarget , JavaKind resultType ) {
2683- InvokeNode invoke = append ( new InvokeNode (callTarget , invokeBci ) );
2690+ InvokeNode invoke = new InvokeNode (callTarget , invokeBci );
26842691 frameState .pushReturn (resultType , invoke );
2685- invoke .setStateAfter (createFrameState (stream .nextBCI (), invoke ));
26862692 return invoke ;
26872693 }
26882694
@@ -2696,9 +2702,8 @@ protected InvokeWithExceptionNode createInvokeWithException(int invokeBci, CallT
26962702 }
26972703
26982704 AbstractBeginNode exceptionEdge = handleException (null , bci (), exceptionEdgeAction == ExceptionEdgeAction .INCLUDE_AND_DEOPTIMIZE );
2699- InvokeWithExceptionNode invoke = append ( new InvokeWithExceptionNode (callTarget , exceptionEdge , invokeBci ) );
2705+ InvokeWithExceptionNode invoke = new InvokeWithExceptionNode (callTarget , exceptionEdge , invokeBci );
27002706 frameState .pushReturn (resultType , invoke );
2701- invoke .setStateAfter (createFrameState (stream .nextBCI (), invoke ));
27022707 return invoke ;
27032708 }
27042709
@@ -3939,7 +3944,7 @@ public BailoutException bailout(String string) {
39393944 throw GraphUtil .createBailoutException (string , bailout , elements );
39403945 }
39413946
3942- private FrameState createFrameState (int bci , StateSplit forStateSplit ) {
3947+ protected FrameState createFrameState (int bci , StateSplit forStateSplit ) {
39433948 assert !(forStateSplit instanceof BytecodeExceptionNode ) : Assertions .errorMessageContext ("forStateSplit" , forStateSplit );
39443949 if (currentBlock != null && bci > currentBlock .getEndBci ()) {
39453950 frameState .clearNonLiveLocals (currentBlock , liveness , false );
@@ -4023,19 +4028,24 @@ public void storeLocal(JavaKind kind, int index) {
40234028
40244029 protected void genLoadConstant (int cpi , int opcode ) {
40254030 Object con = lookupConstant (cpi , opcode , false );
4031+ genLoadConstantHelper (con , opcode );
4032+ }
4033+
4034+ protected void genLoadConstantHelper (Object con , int opcode ) {
40264035 if (con == null ) {
40274036 handleUnresolvedLoadConstant (null );
4028- } else if (con instanceof JavaType ) {
4037+ } else if (con instanceof JavaType type ) {
40294038 // this is a load of class constant which might be unresolved
4030- JavaType type = (JavaType ) con ;
40314039 if (typeIsResolved (type )) {
4040+ assert opcode != LDC2_W : "Type cannot use two slots" ;
40324041 frameState .push (JavaKind .Object , appendConstant (getConstantReflection ().asJavaClass ((ResolvedJavaType ) type )));
40334042 } else {
40344043 handleUnresolvedLoadConstant (type );
40354044 }
4036- } else if (con instanceof JavaConstant ) {
4037- JavaConstant constant = (JavaConstant ) con ;
4038- frameState .push (constant .getJavaKind (), appendConstant (constant ));
4045+ } else if (con instanceof JavaConstant constant ) {
4046+ JavaKind javaKind = constant .getJavaKind ();
4047+ assert (opcode == LDC2_W ) == javaKind .needsTwoSlots () : "Constant required incorrect number of slots: needsTwoSlots is " + javaKind .needsTwoSlots ();
4048+ frameState .push (javaKind , appendConstant (constant ));
40394049 } else if (!(con instanceof Throwable )) {
40404050 /**
40414051 * We use the exceptional return value of {@link #lookupConstant(int, int)} as sentinel
0 commit comments