Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java @ 23785:5cf445d2acf6 jvmci-0.22
Exported elements referring to inaccessible types in jdk.vm.ci (JDK-8167180)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 11 Oct 2016 22:13:23 +0200 |
parents | 1d4ce2d19e52 |
children |
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 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
25 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
26 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22643
diff
changeset
|
27 import jdk.vm.ci.code.InstalledCode; |
22541
d2035d841611
restricted Unsafe capability access to package or class scope
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
28 import sun.misc.Unsafe; |
15172
009d945ddc39
Add FindBugs SupressWarnings to HotSpotInstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15161
diff
changeset
|
29 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 /** |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
31 * Implementation of {@link InstalledCode} for HotSpot. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 */ |
15161
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14991
diff
changeset
|
33 public abstract class HotSpotInstalledCode extends InstalledCode { |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
34 |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
35 /** |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
36 * 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
|
37 */ |
15172
009d945ddc39
Add FindBugs SupressWarnings to HotSpotInstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15161
diff
changeset
|
38 @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int size; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
40 /** |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
41 * 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
|
42 */ |
15172
009d945ddc39
Add FindBugs SupressWarnings to HotSpotInstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15161
diff
changeset
|
43 @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private long codeStart; |
11381
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 /** |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
46 * Size of the code. |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
47 */ |
15172
009d945ddc39
Add FindBugs SupressWarnings to HotSpotInstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15161
diff
changeset
|
48 @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int codeSize; |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
49 |
16401
347915b8cea8
Move name from HotSpotNmethod to InstalledCode to have a name again for truffle nmethods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15291
diff
changeset
|
50 public HotSpotInstalledCode(String name) { |
347915b8cea8
Move name from HotSpotNmethod to InstalledCode to have a name again for truffle nmethods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15291
diff
changeset
|
51 super(name); |
347915b8cea8
Move name from HotSpotNmethod to InstalledCode to have a name again for truffle nmethods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15291
diff
changeset
|
52 } |
347915b8cea8
Move name from HotSpotNmethod to InstalledCode to have a name again for truffle nmethods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15291
diff
changeset
|
53 |
11381
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 * @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
|
56 */ |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
57 public int getSize() { |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
58 return size; |
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 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 @Override |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
62 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
|
63 |
15161
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14991
diff
changeset
|
64 @Override |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
65 public long getStart() { |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
66 return codeStart; |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
67 } |
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 long getCodeSize() { |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
70 return codeSize; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 } |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4220
diff
changeset
|
72 |
15161
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14991
diff
changeset
|
73 @Override |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8215
diff
changeset
|
74 public byte[] getCode() { |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
75 if (!isValid()) { |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
76 return null; |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
77 } |
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
78 byte[] code = new byte[codeSize]; |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
79 UNSAFE.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize); |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
9668
diff
changeset
|
80 return code; |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
8215
diff
changeset
|
81 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 } |