@@ -1338,6 +1338,16 @@ protected void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKi
13381338 deopt .updateNodeSourcePosition (() -> createBytecodePosition ());
13391339 }
13401340
1341+ protected FrameStateBuilder createFrameStateForExceptionHandling (@ SuppressWarnings ("unused" ) int bci ) {
1342+ FrameStateBuilder dispatchState = frameState .copy ();
1343+ dispatchState .clearStack ();
1344+ return dispatchState ;
1345+ }
1346+
1347+ protected void clearNonLiveLocals (FrameStateBuilder state , BciBlock block , boolean liveIn ) {
1348+ state .clearNonLiveLocals (block , liveness , liveIn );
1349+ }
1350+
13411351 /**
13421352 * @return the entry point to exception dispatch
13431353 */
@@ -1346,8 +1356,7 @@ protected AbstractBeginNode handleException(ValueNode exceptionObject, int bci,
13461356 assert bci == BytecodeFrame .BEFORE_BCI || bci == bci () : "invalid bci" ;
13471357 debug .log ("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s" , bci , exceptionObject , (profilingInfo == null ? "" : profilingInfo .getExceptionSeen (bci )));
13481358
1349- FrameStateBuilder dispatchState = frameState .copy ();
1350- dispatchState .clearStack ();
1359+ FrameStateBuilder dispatchState = createFrameStateForExceptionHandling (bci );
13511360
13521361 AbstractBeginNode dispatchBegin ;
13531362 if (exceptionObject == null ) {
@@ -1374,13 +1383,20 @@ protected AbstractBeginNode handleException(ValueNode exceptionObject, int bci,
13741383 return dispatchBegin ;
13751384 }
13761385
1377- protected void createHandleExceptionTarget (FixedWithNextNode afterExceptionLoaded , int bci , FrameStateBuilder dispatchState ) {
1386+ private void createHandleExceptionTarget (FixedWithNextNode afterExceptionLoaded , int bci , FrameStateBuilder dispatchState ) {
13781387 FixedWithNextNode afterInstrumentation = afterExceptionLoaded ;
13791388 for (NodePlugin plugin : graphBuilderConfig .getPlugins ().getNodePlugins ()) {
13801389 afterInstrumentation = plugin .instrumentExceptionDispatch (graph , afterInstrumentation , () -> dispatchState .create (bci , getNonIntrinsicAncestor (), false , null , null ));
13811390 assert afterInstrumentation .next () == null : "exception dispatch instrumentation will be linked to dispatch block" ;
13821391 }
13831392
1393+ BciBlock dispatchBlock = getDispatchBlock (bci );
1394+
1395+ FixedNode target = createTarget (dispatchBlock , dispatchState );
1396+ afterInstrumentation .setNext (target );
1397+ }
1398+
1399+ protected BciBlock getDispatchBlock (int bci ) {
13841400 BciBlock dispatchBlock = currentBlock .exceptionDispatchBlock ();
13851401 /*
13861402 * The exception dispatch block is always for the last bytecode of a block, so if we are not
@@ -1391,8 +1407,7 @@ protected void createHandleExceptionTarget(FixedWithNextNode afterExceptionLoade
13911407 dispatchBlock = blockMap .getUnwindBlock ();
13921408 }
13931409
1394- FixedNode target = createTarget (dispatchBlock , dispatchState );
1395- afterInstrumentation .setNext (target );
1410+ return dispatchBlock ;
13961411 }
13971412
13981413 protected ValueNode genLoadIndexed (ValueNode array , ValueNode index , GuardingNode boundsCheck , JavaKind kind ) {
0 commit comments