Skip to content

Commit 63bd40f

Browse files
committed
Fix compilation of StoreRange operation
1 parent 09e02b1 commit 63bd40f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -3158,7 +3158,7 @@ public static final class StoreRange {
31583158
public static void perform(VirtualFrame frame, LocalSetterRange locals, Object[] values,
31593159
@Bind BytecodeNode bytecode,
31603160
@Bind("$bytecodeIndex") int bci) {
3161-
if (values.length <= EXPLODE_LOOP_THRESHOLD) {
3161+
if (locals.getLength() <= EXPLODE_LOOP_THRESHOLD) {
31623162
doExploded(frame, locals, values, bytecode, bci);
31633163
} else {
31643164
doRegular(frame, locals, values, bytecode, bci);
@@ -3168,17 +3168,21 @@ public static void perform(VirtualFrame frame, LocalSetterRange locals, Object[]
31683168
@ExplodeLoop
31693169
private static void doExploded(VirtualFrame frame, LocalSetterRange locals, Object[] values,
31703170
BytecodeNode bytecode, int bci) {
3171-
CompilerAsserts.partialEvaluationConstant(values.length);
3172-
assert values.length == locals.getLength();
3173-
for (int i = 0; i < values.length; i++) {
3171+
CompilerAsserts.partialEvaluationConstant(locals.getLength());
3172+
if (locals.getLength() != values.length) {
3173+
throw CompilerDirectives.shouldNotReachHere("Value length did not match locals length");
3174+
}
3175+
for (int i = 0; i < locals.getLength(); i++) {
31743176
locals.setObject(bytecode, bci, frame, i, values[i]);
31753177
}
31763178
}
31773179

31783180
private static void doRegular(VirtualFrame frame, LocalSetterRange locals, Object[] values,
31793181
BytecodeNode bytecode, int bci) {
3180-
assert values.length == locals.getLength();
3181-
for (int i = 0; i < values.length; i++) {
3182+
if (locals.getLength() != values.length) {
3183+
throw CompilerDirectives.shouldNotReachHere("Value length did not match locals length");
3184+
}
3185+
for (int i = 0; i < locals.getLength(); i++) {
31823186
locals.setObject(bytecode, bci, frame, i, values[i]);
31833187
}
31843188
}

0 commit comments

Comments
 (0)