Skip to content

Commit 37089af

Browse files
committed
Small fix: encode index of ArrayIndex operation as constant operand
1 parent fde7e89 commit 37089af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,9 +3707,8 @@ private void patternHelperSequenceUnpack(PatternTy[] patterns, PatternContext pc
37073707

37083708
for (int i = 0; i < n; i++) {
37093709
b.beginStoreLocal(pc.subject);
3710-
b.beginArrayIndex();
3710+
b.beginArrayIndex(i);
37113711
b.emitLoadLocal(unpacked);
3712-
b.emitLoadConstant(i);
37133712
b.endArrayIndex();
37143713
b.endStoreLocal();
37153714

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,10 @@ public Object readSelf(Frame frame) {
892892
}
893893

894894
@Operation
895+
@ConstantOperand(type = int.class)
895896
public static final class ArrayIndex {
896897
@Specialization
897-
public static Object doObject(Object[] array, int i) {
898+
public static Object doObject(int i, Object[] array) {
898899
return array[i];
899900
}
900901
}

0 commit comments

Comments
 (0)