Skip to content

Commit

Permalink
Fix compilation of StoreRange operation
Browse files Browse the repository at this point in the history
  • Loading branch information
DSouzaM committed Sep 20, 2024
1 parent 09e02b1 commit 63bd40f
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3158,7 +3158,7 @@ public static final class StoreRange {
public static void perform(VirtualFrame frame, LocalSetterRange locals, Object[] values,
@Bind BytecodeNode bytecode,
@Bind("$bytecodeIndex") int bci) {
if (values.length <= EXPLODE_LOOP_THRESHOLD) {
if (locals.getLength() <= EXPLODE_LOOP_THRESHOLD) {
doExploded(frame, locals, values, bytecode, bci);
} else {
doRegular(frame, locals, values, bytecode, bci);
Expand All @@ -3168,17 +3168,21 @@ public static void perform(VirtualFrame frame, LocalSetterRange locals, Object[]
@ExplodeLoop
private static void doExploded(VirtualFrame frame, LocalSetterRange locals, Object[] values,
BytecodeNode bytecode, int bci) {
CompilerAsserts.partialEvaluationConstant(values.length);
assert values.length == locals.getLength();
for (int i = 0; i < values.length; i++) {
CompilerAsserts.partialEvaluationConstant(locals.getLength());
if (locals.getLength() != values.length) {
throw CompilerDirectives.shouldNotReachHere("Value length did not match locals length");
}
for (int i = 0; i < locals.getLength(); i++) {
locals.setObject(bytecode, bci, frame, i, values[i]);
}
}

private static void doRegular(VirtualFrame frame, LocalSetterRange locals, Object[] values,
BytecodeNode bytecode, int bci) {
assert values.length == locals.getLength();
for (int i = 0; i < values.length; i++) {
if (locals.getLength() != values.length) {
throw CompilerDirectives.shouldNotReachHere("Value length did not match locals length");
}
for (int i = 0; i < locals.getLength(); i++) {
locals.setObject(bytecode, bci, frame, i, values[i]);
}
}
Expand Down

0 comments on commit 63bd40f

Please sign in to comment.