Skip to content

Commit 4a7b2f6

Browse files
committed
Pass RootNode directly to CalleeContext.enter to avoid the loop in getRootNode()
1 parent 4273bc8 commit 4a7b2f6

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/builtin/modules/ConversionNodeTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected static Object call(Object arg, ArgumentCastNode castNode) {
7676
public Object execute(VirtualFrame frame) {
7777
GilNode gilNode = GilNode.getUncached();
7878
boolean wasAcquired = gilNode.acquire();
79-
calleeContext.enter(frame);
79+
calleeContext.enter(frame, this);
8080
try {
8181
return node.execute(frame, PArguments.getArgument(frame, 0));
8282
} finally {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/ExternalFunctionNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ private void prepareArguments(Object[] arguments) {
871871

872872
@Override
873873
public final Object execute(VirtualFrame frame) {
874-
calleeContext.enter(frame);
874+
calleeContext.enter(frame, this);
875875
try {
876876
Object callable = ensureReadCallableNode().execute(frame);
877877
Object[] cArguments = prepareCArguments(frame);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SortNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ enum Result {
125125

126126
@Override
127127
public Object execute(VirtualFrame frame) {
128-
calleeContext.enter(frame);
128+
calleeContext.enter(frame, this);
129129
try {
130130
Object[] arguments = frame.getArguments();
131131
Object a = arguments[PArguments.USER_ARGUMENTS_OFFSET];

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyTraceBackPrint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ private static void printInternal(Node inliningTarget, TracebackBuiltins.GetTrac
345345
PythonLanguage language = PythonLanguage.get(inliningTarget);
346346
while (tb != null) {
347347
final PCode code = getCode(language, getTbFrameNode, tb);
348-
if (lastFile == null ||
348+
if (lastFile == null || code.getFilename() == null ||
349349
!tstrEqNode.execute(code.getFilename(), lastFile, TS_ENCODING) ||
350350
lastLine == -1 || tb.getLineno() != lastLine ||
351351
lastName == null || !tstrEqNode.execute(code.getName(), lastName, TS_ENCODING)) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode/PBytecodeRootNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ int getInitialStackTop() {
10861086

10871087
@Override
10881088
public Object execute(VirtualFrame virtualFrame) {
1089-
calleeContext.enter(virtualFrame);
1089+
calleeContext.enter(virtualFrame, this);
10901090
try {
10911091
copyArgsAndCells(virtualFrame, virtualFrame.getArguments());
10921092
return executeFromBci(virtualFrame, virtualFrame, this, 0, getInitialStackTop());

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public static final class EnterCalleeContext {
452452
@Specialization
453453
public static void doEnter(VirtualFrame frame,
454454
@Bind PBytecodeDSLRootNode root) {
455-
root.calleeContext.enter(frame);
455+
root.calleeContext.enter(frame, root);
456456

457457
if (root.needsTraceAndProfileInstrumentation()) {
458458
root.ensureTraceAndProfileEnabled();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/function/BuiltinFunctionRootNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public Object execute(VirtualFrame frame) {
332332
body = insert(newBody);
333333
}
334334
}
335-
calleeContext.enter(frame);
335+
calleeContext.enter(frame, this);
336336
try {
337337
return body.execute(frame);
338338
} finally {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/AsyncHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected CallRootNode(TruffleLanguage<?> language) {
288288

289289
@Override
290290
public Object execute(VirtualFrame frame) {
291-
calleeContext.enter(frame);
291+
calleeContext.enter(frame, this);
292292
Object[] frameArguments = frame.getArguments();
293293
Object callable = PArguments.getArgument(frameArguments, ASYNC_CALLABLE_INDEX);
294294
int frameIndex = (int) PArguments.getArgument(frameArguments, ASYNC_FRAME_INDEX_INDEX);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/ExecutionContext.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ public static PassExceptionStateNode getUncached() {
365365
}
366366

367367
/**
368-
* Execution of a Python function should be wrapped with {@link #enter(VirtualFrame)} and
369-
* {@link #exit(VirtualFrame, PRootNode)}.
368+
* Execution of a Python function should be wrapped with {@link #enter(VirtualFrame, PRootNode)}
369+
* and {@link #exit(VirtualFrame, PRootNode)}.
370370
* <p>
371371
* When entering the function we create the
372372
* {@link com.oracle.graal.python.builtins.objects.frame.PFrame.Reference} that represents the
@@ -397,12 +397,12 @@ public Node copy() {
397397
/**
398398
* Wrap the execution of a Python callee called from a Python frame.
399399
*/
400-
public void enter(VirtualFrame frame) {
400+
public void enter(VirtualFrame frame, PRootNode rootNode) {
401401
// TODO: assert PythonLanguage.getContext().ownsGil() :
402402
// PythonContext.dumpStackOnAssertionHelper("callee w/o GIL");
403403
// tfel: Create our frame reference here and store it so that
404404
// there's no reference to it from the caller side.
405-
PFrame.Reference thisFrameRef = new PFrame.Reference(getRootNode(), PArguments.getCallerFrameInfo(frame));
405+
PFrame.Reference thisFrameRef = new PFrame.Reference(rootNode, PArguments.getCallerFrameInfo(frame));
406406
PArguments.setCurrentFrameInfo(frame, thisFrameRef);
407407
}
408408

0 commit comments

Comments
 (0)