public abstract class Assembler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Assembler.CodeAnnotation |
static interface |
Assembler.InstructionCounter
Instruction counter class which gives the user of the assembler to count different kinds of
instructions in the generated assembler code.
|
static class |
Assembler.LabelHint |
Modifier and Type | Field and Description |
---|---|
protected Consumer<Assembler.CodeAnnotation> |
codePatchingAnnotationConsumer |
jdk.vm.ci.code.TargetDescription |
target |
Constructor and Description |
---|
Assembler(jdk.vm.ci.code.TargetDescription target) |
Modifier and Type | Method and Description |
---|---|
abstract void |
align(int modulus) |
void |
bind(Label l) |
byte[] |
close(boolean trimmedCopy)
Closes this assembler.
|
byte[] |
copy(int start,
int end) |
protected String |
createLabelName(Label l,
int id)
Creates a name for a label.
|
void |
emitByte(int x) |
void |
emitByte(int b,
int pos) |
void |
emitInt(int x) |
void |
emitInt(int b,
int pos) |
void |
emitLong(long x) |
void |
emitLong(long b,
int pos) |
void |
emitShort(int x) |
void |
emitShort(int b,
int pos) |
void |
emitString(String x)
Some GPU architectures have a text based encoding.
|
void |
emitString(String s,
int pos) |
void |
emitString0(String x) |
abstract void |
ensureUniquePC()
Emits a NOP instruction to advance the current PC.
|
int |
getByte(int pos) |
Assembler.InstructionCounter |
getInstructionCounter() |
int |
getInt(int pos) |
abstract AbstractAddress |
getPlaceholder(int instructionStartPosition)
Returns a target specific placeholder address that can be used for code patching.
|
int |
getShort(int pos) |
abstract void |
jmp(Label l) |
abstract AbstractAddress |
makeAddress(jdk.vm.ci.code.Register base,
int displacement)
This is used by the CompilationResultBuilder to convert a
StackSlot to an
AbstractAddress . |
String |
nameOf(Label l)
Gets a name for a label, creating it if it does not yet exist.
|
protected abstract void |
patchJumpTarget(int branch,
int jumpTarget) |
int |
position()
Returns the current position of the underlying code buffer.
|
Assembler.LabelHint |
requestLabelHint(Label label) |
void |
reset() |
void |
setCodePatchingAnnotationConsumer(Consumer<Assembler.CodeAnnotation> codeAnnotationConsumer) |
public final jdk.vm.ci.code.TargetDescription target
protected Consumer<Assembler.CodeAnnotation> codePatchingAnnotationConsumer
public void setCodePatchingAnnotationConsumer(Consumer<Assembler.CodeAnnotation> codeAnnotationConsumer)
public int position()
public final void emitByte(int x)
public final void emitShort(int x)
public final void emitInt(int x)
public final void emitLong(long x)
public final void emitByte(int b, int pos)
public final void emitShort(int b, int pos)
public final void emitInt(int b, int pos)
public final void emitLong(long b, int pos)
public final int getByte(int pos)
public final int getShort(int pos)
public final int getInt(int pos)
public final void emitString(String x)
public final void emitString0(String x)
public void emitString(String s, int pos)
public byte[] close(boolean trimmedCopy)
trimmedCopy
- if true
, then a copy of the underlying byte array up to (but not
including) position()
is returnedtrimmedCopy
is true
public byte[] copy(int start, int end)
public void bind(Label l)
public abstract void align(int modulus)
public abstract void jmp(Label l)
protected abstract void patchJumpTarget(int branch, int jumpTarget)
protected String createLabelName(Label l, int id)
l
- the label for which a name is being createdid
- a label identifier that is unique with the scope of this assemblerpublic String nameOf(Label l)
public abstract AbstractAddress makeAddress(jdk.vm.ci.code.Register base, int displacement)
StackSlot
to an
AbstractAddress
.public abstract AbstractAddress getPlaceholder(int instructionStartPosition)
instructionStartPosition
- The start of the instruction, i.e., the value that is used as
the key for looking up placeholder patching information.public abstract void ensureUniquePC()
public void reset()
public Assembler.LabelHint requestLabelHint(Label label)
public Assembler.InstructionCounter getInstructionCounter()