|
50 | 50 |
|
51 | 51 | import java.math.BigInteger; |
52 | 52 | import java.util.Arrays; |
| 53 | +import java.util.Collections; |
53 | 54 | import java.util.Set; |
54 | 55 | import java.util.concurrent.locks.Lock; |
55 | 56 |
|
|
208 | 209 | import com.oracle.truffle.api.HostCompilerDirectives.BytecodeInterpreterSwitch; |
209 | 210 | import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff; |
210 | 211 | import com.oracle.truffle.api.Truffle; |
211 | | -import com.oracle.truffle.api.TruffleLanguage; |
212 | 212 | import com.oracle.truffle.api.TruffleSafepoint; |
213 | 213 | import com.oracle.truffle.api.exception.AbstractTruffleException; |
214 | 214 | import com.oracle.truffle.api.frame.Frame; |
|
219 | 219 | import com.oracle.truffle.api.frame.VirtualFrame; |
220 | 220 | import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode; |
221 | 221 | import com.oracle.truffle.api.instrumentation.ProbeNode; |
| 222 | +import com.oracle.truffle.api.instrumentation.StandardTags; |
222 | 223 | import com.oracle.truffle.api.instrumentation.Tag; |
223 | 224 | import com.oracle.truffle.api.nodes.BytecodeOSRNode; |
224 | 225 | import com.oracle.truffle.api.nodes.ControlFlowException; |
@@ -575,21 +576,26 @@ private static Signature makeSignature(CodeUnit co) { |
575 | 576 | } |
576 | 577 |
|
577 | 578 | @TruffleBoundary |
578 | | - public static PBytecodeRootNode create(TruffleLanguage<?> language, CodeUnit co, Source source) { |
| 579 | + public static PBytecodeRootNode create(PythonLanguage language, CodeUnit co, Source source) { |
579 | 580 | return create(language, co, source, null); |
580 | 581 | } |
581 | 582 |
|
582 | 583 | @TruffleBoundary |
583 | | - public static PBytecodeRootNode create(TruffleLanguage<?> language, CodeUnit co, Source source, RaisePythonExceptionErrorCallback parserErrorCallback) { |
| 584 | + public static PBytecodeRootNode create(PythonLanguage language, CodeUnit co, Source source, RaisePythonExceptionErrorCallback parserErrorCallback) { |
584 | 585 | FrameInfo frameInfo = new FrameInfo(); |
585 | 586 | FrameDescriptor fd = makeFrameDescriptor(co, frameInfo); |
586 | 587 | PBytecodeRootNode rootNode = new PBytecodeRootNode(language, fd, makeSignature(co), co, source, parserErrorCallback); |
| 588 | + PythonContext context = PythonContext.get(rootNode); |
| 589 | + if (context != null && context.getOption(PythonOptions.EagerlyMaterializeInstrumentationNodes)) { |
| 590 | + rootNode.adoptChildren(); |
| 591 | + rootNode.instrumentationRoot.materializeInstrumentableNodes(Collections.singleton(StandardTags.StatementTag.class)); |
| 592 | + } |
587 | 593 | frameInfo.rootNode = rootNode; |
588 | 594 | return rootNode; |
589 | 595 | } |
590 | 596 |
|
591 | 597 | @TruffleBoundary |
592 | | - private PBytecodeRootNode(TruffleLanguage<?> language, FrameDescriptor fd, Signature sign, CodeUnit co, Source source, RaisePythonExceptionErrorCallback parserErrorCallback) { |
| 598 | + private PBytecodeRootNode(PythonLanguage language, FrameDescriptor fd, Signature sign, CodeUnit co, Source source, RaisePythonExceptionErrorCallback parserErrorCallback) { |
593 | 599 | super(language, fd); |
594 | 600 | this.celloffset = co.varnames.length; |
595 | 601 | this.freeoffset = celloffset + co.cellvars.length; |
|
0 commit comments