< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotForeignCallLinkageImpl.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 static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  28 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_REGISTERS;
  29 
  30 import jdk.internal.vm.compiler.collections.EconomicSet;
  31 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  32 import org.graalvm.compiler.core.target.Backend;
  33 import org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider;
  34 import org.graalvm.compiler.hotspot.stubs.Stub;
  35 import org.graalvm.compiler.word.WordTypes;
  36 import jdk.internal.vm.compiler.word.LocationIdentity;
  37 
  38 import jdk.vm.ci.code.CallingConvention;
  39 import jdk.vm.ci.code.CallingConvention.Type;
  40 import jdk.vm.ci.code.CodeCacheProvider;
  41 import jdk.vm.ci.code.InstalledCode;
  42 import jdk.vm.ci.code.Register;
  43 import jdk.vm.ci.code.RegisterConfig;
  44 import jdk.vm.ci.code.ValueKindFactory;
  45 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
  46 import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
  47 import jdk.vm.ci.meta.AllocatableValue;
  48 import jdk.vm.ci.meta.JavaType;


 167             String sep = "";
 168             for (Value op : temporaries) {
 169                 sb.append(sep).append(op);
 170                 sep = ",";
 171             }
 172         }
 173         return sb.toString();
 174     }
 175 
 176     @Override
 177     public boolean isReexecutable() {
 178         return reexecutability == Reexecutability.REEXECUTABLE;
 179     }
 180 
 181     @Override
 182     public boolean isGuaranteedSafepoint() {
 183         return transition == Transition.SAFEPOINT;
 184     }
 185 
 186     @Override





 187     public LocationIdentity[] getKilledLocations() {
 188         return killedLocations;
 189     }
 190 
 191     @Override
 192     public CallingConvention getOutgoingCallingConvention() {
 193         return outgoingCallingConvention;
 194     }
 195 
 196     @Override
 197     public CallingConvention getIncomingCallingConvention() {
 198         return incomingCallingConvention;
 199     }
 200 
 201     @Override
 202     public Value[] getTemporaries() {
 203         if (temporaries.length == 0) {
 204             return temporaries;
 205         }
 206         return temporaries.clone();


 251             if (!destroyedRegisters.isEmpty()) {
 252                 AllocatableValue[] temporaryLocations = new AllocatableValue[destroyedRegisters.size()];
 253                 int i = 0;
 254                 for (Register reg : destroyedRegisters) {
 255                     temporaryLocations[i++] = reg.asValue();
 256                 }
 257                 temporaries = temporaryLocations;
 258             }
 259             address = code.getStart();
 260         }
 261     }
 262 
 263     @Override
 264     public long getAddress() {
 265         assert address != 0L : "address not yet finalized: " + this;
 266         return address;
 267     }
 268 
 269     @Override
 270     public boolean destroysRegisters() {
 271         return effect == DESTROYS_REGISTERS;
 272     }
 273 
 274     @Override
 275     public boolean needsDebugInfo() {
 276         return transition == Transition.SAFEPOINT;
 277     }
 278 
 279     @Override
 280     public boolean mayContainFP() {
 281         return transition != Transition.LEAF_NO_VZERO;
 282     }
 283 
 284     @Override
 285     public boolean needsJavaFrameAnchor() {
 286         if (transition == Transition.SAFEPOINT || transition == Transition.STACK_INSPECTABLE_LEAF) {
 287             if (stub != null) {
 288                 // The stub will do the JavaFrameAnchor management
 289                 // around the runtime call(s) it makes
 290                 return false;
 291             } else {
   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 static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  28 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.DESTROYS_ALL_CALLER_SAVE_REGISTERS;
  29 
  30 import jdk.internal.vm.compiler.collections.EconomicSet;
  31 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  32 import org.graalvm.compiler.core.target.Backend;
  33 import org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider;
  34 import org.graalvm.compiler.hotspot.stubs.Stub;
  35 import org.graalvm.compiler.word.WordTypes;
  36 import jdk.internal.vm.compiler.word.LocationIdentity;
  37 
  38 import jdk.vm.ci.code.CallingConvention;
  39 import jdk.vm.ci.code.CallingConvention.Type;
  40 import jdk.vm.ci.code.CodeCacheProvider;
  41 import jdk.vm.ci.code.InstalledCode;
  42 import jdk.vm.ci.code.Register;
  43 import jdk.vm.ci.code.RegisterConfig;
  44 import jdk.vm.ci.code.ValueKindFactory;
  45 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
  46 import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
  47 import jdk.vm.ci.meta.AllocatableValue;
  48 import jdk.vm.ci.meta.JavaType;


 167             String sep = "";
 168             for (Value op : temporaries) {
 169                 sb.append(sep).append(op);
 170                 sep = ",";
 171             }
 172         }
 173         return sb.toString();
 174     }
 175 
 176     @Override
 177     public boolean isReexecutable() {
 178         return reexecutability == Reexecutability.REEXECUTABLE;
 179     }
 180 
 181     @Override
 182     public boolean isGuaranteedSafepoint() {
 183         return transition == Transition.SAFEPOINT;
 184     }
 185 
 186     @Override
 187     public RegisterEffect getEffect() {
 188         return effect;
 189     }
 190 
 191     @Override
 192     public LocationIdentity[] getKilledLocations() {
 193         return killedLocations;
 194     }
 195 
 196     @Override
 197     public CallingConvention getOutgoingCallingConvention() {
 198         return outgoingCallingConvention;
 199     }
 200 
 201     @Override
 202     public CallingConvention getIncomingCallingConvention() {
 203         return incomingCallingConvention;
 204     }
 205 
 206     @Override
 207     public Value[] getTemporaries() {
 208         if (temporaries.length == 0) {
 209             return temporaries;
 210         }
 211         return temporaries.clone();


 256             if (!destroyedRegisters.isEmpty()) {
 257                 AllocatableValue[] temporaryLocations = new AllocatableValue[destroyedRegisters.size()];
 258                 int i = 0;
 259                 for (Register reg : destroyedRegisters) {
 260                     temporaryLocations[i++] = reg.asValue();
 261                 }
 262                 temporaries = temporaryLocations;
 263             }
 264             address = code.getStart();
 265         }
 266     }
 267 
 268     @Override
 269     public long getAddress() {
 270         assert address != 0L : "address not yet finalized: " + this;
 271         return address;
 272     }
 273 
 274     @Override
 275     public boolean destroysRegisters() {
 276         return effect == DESTROYS_ALL_CALLER_SAVE_REGISTERS;
 277     }
 278 
 279     @Override
 280     public boolean needsDebugInfo() {
 281         return transition == Transition.SAFEPOINT;
 282     }
 283 
 284     @Override
 285     public boolean mayContainFP() {
 286         return transition != Transition.LEAF_NO_VZERO;
 287     }
 288 
 289     @Override
 290     public boolean needsJavaFrameAnchor() {
 291         if (transition == Transition.SAFEPOINT || transition == Transition.STACK_INSPECTABLE_LEAF) {
 292             if (stub != null) {
 293                 // The stub will do the JavaFrameAnchor management
 294                 // around the runtime call(s) it makes
 295                 return false;
 296             } else {
< prev index next >