From 2d15e700ffa84ce3567fc2db1534ab98c3ba9c66 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 May 2026 09:01:24 +0200 Subject: [PATCH] Fix deopt in tracing --- .../nodes/bytecode_dsl/PBytecodeDSLRootNode.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java index 8382ba60fe..948e328db9 100644 --- a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java +++ b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java @@ -541,10 +541,14 @@ private InstrumentationData getInstrumentationData(VirtualFrame frame, BytecodeN private void resetInstrumentationData(VirtualFrame frame, BytecodeNode bytecode) { InstrumentationData current = (InstrumentationData) bytecode.getLocalValue(0, frame, instrumentationDataIndex); if (current == null) { - current = new InstrumentationData(maxProfileCEventStackSize); - bytecode.setLocalValue(0, frame, instrumentationDataIndex, current); + initInstrumentationData(frame, bytecode); + } else { + current.reset(); } - current.reset(); + } + + private void initInstrumentationData(VirtualFrame frame, BytecodeNode bytecode) { + bytecode.setLocalValue(0, frame, instrumentationDataIndex, new InstrumentationData(maxProfileCEventStackSize)); } private void resetInstrumentationDataForResume(VirtualFrame frame, BytecodeNode bytecode, int bci) { @@ -558,7 +562,7 @@ public static final class EnterInstrumentedRoot { public static void doEnter(VirtualFrame frame, @Bind PBytecodeDSLRootNode root, @Bind BytecodeNode bytecode) { - root.resetInstrumentationData(frame, bytecode); + root.initInstrumentationData(frame, bytecode); } } @@ -698,9 +702,7 @@ void startProfileCEventCall(PBytecodeDSLRootNode root, VirtualFrame frame, Bytec void clearProfileCEventCallableStack() { if (profileCEventCallables != null) { - for (int i = 0; i < profileCEventStackTop; i++) { - profileCEventCallables[i] = null; - } + PythonUtils.fill(profileCEventCallables, 0, profileCEventStackTop, null); } profileCEventStackTop = 0; profileCEventCallStarted = false;