Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb00bf6

Browse files
committed
Pass index to load LoadVariableArguments and LoadKeywordArguments
1 parent dd197a1 commit fb00bf6

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,15 +1524,15 @@ private void copyArguments(ArgumentsTy args, Builder b) {
15241524
BytecodeLocal local = getLocal(args.varArg.arg);
15251525
assert local != null;
15261526
b.beginStoreLocal(local);
1527-
b.emitLoadVariableArguments();
1527+
b.emitLoadVariableArguments(argIdx++);
15281528
b.endStoreLocal();
15291529
}
15301530

15311531
if (args.kwArg != null) {
15321532
BytecodeLocal local = getLocal(args.kwArg.arg);
15331533
assert local != null;
15341534
b.beginStoreLocal(local);
1535-
b.emitLoadKeywordArguments();
1535+
b.emitLoadKeywordArguments(argIdx);
15361536
b.endStoreLocal();
15371537
}
15381538
}

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,25 +1051,22 @@ public static boolean hasLocals(VirtualFrame frame) {
10511051
}
10521052

10531053
@Operation
1054+
@ConstantOperand(type = int.class)
10541055
public static final class LoadVariableArguments {
10551056
@Specialization
1056-
public static Object perform(VirtualFrame frame,
1057+
public static Object perform(VirtualFrame frame, int index,
10571058
@Bind PBytecodeDSLRootNode rootNode) {
1058-
int index = rootNode.co.getRegularArgCount();
1059-
return PFactory.createTuple(rootNode.getLanguage(), (Object[]) PArguments.getArgument(frame, index));
1059+
return PFactory.createTuple(rootNode.getLanguage(), (Object[]) frame.getArguments()[index]);
10601060
}
10611061
}
10621062

10631063
@Operation
1064+
@ConstantOperand(type = int.class)
10641065
public static final class LoadKeywordArguments {
10651066
@Specialization
1066-
public static Object perform(VirtualFrame frame,
1067+
public static Object perform(VirtualFrame frame, int index,
10671068
@Bind PBytecodeDSLRootNode rootNode) {
1068-
int index = rootNode.co.getRegularArgCount();
1069-
if (rootNode.co.takesVarArgs()) {
1070-
index++;
1071-
}
1072-
return PFactory.createDict(rootNode.getLanguage(), (PKeyword[]) PArguments.getArgument(frame, index));
1069+
return PFactory.createDict(rootNode.getLanguage(), (PKeyword[]) frame.getArguments()[index]);
10731070
}
10741071
}
10751072

0 commit comments

Comments
 (0)