src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm/src/org/graalvm/compiler/asm/Label.java
equal
deleted
inserted
replaced
23 |
23 |
24 |
24 |
25 package org.graalvm.compiler.asm; |
25 package org.graalvm.compiler.asm; |
26 |
26 |
27 import java.util.ArrayList; |
27 import java.util.ArrayList; |
|
28 |
|
29 import org.graalvm.compiler.debug.GraalError; |
28 |
30 |
29 /** |
31 /** |
30 * This class represents a label within assembly code. |
32 * This class represents a label within assembly code. |
31 */ |
33 */ |
32 public final class Label { |
34 public final class Label { |
69 /** |
71 /** |
70 * Binds the label to {@code pos} and patches all instructions added by |
72 * Binds the label to {@code pos} and patches all instructions added by |
71 * {@link #addPatchAt(int, Assembler)}. |
73 * {@link #addPatchAt(int, Assembler)}. |
72 */ |
74 */ |
73 protected void bind(int pos, Assembler asm) { |
75 protected void bind(int pos, Assembler asm) { |
74 assert pos >= 0; |
76 if (pos < 0) { |
|
77 throw new GraalError("Cannot bind label to negative position %d", pos); |
|
78 } |
75 this.position = pos; |
79 this.position = pos; |
76 if (patchPositions != null) { |
80 if (patchPositions != null) { |
77 for (int i = 0; i < patchPositions.size(); ++i) { |
81 for (int i = 0; i < patchPositions.size(); ++i) { |
78 asm.patchJumpTarget(patchPositions.get(i), position); |
82 asm.patchJumpTarget(patchPositions.get(i), position); |
79 } |
83 } |