1 /* 2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.hotspot; 24 25 import org.graalvm.compiler.core.common.CompilationIdentifier; 26 import org.graalvm.compiler.hotspot.stubs.Stub; 27 import org.graalvm.compiler.lir.LIR; 28 import org.graalvm.compiler.lir.LIRFrameState; 29 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp; 30 import org.graalvm.compiler.lir.framemap.FrameMapBuilder; 31 import org.graalvm.compiler.lir.gen.LIRGenerationResult; 32 import org.graalvm.util.Equivalence; 33 import org.graalvm.util.EconomicMap; 34 35 import jdk.vm.ci.code.CallingConvention; 36 import jdk.vm.ci.code.StackSlot; 37 38 public class HotSpotLIRGenerationResult extends LIRGenerationResult { 39 40 /** 41 * The slot reserved for storing the original return address when a frame is marked for 42 * deoptimization. The return address slot in the callee is overwritten with the address of a 43 * deoptimization stub. 44 */ 45 private StackSlot deoptimizationRescueSlot; 46 protected final Object stub; 47 48 private int maxInterpreterFrameSize; 49 50 /** 51 * Map from debug infos that need to be updated with callee save information to the operations 52 * that provide the information. 53 */ 54 private EconomicMap<LIRFrameState, SaveRegistersOp> calleeSaveInfo = EconomicMap.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE); 55 56 public HotSpotLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention, Object stub) { 57 super(compilationId, lir, frameMapBuilder, callingConvention); 58 this.stub = stub; 59 } 60 61 public EconomicMap<LIRFrameState, SaveRegistersOp> getCalleeSaveInfo() { 62 return calleeSaveInfo; 63 } 64 65 public Stub getStub() { 66 return (Stub) stub; 67 } 68 69 public StackSlot getDeoptimizationRescueSlot() { 70 return deoptimizationRescueSlot; 71 } 72 73 public final void setDeoptimizationRescueSlot(StackSlot stackSlot) { 74 this.deoptimizationRescueSlot = stackSlot; 75 } 76 77 public void setMaxInterpreterFrameSize(int maxInterpreterFrameSize) { 78 this.maxInterpreterFrameSize = maxInterpreterFrameSize; 79 } 80 81 public int getMaxInterpreterFrameSize() { 82 return maxInterpreterFrameSize; 83 } 84 }