< prev index next >

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

Print this page
rev 52509 : [mq]: graal

@@ -107,40 +107,70 @@
      * @param reexecutability specifies if the stub call can be re-executed without (meaningful)
      *            side effects. Deoptimization will not return to a point before a stub call that
      *            cannot be re-executed.
      * @param killedLocations the memory locations killed by the stub call
      */
-    public HotSpotForeignCallLinkage registerStubCall(ForeignCallDescriptor descriptor, Transition transition, Reexecutability reexecutability,
+    public HotSpotForeignCallLinkage registerStubCall(
+                    ForeignCallDescriptor descriptor,
+                    Transition transition,
+                    Reexecutability reexecutability,
                     LocationIdentity... killedLocations) {
-        return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, wordTypes, this, descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutability,
+        return register(HotSpotForeignCallLinkageImpl.create(metaAccess,
+                        codeCache,
+                        wordTypes,
+                        this,
+                        descriptor,
+                        0L, PRESERVES_REGISTERS,
+                        JavaCall,
+                        JavaCallee,
+                        transition,
+                        reexecutability,
                         killedLocations));
     }
 
     /**
      * Creates and registers the linkage for a foreign call.
      *
      * @param descriptor the signature of the foreign call
-     * @param address the address of the code to call
+     * @param address the address of the code to call (must be non-zero)
      * @param outgoingCcType outgoing (caller) calling convention type
      * @param effect specifies if the call destroys or preserves all registers (apart from
      *            temporaries which are always destroyed)
      * @param transition specifies if this is a {@linkplain Transition#LEAF leaf} call
      * @param reexecutability specifies if the foreign call can be re-executed without (meaningful)
      *            side effects. Deoptimization will not return to a point before a foreign call that
      *            cannot be re-executed.
      * @param killedLocations the memory locations killed by the foreign call
      */
-    public HotSpotForeignCallLinkage registerForeignCall(ForeignCallDescriptor descriptor, long address, CallingConvention.Type outgoingCcType, RegisterEffect effect, Transition transition,
-                    Reexecutability reexecutability, LocationIdentity... killedLocations) {
+    public HotSpotForeignCallLinkage registerForeignCall(
+                    ForeignCallDescriptor descriptor,
+                    long address,
+                    CallingConvention.Type outgoingCcType,
+                    RegisterEffect effect,
+                    Transition transition,
+                    Reexecutability reexecutability,
+                    LocationIdentity... killedLocations) {
         Class<?> resultType = descriptor.getResultType();
-        assert address != 0;
+        assert address != 0 : descriptor;
         assert transition != SAFEPOINT || resultType.isPrimitive() || Word.class.isAssignableFrom(resultType) : "non-leaf foreign calls must return objects in thread local storage: " + descriptor;
-        return register(HotSpotForeignCallLinkageImpl.create(metaAccess, codeCache, wordTypes, this, descriptor, address, effect, outgoingCcType, null, transition, reexecutability, killedLocations));
+        return register(HotSpotForeignCallLinkageImpl.create(metaAccess,
+                        codeCache,
+                        wordTypes,
+                        this,
+                        descriptor,
+                        address,
+                        effect,
+                        outgoingCcType,
+                        null, // incomingCcType
+                        transition,
+                        reexecutability,
+                        killedLocations));
     }
 
     /**
-     * Creates a {@linkplain ForeignCallStub stub} for a foreign call.
+     * Creates a {@linkplain ForeignCallStub stub} for the foreign call described by
+     * {@code descriptor} if {@code address != 0}.
      *
      * @param descriptor the signature of the call to the stub
      * @param address the address of the foreign code to call
      * @param prependThread true if the JavaThread value for the current thread is to be prepended
      *            to the arguments for the call to {@code address}

@@ -148,19 +178,27 @@
      * @param reexecutability specifies if the foreign call can be re-executed without (meaningful)
      *            side effects. Deoptimization will not return to a point before a foreign call that
      *            cannot be re-executed.
      * @param killedLocations the memory locations killed by the foreign call
      */
-    public void linkForeignCall(OptionValues options, HotSpotProviders providers, ForeignCallDescriptor descriptor, long address, boolean prependThread, Transition transition,
-                    Reexecutability reexecutability, LocationIdentity... killedLocations) {
+    public void linkForeignCall(OptionValues options,
+                    HotSpotProviders providers,
+                    ForeignCallDescriptor descriptor,
+                    long address,
+                    boolean prependThread,
+                    Transition transition,
+                    Reexecutability reexecutability,
+                    LocationIdentity... killedLocations) {
+        if (address != 0) {
         ForeignCallStub stub = new ForeignCallStub(options, jvmciRuntime, providers, address, descriptor, prependThread, transition, reexecutability, killedLocations);
         HotSpotForeignCallLinkage linkage = stub.getLinkage();
         HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage();
         linkage.setCompiledStub(stub);
         register(linkage);
         register(targetLinkage);
     }
+    }
 
     public static final boolean PREPEND_THREAD = true;
     public static final boolean DONT_PREPEND_THREAD = !PREPEND_THREAD;
 
     public static final LocationIdentity[] NO_LOCATIONS = {};
< prev index next >