use of org.graalvm.compiler.asm.aarch64.AArch64Address in project graal by oracle.
the class AArch64HotSpotBackend method emitCodePrefix.
private void emitCodePrefix(CompilationResultBuilder crb, ResolvedJavaMethod installedCodeOwner, AArch64MacroAssembler masm, RegisterConfig regConfig, Label verifiedStub) {
HotSpotProviders providers = getProviders();
if (installedCodeOwner != null && !isStatic(installedCodeOwner.getModifiers())) {
crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
CallingConvention cc = regConfig.getCallingConvention(HotSpotCallingConventionType.JavaCallee, null, new JavaType[] { providers.getMetaAccess().lookupJavaType(Object.class) }, this);
// See definition of IC_Klass in c1_LIRAssembler_aarch64.cpp
// equal to scratch(1) careful!
Register inlineCacheKlass = AArch64HotSpotRegisterConfig.inlineCacheRegister;
Register receiver = asRegister(cc.getArgument(0));
int transferSize = config.useCompressedClassPointers ? 4 : 8;
AArch64Address klassAddress = masm.makeAddress(receiver, config.hubOffset, transferSize);
// Are r10 and r11 available scratch registers here? One would hope so.
Register klass = r10;
if (config.useCompressedClassPointers) {
masm.ldr(32, klass, klassAddress);
AArch64HotSpotMove.decodeKlassPointer(masm, klass, klass, providers.getRegisters().getHeapBaseRegister(), config.getKlassEncoding());
} else {
masm.ldr(64, klass, klassAddress);
}
masm.cmp(64, inlineCacheKlass, klass);
/*
* Conditional jumps have a much lower range than unconditional ones, which can be a
* problem because the miss handler could be out of range.
*/
masm.branchConditionally(AArch64Assembler.ConditionFlag.EQ, verifiedStub);
AArch64Call.directJmp(crb, masm, getForeignCalls().lookupForeignCall(IC_MISS_HANDLER));
}
masm.align(config.codeEntryAlignment);
crb.recordMark(config.MARKID_OSR_ENTRY);
masm.bind(verifiedStub);
crb.recordMark(config.MARKID_VERIFIED_ENTRY);
}
use of org.graalvm.compiler.asm.aarch64.AArch64Address in project graal by oracle.
the class AArch64Move method emitStackMove.
private static void emitStackMove(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, Value input) {
try (ScratchRegister r1 = masm.getScratchRegister()) {
try (ScratchRegister r2 = masm.getScratchRegister()) {
Register rscratch1 = r1.getRegister();
Register rscratch2 = r2.getRegister();
// use the slot kind to define the operand size
PlatformKind kind = input.getPlatformKind();
final int size = kind.getSizeInBytes() * Byte.SIZE;
// Always perform stack -> stack copies through integer registers
crb.blockComment("[stack -> stack copy]");
AArch64Address src = loadStackSlotAddress(crb, masm, asStackSlot(input), rscratch2);
masm.ldr(size, rscratch1, src);
AArch64Address dst = loadStackSlotAddress(crb, masm, asStackSlot(result), rscratch2);
masm.str(size, rscratch1, dst);
}
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64Address in project graal by oracle.
the class AArch64Move method reg2stack.
private static void reg2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, AllocatableValue result, AllocatableValue input) {
AArch64Address dest = loadStackSlotAddress(crb, masm, asStackSlot(result), Value.ILLEGAL);
Register src = asRegister(input);
// use the slot kind to define the operand size
AArch64Kind kind = (AArch64Kind) result.getPlatformKind();
final int size = kind.getSizeInBytes() * Byte.SIZE;
if (kind.isInteger()) {
masm.str(size, src, dest);
} else {
masm.fstr(size, src, dest);
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64Address in project graal by oracle.
the class AArch64Move method const2reg.
private static void const2reg(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant input) {
Register dst = asRegister(result);
switch(input.getJavaKind().getStackKind()) {
case Int:
final int value = input.asInt();
int maskedValue;
switch(input.getJavaKind()) {
case Boolean:
case Byte:
maskedValue = value & 0xFF;
break;
case Char:
case Short:
maskedValue = value & 0xFFFF;
break;
case Int:
maskedValue = value;
break;
default:
throw GraalError.shouldNotReachHere();
}
masm.mov(dst, maskedValue);
break;
case Long:
masm.mov(dst, input.asLong());
break;
case Float:
if (AArch64MacroAssembler.isFloatImmediate(input.asFloat())) {
masm.fmov(32, dst, input.asFloat());
} else {
masm.fldr(32, dst, (AArch64Address) crb.asFloatConstRef(input));
}
break;
case Double:
if (AArch64MacroAssembler.isDoubleImmediate(input.asDouble())) {
masm.fmov(64, dst, input.asDouble());
} else {
masm.fldr(64, dst, (AArch64Address) crb.asDoubleConstRef(input));
}
break;
case Object:
if (input.isNull()) {
masm.mov(dst, 0);
} else if (crb.target.inlineObjects) {
crb.recordInlineDataInCode(input);
masm.movNativeAddress(dst, 0xDEADDEADDEADDEADL);
} else {
masm.ldr(64, dst, (AArch64Address) crb.recordDataReferenceInCode(input, 8));
}
break;
default:
throw GraalError.shouldNotReachHere("kind=" + input.getJavaKind().getStackKind());
}
}
use of org.graalvm.compiler.asm.aarch64.AArch64Address in project graal by oracle.
the class AArch64MacroAssemblerTest method testLoadAddressUnscaled.
@Test
public void testLoadAddressUnscaled() {
Register dst = AArch64.r26;
AArch64Address address = AArch64Address.createUnscaledImmediateAddress(base, NumUtil.getNbitNumberInt(8));
masm.loadAddress(dst, address, 8);
asm.add(64, dst, base, NumUtil.getNbitNumberInt(8));
compareAssembly();
}
Aggregations