Skip to content

Commit 985f08c

Browse files
authored
Merge pull request #136 from bulasevich/GR-63484
[Backport] [Oracle GraalVM] [GR-63484] Backport to 23.1: AMD64ArrayIndexOfOp: Fix short jump across unknown alignment.
2 parents 04a3c31 + 9422d79 commit 985f08c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/lir/amd64/AMD64ArrayIndexOfOp.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,12 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm) {
433433
asm.addq(index, bulkSize);
434434

435435
boolean bulkLoopShortJmp = !((variant == ArrayIndexOfVariant.MatchRange && nValues == 4 || variant == ArrayIndexOfVariant.Table) && stride.value > 1);
436-
// check if there are enough array slots remaining for the bulk loop
437-
asm.cmpqAndJcc(index, arrayLength, ConditionFlag.Greater, skipBulkVectorLoop, bulkLoopShortJmp);
436+
/*
437+
* Check if there are enough array slots remaining for the bulk loop. Note: The alignment
438+
* following the cmpAndJcc can lead to a jump distance > 127. This prevents safely using a
439+
* short jump.
440+
*/
441+
asm.cmpqAndJcc(index, arrayLength, ConditionFlag.Greater, skipBulkVectorLoop, false);
438442

439443
asm.align(preferredLoopAlignment(crb));
440444
asm.bind(bulkVectorLoop);

0 commit comments

Comments
 (0)