changeset 16704:3cd605c98060

NFI: cleanup
author Matthias Grimmer <grimmer@ssw.jku.at>
date Wed, 06 Aug 2014 08:27:42 +0200
parents fc9d2d081995
children 13f8c249edb8
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java src/share/vm/prims/nativeLookup.cpp
diffstat 3 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Aug 05 16:35:28 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Wed Aug 06 08:27:42 2014 +0200
@@ -322,7 +322,9 @@
         }
     }
 
-    // used by native code, don't remove!
+    /**
+     * Called from the VM.
+     */
     public static NativeFunctionInterface createNativeFunctionInterface() {
         HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig();
         RawNativeCallNodeFactory factory = new RawNativeCallNodeFactory() {
--- a/graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java	Tue Aug 05 16:35:28 2014 -0700
+++ b/graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java	Wed Aug 06 08:27:42 2014 +0200
@@ -24,9 +24,19 @@
 
 import com.oracle.nfi.api.*;
 
+/**
+ * Class for obtaining the Native Function Interface runtime singleton object of this virtual
+ * machine.
+ */
 public final class NativeFunctionInterfaceRuntime {
     private static final NativeFunctionInterface INTERFACE;
 
+    /**
+     * Creates a new {@link NativeFunctionInterface} instance if running on top of Graal.
+     *
+     * @throws UnsatisfiedLinkError if not running on top of Graal and initialize the
+     *             {@link NativeFunctionInterface} instance with <code>null</code>.
+     */
     private static native NativeFunctionInterface createInterface();
 
     public static NativeFunctionInterface getNativeFunctionInterface() {
@@ -38,8 +48,6 @@
         try {
             instance = createInterface();
         } catch (UnsatisfiedLinkError e) {
-            System.err.println("Graal Native Function Interface not supported!");
-            e.printStackTrace();
             instance = null;
         }
         INTERFACE = instance;
--- a/src/share/vm/prims/nativeLookup.cpp	Tue Aug 05 16:35:28 2014 -0700
+++ b/src/share/vm/prims/nativeLookup.cpp	Wed Aug 06 08:27:42 2014 +0200
@@ -145,12 +145,12 @@
   { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         },
   { CC"Java_sun_hotspot_WhiteBox_registerNatives",                 NULL, FN_PTR(JVM_RegisterWhiteBoxMethods)     },
 #ifdef GRAAL
-  { CC"Java_com_oracle_graal_api_runtime_Graal_initializeRuntime",                                        NULL, FN_PTR(JVM_GetGraalRuntime)                           },
-  { CC"Java_com_oracle_graal_api_runtime_Services_getServiceImpls",                                       NULL, FN_PTR(JVM_GetGraalServiceImpls)                      },
-  { CC"Java_com_oracle_truffle_api_Truffle_createRuntime",                                                NULL, FN_PTR(JVM_CreateTruffleRuntime)                      },
-  { CC"Java_com_oracle_nfi_NativeFunctionInterfaceRuntime_createInterface",                        NULL, FN_PTR(JVM_CreateNativeFunctionInterface)      },
-  { CC"Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_init",                                       NULL, FN_PTR(JVM_InitializeGraalNatives)                    },
-  { CC"Java_com_oracle_graal_hotspot_HotSpotOptions_parseVMOptions",                                      NULL, FN_PTR(JVM_ParseGraalOptions)                         },
+  { CC"Java_com_oracle_graal_api_runtime_Graal_initializeRuntime",                                        NULL, FN_PTR(JVM_GetGraalRuntime)                    },
+  { CC"Java_com_oracle_graal_api_runtime_Services_getServiceImpls",                                       NULL, FN_PTR(JVM_GetGraalServiceImpls)               },
+  { CC"Java_com_oracle_truffle_api_Truffle_createRuntime",                                                NULL, FN_PTR(JVM_CreateTruffleRuntime)               },
+  { CC"Java_com_oracle_nfi_NativeFunctionInterfaceRuntime_createInterface",                               NULL, FN_PTR(JVM_CreateNativeFunctionInterface)      },
+  { CC"Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_init",                                       NULL, FN_PTR(JVM_InitializeGraalNatives)             },
+  { CC"Java_com_oracle_graal_hotspot_HotSpotOptions_parseVMOptions",                                      NULL, FN_PTR(JVM_ParseGraalOptions)                  },
 #endif
 };