Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @ 23346:39f25354aeee
Sync speculation log changes with JDK9 version
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 07 Apr 2016 11:09:49 -0700 |
parents | 67c84a8b19cc |
children | 73ceb487b9ca |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
25 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
26 import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
27 import jdk.vm.ci.meta.Constant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
28 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
29 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
30 import jdk.vm.ci.meta.MemoryAccessProvider; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22598
diff
changeset
|
31 import jdk.vm.ci.meta.PrimitiveConstant; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 /** |
18482
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
34 * HotSpot implementation of {@link MemoryAccessProvider}. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 */ |
22598
ed53e370f04c
Make implementation classes package private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22590
diff
changeset
|
36 class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20176
diff
changeset
|
38 protected final HotSpotJVMCIRuntimeProvider runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22672
diff
changeset
|
40 HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
41 this.runtime = runtime; |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18471
diff
changeset
|
42 } |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18471
diff
changeset
|
43 |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
44 private static Object asObject(Constant base) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
45 if (base instanceof HotSpotObjectConstantImpl) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
46 return ((HotSpotObjectConstantImpl) base).object(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
47 } else { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
48 return null; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
49 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
50 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
51 |
19772
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
52 private boolean isValidObjectFieldDisplacement(Constant base, long displacement) { |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
53 if (base instanceof HotSpotMetaspaceConstant) { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
54 MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); |
19772
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
55 if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) { |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
56 if (displacement == runtime.getConfig().classMirrorOffset) { |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
57 // Klass::_java_mirror is valid for all Klass* values |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
58 return true; |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
59 } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) { |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
60 // ArrayKlass::_component_mirror is only valid for all ArrayKlass* values |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
61 return ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().isArray(); |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
62 } |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
63 } else { |
23341
67c84a8b19cc
fixed javadoc and implementation of MemoryAccessProvider methods to only throw IllegalArgumentException (JDK-8152024)
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
64 throw new IllegalArgumentException(String.valueOf(metaspaceObject)); |
19772
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
65 } |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
66 } |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
67 return false; |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
68 } |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
69 |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
70 private static long asRawPointer(Constant base) { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
71 if (base instanceof HotSpotMetaspaceConstantImpl) { |
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
72 MetaspaceWrapperObject meta = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); |
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
73 return meta.getMetaspacePointer(); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
74 } else if (base instanceof PrimitiveConstant) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
75 PrimitiveConstant prim = (PrimitiveConstant) base; |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22454
diff
changeset
|
76 if (prim.getJavaKind().isNumericInteger()) { |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
77 return prim.asLong(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
78 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
79 } |
23341
67c84a8b19cc
fixed javadoc and implementation of MemoryAccessProvider methods to only throw IllegalArgumentException (JDK-8152024)
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
80 throw new IllegalArgumentException(String.valueOf(base)); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
81 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
82 |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
83 private static long readRawValue(Constant baseConstant, long displacement, int bits) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
84 Object base = asObject(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
85 if (base != null) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
86 switch (bits) { |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
87 case Byte.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
88 return UNSAFE.getByte(base, displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
89 case Short.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
90 return UNSAFE.getShort(base, displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
91 case Integer.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
92 return UNSAFE.getInt(base, displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
93 case Long.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
94 return UNSAFE.getLong(base, displacement); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
95 default: |
23341
67c84a8b19cc
fixed javadoc and implementation of MemoryAccessProvider methods to only throw IllegalArgumentException (JDK-8152024)
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
96 throw new IllegalArgumentException(String.valueOf(bits)); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
97 } |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
98 } else { |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
99 long pointer = asRawPointer(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
100 switch (bits) { |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
101 case Byte.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
102 return UNSAFE.getByte(pointer + displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
103 case Short.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
104 return UNSAFE.getShort(pointer + displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
105 case Integer.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
106 return UNSAFE.getInt(pointer + displacement); |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
107 case Long.SIZE: |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
108 return UNSAFE.getLong(pointer + displacement); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
109 default: |
23341
67c84a8b19cc
fixed javadoc and implementation of MemoryAccessProvider methods to only throw IllegalArgumentException (JDK-8152024)
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
110 throw new IllegalArgumentException(String.valueOf(bits)); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
111 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
112 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
113 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
114 |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
115 private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
116 if (compressed == runtime.getConfig().useCompressedOops) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
117 Object obj = asObject(base); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
118 if (obj != null) { |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
119 assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
120 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
121 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
122 if (base instanceof HotSpotMetaspaceConstant) { |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
123 MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
124 if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
125 if (displacement == runtime.getConfig().classMirrorOffset) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
126 assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
127 } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
128 assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().getComponentType(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
129 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
130 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
131 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
132 return true; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
133 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
134 |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
135 private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
136 long displacement = initialDisplacement; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
137 |
20176
03b4fa99eff8
rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents:
19772
diff
changeset
|
138 Object ret; |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
139 Object base = asObject(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
140 if (base == null) { |
20176
03b4fa99eff8
rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents:
19772
diff
changeset
|
141 assert !compressed; |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
142 displacement += asRawPointer(baseConstant); |
20176
03b4fa99eff8
rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents:
19772
diff
changeset
|
143 ret = runtime.getCompilerToVM().readUncompressedOop(displacement); |
03b4fa99eff8
rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents:
19772
diff
changeset
|
144 } else { |
03b4fa99eff8
rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents:
19772
diff
changeset
|
145 assert runtime.getConfig().useCompressedOops == compressed; |
22542
15579668ec3a
renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents:
22541
diff
changeset
|
146 ret = UNSAFE.getObject(base, displacement); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
147 } |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
148 assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
149 return ret; |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
150 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
151 |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
152 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22454
diff
changeset
|
153 public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22454
diff
changeset
|
154 if (kind == JavaKind.Object) { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
155 Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
156 return HotSpotObjectConstantImpl.forObject(o); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
157 } else { |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
158 int bits = kind.getByteCount() * Byte.SIZE; |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
159 return readPrimitiveConstant(kind, baseConstant, displacement, bits); |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
160 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
161 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
162 |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
163 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22454
diff
changeset
|
164 public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
165 try { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
166 long rawValue = readRawValue(baseConstant, initialDisplacement, bits); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
167 switch (kind) { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
168 case Boolean: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
169 return JavaConstant.forBoolean(rawValue != 0); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
170 case Byte: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
171 return JavaConstant.forByte((byte) rawValue); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
172 case Char: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
173 return JavaConstant.forChar((char) rawValue); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
174 case Short: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
175 return JavaConstant.forShort((short) rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
176 case Int: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
177 return JavaConstant.forInt((int) rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
178 case Long: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
179 return JavaConstant.forLong(rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
180 case Float: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
181 return JavaConstant.forFloat(Float.intBitsToFloat((int) rawValue)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
182 case Double: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
183 return JavaConstant.forDouble(Double.longBitsToDouble(rawValue)); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
184 default: |
23341
67c84a8b19cc
fixed javadoc and implementation of MemoryAccessProvider methods to only throw IllegalArgumentException (JDK-8152024)
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
185 throw new IllegalArgumentException("Unsupported kind: " + kind); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
186 } |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
187 } catch (NullPointerException e) { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
188 return null; |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
189 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
190 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
191 |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
192 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
193 public JavaConstant readObjectConstant(Constant base, long displacement) { |
19772
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
194 if (!isValidObjectFieldDisplacement(base, displacement)) { |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
195 return null; |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
196 } |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
197 return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, false)); |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
198 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
199 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
200 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
201 public JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding) { |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
202 assert encoding.equals(runtime.getConfig().getOopEncoding()) : "unexpected oop encoding: " + encoding + " != " + runtime.getConfig().getOopEncoding(); |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
203 return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, true), true); |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
204 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
205 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
206 private HotSpotResolvedObjectTypeImpl readKlass(Constant base, long displacement, boolean compressed) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
207 assert (base instanceof HotSpotMetaspaceConstantImpl) || (base instanceof HotSpotObjectConstantImpl) : base.getClass(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
208 Object baseObject = (base instanceof HotSpotMetaspaceConstantImpl) ? ((HotSpotMetaspaceConstantImpl) base).asResolvedJavaType() : ((HotSpotObjectConstantImpl) base).object(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
209 return runtime.getCompilerToVM().getResolvedJavaType(baseObject, displacement, compressed); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
210 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
211 |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
212 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
213 public Constant readKlassPointerConstant(Constant base, long displacement) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
214 HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, false); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
215 if (klass == null) { |
18735
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
216 return JavaConstant.NULL_POINTER; |
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
217 } |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
218 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(klass, false); |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
219 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
220 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
221 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
222 public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
223 HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, true); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
224 if (klass == null) { |
18779
7ea9a39bd7cc
return proper kind of NULL
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18735
diff
changeset
|
225 return HotSpotCompressedNullConstant.COMPRESSED_NULL; |
18735
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
226 } |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
227 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(klass, true); |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
228 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
229 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
230 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
231 public Constant readMethodPointerConstant(Constant base, long displacement) { |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
232 assert (base instanceof HotSpotObjectConstantImpl); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
233 Object baseObject = ((HotSpotObjectConstantImpl) base).object(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22054
diff
changeset
|
234 HotSpotResolvedJavaMethodImpl method = runtime.getCompilerToVM().getResolvedJavaMethod(baseObject, displacement); |
22590
3f6488b29c1a
Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents:
22556
diff
changeset
|
235 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(method, false); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
236 } |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
237 |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
238 @Override |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
239 public Constant readSymbolConstant(Constant base, long displacement) { |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
240 int bits = runtime.getConfig().symbolPointerSize * Byte.SIZE; |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
241 long pointer = readRawValue(base, displacement, bits); |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
242 if (pointer == 0) { |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
243 return JavaConstant.NULL_POINTER; |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
244 } else { |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
245 String symbol = runtime.getCompilerToVM().getSymbol(pointer); |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
246 return new HotSpotSymbol(symbol, pointer).asConstant(); |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
247 } |
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
248 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 } |