001/* 002 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.hotspot; 024 025import jdk.internal.jvmci.meta.*; 026 027import com.oracle.graal.compiler.common.spi.*; 028import com.oracle.graal.compiler.target.*; 029import com.oracle.graal.hotspot.stubs.*; 030 031/** 032 * The details required to link a HotSpot runtime or stub call. 033 */ 034public interface HotSpotForeignCallLinkage extends ForeignCallLinkage, InvokeTarget { 035 036 /** 037 * Constants for specifying whether a foreign call destroys or preserves registers. A foreign 038 * call will always destroy {@link HotSpotForeignCallLinkage#getOutgoingCallingConvention() its} 039 * {@linkplain ForeignCallLinkage#getTemporaries() temporary} registers. 040 */ 041 public enum RegisterEffect { 042 DESTROYS_REGISTERS, 043 PRESERVES_REGISTERS 044 } 045 046 /** 047 * Constants for specifying whether a call is a leaf or not and whether a 048 * {@code JavaFrameAnchor} prologue and epilogue is required around the call. A leaf function 049 * does not lock, GC or throw exceptions. 050 */ 051 public enum Transition { 052 /** 053 * A call to a leaf function that is guaranteed to not use floating point registers and will 054 * never have its caller stack inspected by the VM. That is, {@code JavaFrameAnchor} 055 * management around the call can be omitted. 056 */ 057 LEAF_NOFP, 058 059 /** 060 * A call to a leaf function that might use floating point registers but will never have its 061 * caller stack inspected. That is, {@code JavaFrameAnchor} management around the call can 062 * be omitted. 063 */ 064 LEAF, 065 066 /** 067 * A call to a leaf function that might use floating point registers and may have its caller 068 * stack inspected. That is, {@code JavaFrameAnchor} management code around the call is 069 * required. 070 */ 071 STACK_INSPECTABLE_LEAF, 072 073 /** 074 * A function that may lock, GC or raise an exception and thus requires debug info to be 075 * associated with a call site to the function. The execution stack may be inspected while 076 * in the called function. That is, {@code JavaFrameAnchor} management code around the call 077 * is required. 078 */ 079 NOT_LEAF; 080 } 081 082 /** 083 * Sentinel marker for a computed jump address. 084 */ 085 long JUMP_ADDRESS = 0xDEADDEADBEEFBEEFL; 086 087 boolean isReexecutable(); 088 089 LocationIdentity[] getKilledLocations(); 090 091 void setCompiledStub(Stub stub); 092 093 /** 094 * Determines if this is a call to a compiled {@linkplain Stub stub}. 095 */ 096 boolean isCompiledStub(); 097 098 void finalizeAddress(Backend backend); 099 100 long getAddress(); 101 102 /** 103 * Determines if the runtime function or stub might use floating point registers. If the answer 104 * is no, then no FPU state management prologue or epilogue needs to be emitted around the call. 105 */ 106 boolean mayContainFP(); 107 108 /** 109 * Determines if a {@code JavaFrameAnchor} needs to be set up and torn down around this call. 110 */ 111 boolean needsJavaFrameAnchor(); 112 113 /** 114 * Gets the VM symbol associated with the target {@linkplain #getAddress() address} of the call. 115 */ 116 String getSymbol(); 117}