Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java @ 9023:f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 11 Apr 2013 17:36:46 +0200 |
parents | 8d6ea1915d42 |
children | 64dcb92ee75a |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5855
0278da961319
moved InstalledCode from graal.api.meta to graal.api.code
Doug Simon <doug.simon@oracle.com>
parents:
5541
diff
changeset
|
23 package com.oracle.graal.api.code; |
0278da961319
moved InstalledCode from graal.api.meta to graal.api.code
Doug Simon <doug.simon@oracle.com>
parents:
5541
diff
changeset
|
24 |
0278da961319
moved InstalledCode from graal.api.meta to graal.api.code
Doug Simon <doug.simon@oracle.com>
parents:
5541
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
28 * Represents a compiled instance of a method. It may have been invalidated or removed in the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
29 * meantime. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 public interface InstalledCode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
33 /** |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
34 * Returns the method (if any) to which the installed code belongs. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6331
diff
changeset
|
36 ResolvedJavaMethod getMethod(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 /** |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
39 * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0 |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
40 * otherwise. |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
41 */ |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
42 long getStart(); |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
43 |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
44 /** |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
45 * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise. |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
46 */ |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
47 byte[] getCode(); |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
48 |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
49 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
50 * @return true if the code represented by this object is still valid, false otherwise (may |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
51 * happen due to deopt, etc.) |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 boolean isValid(); |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4199
diff
changeset
|
54 |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
55 /** |
9023
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
56 * Invalidates this installed code such that any subsequent invocation will throw an |
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
57 * {@link InvalidInstalledCodeException}. |
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
58 */ |
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
59 void invalidate(); |
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
60 |
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
61 /** |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
62 * Executes the installed code with three object arguments. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
63 * |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
64 * @param arg1 the first argument |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
65 * @param arg2 the second argument |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
66 * @param arg3 the third argument |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
67 * @return the value returned by the executed code |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
68 */ |
9023
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
69 Object execute(Object arg1, Object arg2, Object arg3) throws InvalidInstalledCodeException; |
5246
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
4993
diff
changeset
|
70 |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
71 /** |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
72 * Executes the installed code with a variable number of arguments. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
73 * |
6331
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
74 * @param args the array of object arguments |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
75 * @return the value returned by the executed code |
4241af3ec314
More comments on InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5855
diff
changeset
|
76 */ |
9023
f94bb5d20e5d
Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8349
diff
changeset
|
77 Object executeVarargs(Object... args) throws InvalidInstalledCodeException; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 } |