< prev index next >

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

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2012, 2018, 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 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import jdk.vm.ci.meta.InvokeTarget;
  28 
  29 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
  30 import org.graalvm.compiler.core.target.Backend;
  31 import org.graalvm.compiler.hotspot.stubs.Stub;
  32 import jdk.internal.vm.compiler.word.LocationIdentity;
  33 


  34 /**
  35  * The details required to link a HotSpot runtime or stub call.
  36  */
  37 public interface HotSpotForeignCallLinkage extends ForeignCallLinkage, InvokeTarget {
  38 
  39     /**
  40      * Constants for specifying whether a foreign call destroys or preserves registers. A foreign
  41      * call will always destroy {@link HotSpotForeignCallLinkage#getOutgoingCallingConvention() its}
  42      * {@linkplain ForeignCallLinkage#getTemporaries() temporary} registers.
  43      */
  44     enum RegisterEffect {
  45         DESTROYS_REGISTERS,
  46         PRESERVES_REGISTERS
  47     }
  48 
  49     /**
  50      * Constants for specifying whether a call is a leaf or not and whether a
  51      * {@code JavaFrameAnchor} prologue and epilogue is required around the call. A leaf function
  52      * does not lock, GC or throw exceptions.
  53      */
  54     enum Transition {
  55         /**
  56          * A call to a leaf function that is guaranteed to not use floating point registers.
  57          * Consequently, floating point registers cleanup will be waived. On AMD64, this means the
  58          * compiler will no longer emit vzeroupper instruction around the foreign call, which it
  59          * normally does for unknown foreign calls to avoid potential SSE-AVX transition penalty.
  60          * Besides, this foreign call will never have its caller stack inspected by the VM. That is,
  61          * {@code JavaFrameAnchor} management around the call can be omitted.
  62          */
  63         LEAF_NO_VZERO,
  64 
  65         /**
  66          * A call to a leaf function that might use floating point registers but will never have its


 100          * Denotes a call that can always be re-executed. If an exception is raised by the call it
 101          * may be cleared, compiled code deoptimized and reexecuted. Since the call has no side
 102          * effects it is assumed that the same exception will be thrown.
 103          */
 104         REEXECUTABLE
 105     }
 106 
 107     /**
 108      * Sentinel marker for a computed jump address.
 109      */
 110     long JUMP_ADDRESS = 0xDEADDEADBEEFBEEFL;
 111 
 112     /**
 113      * Determines if the call has side effects.
 114      */
 115     boolean isReexecutable();
 116 
 117     LocationIdentity[] getKilledLocations();
 118 
 119     void setCompiledStub(Stub stub);


 120 
 121     /**
 122      * Determines if this is a call to a compiled {@linkplain Stub stub}.
 123      */
 124     boolean isCompiledStub();
 125 
 126     /**
 127      * Gets the stub, if any, this foreign call links to.
 128      */
 129     Stub getStub();
 130 
 131     void finalizeAddress(Backend backend);
 132 
 133     long getAddress();
 134 
 135     /**
 136      * Determines if the runtime function or stub might use floating point registers. If the answer
 137      * is no, then no FPU state management prologue or epilogue needs to be emitted around the call.
 138      */
 139     boolean mayContainFP();
   1 /*
   2  * Copyright (c) 2012, 2019, 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 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 


  27 import org.graalvm.compiler.core.common.spi.ForeignCallLinkage;
  28 import org.graalvm.compiler.core.target.Backend;
  29 import org.graalvm.compiler.hotspot.stubs.Stub;
  30 import jdk.internal.vm.compiler.word.LocationIdentity;
  31 
  32 import jdk.vm.ci.meta.InvokeTarget;
  33 
  34 /**
  35  * The details required to link a HotSpot runtime or stub call.
  36  */
  37 public interface HotSpotForeignCallLinkage extends ForeignCallLinkage, InvokeTarget {
  38 
  39     /**
  40      * Constants for specifying whether a foreign call destroys or preserves registers. A foreign
  41      * call will always destroy {@link HotSpotForeignCallLinkage#getOutgoingCallingConvention() its}
  42      * {@linkplain ForeignCallLinkage#getTemporaries() temporary} registers.
  43      */
  44     enum RegisterEffect {
  45         DESTROYS_ALL_CALLER_SAVE_REGISTERS,
  46         COMPUTES_REGISTERS_KILLED
  47     }
  48 
  49     /**
  50      * Constants for specifying whether a call is a leaf or not and whether a
  51      * {@code JavaFrameAnchor} prologue and epilogue is required around the call. A leaf function
  52      * does not lock, GC or throw exceptions.
  53      */
  54     enum Transition {
  55         /**
  56          * A call to a leaf function that is guaranteed to not use floating point registers.
  57          * Consequently, floating point registers cleanup will be waived. On AMD64, this means the
  58          * compiler will no longer emit vzeroupper instruction around the foreign call, which it
  59          * normally does for unknown foreign calls to avoid potential SSE-AVX transition penalty.
  60          * Besides, this foreign call will never have its caller stack inspected by the VM. That is,
  61          * {@code JavaFrameAnchor} management around the call can be omitted.
  62          */
  63         LEAF_NO_VZERO,
  64 
  65         /**
  66          * A call to a leaf function that might use floating point registers but will never have its


 100          * Denotes a call that can always be re-executed. If an exception is raised by the call it
 101          * may be cleared, compiled code deoptimized and reexecuted. Since the call has no side
 102          * effects it is assumed that the same exception will be thrown.
 103          */
 104         REEXECUTABLE
 105     }
 106 
 107     /**
 108      * Sentinel marker for a computed jump address.
 109      */
 110     long JUMP_ADDRESS = 0xDEADDEADBEEFBEEFL;
 111 
 112     /**
 113      * Determines if the call has side effects.
 114      */
 115     boolean isReexecutable();
 116 
 117     LocationIdentity[] getKilledLocations();
 118 
 119     void setCompiledStub(Stub stub);
 120 
 121     RegisterEffect getEffect();
 122 
 123     /**
 124      * Determines if this is a call to a compiled {@linkplain Stub stub}.
 125      */
 126     boolean isCompiledStub();
 127 
 128     /**
 129      * Gets the stub, if any, this foreign call links to.
 130      */
 131     Stub getStub();
 132 
 133     void finalizeAddress(Backend backend);
 134 
 135     long getAddress();
 136 
 137     /**
 138      * Determines if the runtime function or stub might use floating point registers. If the answer
 139      * is no, then no FPU state management prologue or epilogue needs to be emitted around the call.
 140      */
 141     boolean mayContainFP();
< prev index next >