@@ -541,10 +541,14 @@ private InstrumentationData getInstrumentationData(VirtualFrame frame, BytecodeN
541541 private void resetInstrumentationData (VirtualFrame frame , BytecodeNode bytecode ) {
542542 InstrumentationData current = (InstrumentationData ) bytecode .getLocalValue (0 , frame , instrumentationDataIndex );
543543 if (current == null ) {
544- current = new InstrumentationData (maxProfileCEventStackSize );
545- bytecode .setLocalValue (0 , frame , instrumentationDataIndex , current );
544+ initInstrumentationData (frame , bytecode );
545+ } else {
546+ current .reset ();
546547 }
547- current .reset ();
548+ }
549+
550+ private void initInstrumentationData (VirtualFrame frame , BytecodeNode bytecode ) {
551+ bytecode .setLocalValue (0 , frame , instrumentationDataIndex , new InstrumentationData (maxProfileCEventStackSize ));
548552 }
549553
550554 private void resetInstrumentationDataForResume (VirtualFrame frame , BytecodeNode bytecode , int bci ) {
@@ -558,7 +562,7 @@ public static final class EnterInstrumentedRoot {
558562 public static void doEnter (VirtualFrame frame ,
559563 @ Bind PBytecodeDSLRootNode root ,
560564 @ Bind BytecodeNode bytecode ) {
561- root .resetInstrumentationData (frame , bytecode );
565+ root .initInstrumentationData (frame , bytecode );
562566 }
563567 }
564568
@@ -698,9 +702,7 @@ void startProfileCEventCall(PBytecodeDSLRootNode root, VirtualFrame frame, Bytec
698702
699703 void clearProfileCEventCallableStack () {
700704 if (profileCEventCallables != null ) {
701- for (int i = 0 ; i < profileCEventStackTop ; i ++) {
702- profileCEventCallables [i ] = null ;
703- }
705+ PythonUtils .fill (profileCEventCallables , 0 , profileCEventStackTop , null );
704706 }
705707 profileCEventStackTop = 0 ;
706708 profileCEventCallStarted = false ;
0 commit comments