# HG changeset patch # User Josef Eisl # Date 1395083145 -3600 # Node ID c3242028cc44bc7242bae1b51edd31b6b42efbd5 # Parent a8723f1ff54291001b8e11bd71420755ee18d3cc Introduce specialized LIRGenerationResults for Targets if needed. diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerationResult.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerationResult.java Mon Mar 17 19:18:35 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerationResult.java Mon Mar 17 20:05:45 2014 +0100 @@ -28,4 +28,6 @@ FrameMap getFrameMap(); LIR getLIR(); + + boolean hasForeignCall(); } diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 17 19:18:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Mar 17 20:05:45 2014 +0100 @@ -199,10 +199,10 @@ // - has no incoming arguments passed on the stack // - has no deoptimization points // - makes no foreign calls (which require an aligned stack) - AMD64HotSpotLIRGenerator gen = (AMD64HotSpotLIRGenerator) lirGen; + AMD64HotSpotLIRGenerationResult gen = (AMD64HotSpotLIRGenerationResult) lirGen; FrameMap frameMap = gen.getFrameMap(); LIR lir = gen.getLIR(); - assert gen.deoptimizationRescueSlot == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; + assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; boolean omitFrame = CanOmitFrame.getValue() && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame() && !gen.hasForeignCall(); Stub stub = gen.getStub(); @@ -210,14 +210,14 @@ HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null, omitFrame); CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult); crb.setFrameSize(frameMap.frameSize()); - StackSlot deoptimizationRescueSlot = gen.deoptimizationRescueSlot; + StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) { crb.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot)); } if (stub != null) { Set definedRegisters = gatherDefinedRegisters(lir); - updateStub(stub, definedRegisters, gen.calleeSaveInfo, frameMap); + updateStub(stub, definedRegisters, gen.getCalleeSaveInfo(), frameMap); } return crb; diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java Mon Mar 17 20:05:45 2014 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.amd64; + +import java.util.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.hotspot.stubs.*; +import com.oracle.graal.lir.*; +import com.oracle.graal.lir.StandardOp.SaveRegistersOp; + +public interface AMD64HotSpotLIRGenerationResult extends LIRGenerationResult { + + StackSlot getDeoptimizationRescueSlot(); + + Stub getStub(); + + Map getCalleeSaveInfo(); + +} diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Mon Mar 17 19:18:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java Mon Mar 17 20:05:45 2014 +0100 @@ -67,7 +67,7 @@ /** * LIR generator specialized for AMD64 HotSpot. */ -public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator { +public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator, AMD64HotSpotLIRGenerationResult { private final HotSpotVMConfig config; @@ -90,7 +90,7 @@ * deoptimization. The return address slot in the callee is overwritten with the address of a * deoptimization stub. */ - StackSlot deoptimizationRescueSlot; + private StackSlot deoptimizationRescueSlot; /** * Utility for emitting the instruction to save RBP. @@ -214,7 +214,7 @@ * Map from debug infos that need to be updated with callee save information to the operations * that provide the information. */ - Map calleeSaveInfo = new HashMap<>(); + private Map calleeSaveInfo = new HashMap<>(); private LIRFrameState currentRuntimeCallInfo; @@ -234,7 +234,7 @@ append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save)); } - Stub getStub() { + public Stub getStub() { return (Stub) stub; } @@ -596,4 +596,13 @@ AMD64AddressValue addr = emitAddress(operand(address), 0, loadNonConst(operand(distance)), 1); append(new AMD64PrefetchOp(addr, config.allocatePrefetchInstr)); } + + public StackSlot getDeoptimizationRescueSlot() { + return deoptimizationRescueSlot; + } + + public Map getCalleeSaveInfo() { + return calleeSaveInfo; + } + } diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Mar 17 19:18:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Mar 17 20:05:45 2014 +0100 @@ -160,9 +160,9 @@ @Override public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGen, CompilationResult compilationResult, CompilationResultBuilderFactory factory) { - SPARCHotSpotLIRGenerator gen = (SPARCHotSpotLIRGenerator) lirGen; + SPARCHotSpotLIRGenerationResult gen = (SPARCHotSpotLIRGenerationResult) lirGen; FrameMap frameMap = gen.getFrameMap(); - assert gen.deoptimizationRescueSlot == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; + assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; Stub stub = gen.getStub(); Assembler masm = createAssembler(frameMap); @@ -170,7 +170,7 @@ HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, frameContext, compilationResult); crb.setFrameSize(frameMap.frameSize()); - StackSlot deoptimizationRescueSlot = gen.deoptimizationRescueSlot; + StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) { crb.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot)); } diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java Mon Mar 17 20:05:45 2014 +0100 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.sparc; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.hotspot.stubs.*; + +public interface SPARCHotSpotLIRGenerationResult extends LIRGenerationResult { + + StackSlot getDeoptimizationRescueSlot(); + + Stub getStub(); + +} diff -r a8723f1ff542 -r c3242028cc44 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Mon Mar 17 19:18:35 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java Mon Mar 17 20:05:45 2014 +0100 @@ -48,7 +48,7 @@ import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; -public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator { +public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator, SPARCHotSpotLIRGenerationResult { private final HotSpotVMConfig config; private final Object stub; @@ -69,7 +69,7 @@ * deoptimization. The return address slot in the callee is overwritten with the address of a * deoptimization stub. */ - StackSlot deoptimizationRescueSlot; + private StackSlot deoptimizationRescueSlot; @Override protected DebugInfoBuilder createDebugInfoBuilder(NodeMap nodeOperands) { @@ -88,7 +88,7 @@ return stub != null; } - Stub getStub() { + public Stub getStub() { return (Stub) stub; } @@ -324,4 +324,8 @@ SPARCAddressValue addr = emitAddress(operand(address), 0, loadNonConst(operand(distance)), 1); append(new SPARCPrefetchOp(addr, config.allocatePrefetchInstr)); } + + public StackSlot getDeoptimizationRescueSlot() { + return deoptimizationRescueSlot; + } }