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 java.util.Map; 26 27 import org.graalvm.compiler.core.common.CollectionsFactory; 28 import org.graalvm.compiler.core.common.CompilationIdentifier; 29 import org.graalvm.compiler.hotspot.stubs.Stub; 30 import org.graalvm.compiler.lir.LIR; 31 import org.graalvm.compiler.lir.LIRFrameState; 32 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp; 33 import org.graalvm.compiler.lir.framemap.FrameMapBuilder; 34 import org.graalvm.compiler.lir.gen.LIRGenerationResult; 35 36 import jdk.vm.ci.code.CallingConvention; 37 import jdk.vm.ci.code.StackSlot; 38 39 public class HotSpotLIRGenerationResult extends LIRGenerationResult { 40 41 /** 42 * The slot reserved for storing the original return address when a frame is marked for 43 * deoptimization. The return address slot in the callee is overwritten with the address of a 44 * deoptimization stub. 45 */ 46 private StackSlot deoptimizationRescueSlot; 47 protected final Object stub; 48 49 private int maxInterpreterFrameSize; 50 51 /** 52 * Map from debug infos that need to be updated with callee save information to the operations 53 * that provide the information. 54 */ 55 private Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = CollectionsFactory.newMap(); 56 57 public HotSpotLIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention, Object stub) { 58 super(compilationId, lir, frameMapBuilder, callingConvention); 59 this.stub = stub; 60 } 61 62 public Map<LIRFrameState, SaveRegistersOp> getCalleeSaveInfo() { 63 return calleeSaveInfo; 64 } 65 66 public Stub getStub() { 67 return (Stub) stub; 68 } 69 70 public StackSlot getDeoptimizationRescueSlot() { 71 return deoptimizationRescueSlot; 72 } 73 74 public final void setDeoptimizationRescueSlot(StackSlot stackSlot) { 75 this.deoptimizationRescueSlot = stackSlot; 76 } 77 78 public void setMaxInterpreterFrameSize(int maxInterpreterFrameSize) { 79 this.maxInterpreterFrameSize = maxInterpreterFrameSize; 80 } 81 82 public int getMaxInterpreterFrameSize() { 83 return maxInterpreterFrameSize; 84 } 85 }