annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java @ 14906:f3a5036cc13c

javadoc fixes javadoc has become stricter in jdk8
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 31 Mar 2014 20:51:09 +0200
parents 001c41b01d13
children 64dcb92ee75a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
23 package com.oracle.graal.hotspot.meta;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
25 import static com.oracle.graal.graph.UnsafeAccess.*;
9289
261a43921c5e rename: HotSpotGraalRuntime.getInstance() -> graalRuntime()
Doug Simon <doug.simon@oracle.com>
parents: 9041
diff changeset
26
5855
0278da961319 moved InstalledCode from graal.api.meta to graal.api.code
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
27 import com.oracle.graal.api.code.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
28 import com.oracle.graal.hotspot.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
30 import sun.misc.*;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
31
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 /**
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
33 * Implementation of {@link InstalledCode} for HotSpot.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 */
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
35 public abstract class HotSpotInstalledCode extends CompilerObject implements InstalledCode {
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
36
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
37 private static final long serialVersionUID = 156632908220561612L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
39 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
40 * Raw address of this code blob.
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
41 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
42 private long codeBlob;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
43
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
44 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
45 * Total size of the code blob.
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
46 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
47 private int size;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
49 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
50 * Start address of the code.
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
51 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
52 private long codeStart;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
53
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
54 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
55 * Size of the code.
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
56 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
57 private int codeSize;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
58
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
59 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
60 * @return the address of this code blob
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
61 */
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9289
diff changeset
62 public long getCodeBlob() {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9289
diff changeset
63 return codeBlob;
8564
bbd8167f21f9 Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 8349
diff changeset
64 }
bbd8167f21f9 Added executeHelper to HotSpotInstalled code that gets replaced by a MethodSubstitution
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 8349
diff changeset
65
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
66 /**
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
67 * @return the total size of this code blob
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
68 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
69 public int getSize() {
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
70 return size;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
71 }
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
72
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
73 /**
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 11381
diff changeset
74 * @return a copy of this code blob if it is {@linkplain #isValid() valid}, null otherwise.
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
75 */
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
76 public byte[] getBlob() {
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
77 if (!isValid()) {
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
78 return null;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
79 }
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
80 byte[] blob = new byte[size];
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
81 unsafe.copyMemory(null, codeBlob, blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size);
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
82 return blob;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
83 }
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
84
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 @Override
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
86 public abstract String toString();
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: 8580
diff changeset
87
9668
fe9a18fbb15e added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
88 public long getStart() {
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
89 return codeStart;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
90 }
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
91
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
92 public long getCodeSize() {
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
93 return codeSize;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 }
4993
897b7d18bebc added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
95
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8215
diff changeset
96 public byte[] getCode() {
11381
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
97 if (!isValid()) {
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
98 return null;
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
99 }
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
100 byte[] code = new byte[codeSize];
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
101 unsafe.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize);
001c41b01d13 HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents: 9668
diff changeset
102 return code;
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8215
diff changeset
103 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 }