Mercurial > hg > graal-compiler
annotate graal/com.oracle.nfi/src/com/oracle/nfi/NativeFunctionInterfaceRuntime.java @ 21283:23f9cba1f250
fixed spelling error
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 11 May 2015 12:23:13 +0200 |
parents | 13f8c249edb8 |
children | 2f92172fa320 |
rev | line source |
---|---|
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
4 * |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
8 * |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
14 * |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
18 * |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.nfi; |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
24 |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
25 import com.oracle.nfi.api.*; |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
26 |
16704 | 27 /** |
16705 | 28 * Class for obtaining the {@link NativeFunctionInterface} (if any) provided by the VM. |
16704 | 29 */ |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
30 public final class NativeFunctionInterfaceRuntime { |
16705 | 31 private static final NativeFunctionInterface INSTANCE; |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
32 |
16704 | 33 /** |
16705 | 34 * Creates a new {@link NativeFunctionInterface}. |
16704 | 35 * |
16705 | 36 * @throws UnsatisfiedLinkError if not running on a VM that provides a |
37 * {@link NativeFunctionInterface} | |
16704 | 38 */ |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
39 private static native NativeFunctionInterface createInterface(); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
40 |
16705 | 41 /** |
42 * Gets the {@link NativeFunctionInterface} (if any) provided by the VM. | |
43 * | |
44 * @return null if the VM does not provide a {@link NativeFunctionInterface} | |
45 */ | |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
46 public static NativeFunctionInterface getNativeFunctionInterface() { |
16705 | 47 return INSTANCE; |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
48 } |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
49 |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
50 static { |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
51 NativeFunctionInterface instance; |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
52 try { |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
53 instance = createInterface(); |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
54 } catch (UnsatisfiedLinkError e) { |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
55 instance = null; |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
56 } |
16705 | 57 INSTANCE = instance; |
16691
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
58 } |
dd8449afc086
GNFI: move GNFI interfaces to oracle.nfi - interface does not depend on graal
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
diff
changeset
|
59 } |