comparison graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java @ 16704:3cd605c98060

NFI: cleanup
author Matthias Grimmer <grimmer@ssw.jku.at>
date Wed, 06 Aug 2014 08:27:42 +0200
parents dd8449afc086
children 13f8c249edb8
comparison
equal deleted inserted replaced
16703:fc9d2d081995 16704:3cd605c98060
22 */ 22 */
23 package com.oracle.nfi; 23 package com.oracle.nfi;
24 24
25 import com.oracle.nfi.api.*; 25 import com.oracle.nfi.api.*;
26 26
27 /**
28 * Class for obtaining the Native Function Interface runtime singleton object of this virtual
29 * machine.
30 */
27 public final class NativeFunctionInterfaceRuntime { 31 public final class NativeFunctionInterfaceRuntime {
28 private static final NativeFunctionInterface INTERFACE; 32 private static final NativeFunctionInterface INTERFACE;
29 33
34 /**
35 * Creates a new {@link NativeFunctionInterface} instance if running on top of Graal.
36 *
37 * @throws UnsatisfiedLinkError if not running on top of Graal and initialize the
38 * {@link NativeFunctionInterface} instance with <code>null</code>.
39 */
30 private static native NativeFunctionInterface createInterface(); 40 private static native NativeFunctionInterface createInterface();
31 41
32 public static NativeFunctionInterface getNativeFunctionInterface() { 42 public static NativeFunctionInterface getNativeFunctionInterface() {
33 return INTERFACE; 43 return INTERFACE;
34 } 44 }
36 static { 46 static {
37 NativeFunctionInterface instance; 47 NativeFunctionInterface instance;
38 try { 48 try {
39 instance = createInterface(); 49 instance = createInterface();
40 } catch (UnsatisfiedLinkError e) { 50 } catch (UnsatisfiedLinkError e) {
41 System.err.println("Graal Native Function Interface not supported!");
42 e.printStackTrace();
43 instance = null; 51 instance = null;
44 } 52 }
45 INTERFACE = instance; 53 INTERFACE = instance;
46 } 54 }
47 } 55 }