< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRGenerator.java

Print this page

        

*** 37,47 **** import java.util.List; import org.graalvm.compiler.asm.amd64.AMD64Address.Scale; import org.graalvm.compiler.core.amd64.AMD64ArithmeticLIRGenerator; import org.graalvm.compiler.core.amd64.AMD64LIRGenerator; - import org.graalvm.compiler.core.amd64.AMD64LIRKindTool; import org.graalvm.compiler.core.amd64.AMD64MoveFactoryBase.BackupSlotProvider; import org.graalvm.compiler.core.common.CompressEncoding; import org.graalvm.compiler.core.common.LIRKind; import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; import org.graalvm.compiler.core.common.spi.ForeignCallLinkage; --- 37,46 ----
*** 114,124 **** protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes) { this(providers, config, lirGenRes, new BackupSlotProvider(lirGenRes.getFrameMapBuilder())); } private AMD64HotSpotLIRGenerator(HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes, BackupSlotProvider backupSlotProvider) { ! this(new AMD64LIRKindTool(), new AMD64HotSpotArithmeticLIRGenerator(), new AMD64HotSpotMoveFactory(backupSlotProvider), providers, config, lirGenRes); } protected AMD64HotSpotLIRGenerator(LIRKindTool lirKindTool, AMD64ArithmeticLIRGenerator arithmeticLIRGen, MoveFactory moveFactory, HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes) { super(lirKindTool, arithmeticLIRGen, moveFactory, providers, lirGenRes); --- 113,123 ---- protected AMD64HotSpotLIRGenerator(HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes) { this(providers, config, lirGenRes, new BackupSlotProvider(lirGenRes.getFrameMapBuilder())); } private AMD64HotSpotLIRGenerator(HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes, BackupSlotProvider backupSlotProvider) { ! this(new AMD64HotSpotLIRKindTool(), new AMD64HotSpotArithmeticLIRGenerator(), new AMD64HotSpotMoveFactory(backupSlotProvider), providers, config, lirGenRes); } protected AMD64HotSpotLIRGenerator(LIRKindTool lirKindTool, AMD64ArithmeticLIRGenerator arithmeticLIRGen, MoveFactory moveFactory, HotSpotProviders providers, GraalHotSpotVMConfig config, LIRGenerationResult lirGenRes) { super(lirKindTool, arithmeticLIRGen, moveFactory, providers, lirGenRes);
*** 361,371 **** AMD64SaveRegistersOp save = null; Stub stub = getStub(); if (destroysRegisters) { if (stub != null && stub.preservesRegisters()) { ! Register[] savedRegisters = getResult().getFrameMapBuilder().getRegisterConfig().getAllocatableRegisters().toArray(); save = emitSaveAllRegisters(savedRegisters, true); } } Variable result; --- 360,370 ---- AMD64SaveRegistersOp save = null; Stub stub = getStub(); if (destroysRegisters) { if (stub != null && stub.preservesRegisters()) { ! Register[] savedRegisters = getRegisterConfig().getAllocatableRegisters().toArray(); save = emitSaveAllRegisters(savedRegisters, true); } } Variable result;
*** 565,645 **** } @Override public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) { LIRKind inputKind = pointer.getValueKind(LIRKind.class); ! assert inputKind.getPlatformKind() == AMD64Kind.QWORD; if (inputKind.isReference(0)) { // oop ! Variable result = newVariable(LIRKind.reference(AMD64Kind.DWORD)); ! append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); return result; } else { // metaspace pointer ! Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD)); AllocatableValue base = Value.ILLEGAL; OptionValues options = getResult().getLIR().getOptions(); if (encoding.hasBase() || GeneratePIC.getValue(options)) { if (GeneratePIC.getValue(options)) { ! Variable baseAddress = newVariable(LIRKind.value(AMD64Kind.QWORD)); AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config); append(move); base = baseAddress; } else { ! base = emitLoadConstant(LIRKind.value(AMD64Kind.QWORD), JavaConstant.forLong(encoding.getBase())); } } ! append(new AMD64HotSpotMove.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); return result; } } @Override public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) { LIRKind inputKind = pointer.getValueKind(LIRKind.class); ! assert inputKind.getPlatformKind() == AMD64Kind.DWORD; if (inputKind.isReference(0)) { // oop ! Variable result = newVariable(LIRKind.reference(AMD64Kind.QWORD)); ! append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); return result; } else { // metaspace pointer ! Variable result = newVariable(LIRKind.value(AMD64Kind.QWORD)); AllocatableValue base = Value.ILLEGAL; OptionValues options = getResult().getLIR().getOptions(); if (encoding.hasBase() || GeneratePIC.getValue(options)) { if (GeneratePIC.getValue(options)) { ! Variable baseAddress = newVariable(LIRKind.value(AMD64Kind.QWORD)); AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config); append(move); base = baseAddress; } else { ! base = emitLoadConstant(LIRKind.value(AMD64Kind.QWORD), JavaConstant.forLong(encoding.getBase())); } } ! append(new AMD64HotSpotMove.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull)); return result; } } @Override public void emitNullCheck(Value address, LIRFrameState state) { ! if (address.getValueKind().getPlatformKind() == AMD64Kind.DWORD) { CompressEncoding encoding = config.getOopEncoding(); Value uncompressed; if (encoding.getShift() <= 3) { LIRKind wordKind = LIRKind.unknownReference(target().arch.getWordKind()); uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.getShift()), 0); } else { uncompressed = emitUncompress(address, encoding, false); } append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state)); ! } else { ! super.emitNullCheck(address, state); } } @Override public LIRInstruction createBenchmarkCounter(String name, String group, Value increment) { if (BenchmarkCounters.enabled) { --- 564,647 ---- } @Override public Value emitCompress(Value pointer, CompressEncoding encoding, boolean nonNull) { LIRKind inputKind = pointer.getValueKind(LIRKind.class); ! LIRKindTool lirKindTool = getLIRKindTool(); ! assert inputKind.getPlatformKind() == lirKindTool.getObjectKind().getPlatformKind(); if (inputKind.isReference(0)) { // oop ! Variable result = newVariable(lirKindTool.getNarrowOopKind()); ! append(new AMD64Move.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, getLIRKindTool())); return result; } else { // metaspace pointer ! Variable result = newVariable(lirKindTool.getNarrowPointerKind()); AllocatableValue base = Value.ILLEGAL; OptionValues options = getResult().getLIR().getOptions(); if (encoding.hasBase() || GeneratePIC.getValue(options)) { if (GeneratePIC.getValue(options)) { ! Variable baseAddress = newVariable(lirKindTool.getWordKind()); AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config); append(move); base = baseAddress; } else { ! base = emitLoadConstant(lirKindTool.getWordKind(), JavaConstant.forLong(encoding.getBase())); } } ! append(new AMD64Move.CompressPointer(result, asAllocatable(pointer), base, encoding, nonNull, getLIRKindTool())); return result; } } @Override public Value emitUncompress(Value pointer, CompressEncoding encoding, boolean nonNull) { LIRKind inputKind = pointer.getValueKind(LIRKind.class); ! LIRKindTool lirKindTool = getLIRKindTool(); ! assert inputKind.getPlatformKind() == lirKindTool.getNarrowOopKind().getPlatformKind(); if (inputKind.isReference(0)) { // oop ! Variable result = newVariable(lirKindTool.getObjectKind()); ! append(new AMD64Move.UncompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull, lirKindTool)); return result; } else { // metaspace pointer ! LIRKind uncompressedKind = lirKindTool.getWordKind(); ! Variable result = newVariable(uncompressedKind); AllocatableValue base = Value.ILLEGAL; OptionValues options = getResult().getLIR().getOptions(); if (encoding.hasBase() || GeneratePIC.getValue(options)) { if (GeneratePIC.getValue(options)) { ! Variable baseAddress = newVariable(uncompressedKind); AMD64HotSpotMove.BaseMove move = new AMD64HotSpotMove.BaseMove(baseAddress, config); append(move); base = baseAddress; } else { ! base = emitLoadConstant(uncompressedKind, JavaConstant.forLong(encoding.getBase())); } } ! append(new AMD64Move.UncompressPointer(result, asAllocatable(pointer), base, encoding, nonNull, lirKindTool)); return result; } } @Override public void emitNullCheck(Value address, LIRFrameState state) { ! if (address.getValueKind().getPlatformKind() == getLIRKindTool().getNarrowOopKind().getPlatformKind()) { CompressEncoding encoding = config.getOopEncoding(); Value uncompressed; if (encoding.getShift() <= 3) { LIRKind wordKind = LIRKind.unknownReference(target().arch.getWordKind()); uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.getShift()), 0); } else { uncompressed = emitUncompress(address, encoding, false); } append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state)); ! return; } + super.emitNullCheck(address, state); } @Override public LIRInstruction createBenchmarkCounter(String name, String group, Value increment) { if (BenchmarkCounters.enabled) {
< prev index next >