annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @ 24116:df038ccc5943

missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
author Doug Simon <doug.simon@oracle.com>
date Sat, 01 Apr 2017 15:45:34 +0200
parents 244adb543e36
children 6508ce8d068f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22598
diff changeset
27 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
28
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
29 import java.lang.reflect.Array;
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
30
22672
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.Constant;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22598
diff changeset
32 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
33 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
34 import jdk.vm.ci.meta.MemoryAccessProvider;
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
35 import jdk.vm.ci.meta.MetaAccessProvider;
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22598
diff changeset
36 import jdk.vm.ci.meta.PrimitiveConstant;
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
37 import jdk.vm.ci.meta.ResolvedJavaField;
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
38 import jdk.vm.ci.meta.ResolvedJavaType;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 /**
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
41 * HotSpot implementation of {@link MemoryAccessProvider}.
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 */
23393
1d4ce2d19e52 clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents: 23390
diff changeset
43 class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44
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
45 protected final HotSpotJVMCIRuntimeProvider runtime;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46
23297
4b58c92e939b remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents: 22672
diff changeset
47 HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
48 this.runtime = runtime;
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
49 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
50
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
51 /**
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
52 * Gets the object boxed by {@code base} that is about to have a value of kind {@code kind} read
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
53 * from it at the offset {@code displacement}.
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
54 *
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
55 * @param base constant value containing the base address for a pending read
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
56 * @return {@code null} if {@code base} does not box an object otherwise the object boxed in
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
57 * {@code base}
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
58 */
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
59 private static Object asObject(HotSpotJVMCIRuntimeProvider runtime, Constant base, JavaKind kind, long displacement) {
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
60 if (base instanceof HotSpotObjectConstantImpl) {
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
61 HotSpotObjectConstantImpl constant = (HotSpotObjectConstantImpl) base;
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
62 HotSpotResolvedObjectType type = constant.getType();
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
63 Object object = constant.object();
24115
244adb543e36 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 5 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24114
diff changeset
64 if (object instanceof Class && kind != JavaKind.Object) {
24116
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
65 // Cannot check bounds when reading primitives from java.lang.Class as
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
66 // we don't have the bounds for the part of a java.lang.Class object
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
67 // containing the static fields of the represented class.
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
68 } else {
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
69 checkRead(runtime, kind, displacement, type, object);
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
70 }
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
71 return object;
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
72 }
24111
8abcd8e1285d missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 23712
diff changeset
73 return null;
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
74
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
75 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
76
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
77 private static void checkRead(HotSpotJVMCIRuntimeProvider runtime, JavaKind kind, long displacement, HotSpotResolvedObjectType type, Object object) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
78 if (type.isArray()) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
79 ResolvedJavaType componentType = type.getComponentType();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
80 JavaKind componentKind = componentType.getJavaKind();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
81 final int headerSize = getArrayBaseOffset(componentKind);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
82 int sizeOfElement = getArrayIndexScale(componentKind);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
83 int length = Array.getLength(object);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
84 long arrayEnd = headerSize + (sizeOfElement * length);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
85 boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0;
24114
2b760c6b0561 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 4 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24113
diff changeset
86 if (displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) {
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
87 int index = (int) ((displacement - headerSize) / sizeOfElement);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
88 throw new AssertionError("Unsafe array access: reading element of kind " + kind +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
89 " at offset " + displacement + " (index ~ " + index + ") in " +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
90 type.toJavaName() + " object of length " + length);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
91 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
92 } else if (kind != JavaKind.Object) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
93 // In non-product builds, unsafe.cpp asserts that an access based on a non-null
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
94 // object is within bounds so do a similar check here to prevent a VM halt.
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
95 long size = Math.abs(type.instanceSize());
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
96 int bytesToRead = kind.getByteCount();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
97 if (displacement + bytesToRead > size || displacement < 0) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
98 throw new IllegalArgumentException("Unsafe access: reading " + bytesToRead + " bytes at offset " + displacement + " in " +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
99 type.toJavaName() + " object of size " + size);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
100 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
101 } else {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
102 ResolvedJavaField field = type.findInstanceFieldWithOffset(displacement, JavaKind.Object);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
103 if (field == null && object instanceof Class) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
104 // Read of a static field
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
105 MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
106 HotSpotResolvedObjectTypeImpl staticFieldsHolder = (HotSpotResolvedObjectTypeImpl) metaAccess.lookupJavaType((Class<?>) object);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
107 field = staticFieldsHolder.findStaticFieldWithOffset(displacement, JavaKind.Object);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
108 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
109 if (field == null) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
110 throw new IllegalArgumentException("Unsafe object access: field not found for read of kind Object" +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
111 " at offset " + displacement + " in " + type.toJavaName() + " object");
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
112 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
113 if (field.getJavaKind() != JavaKind.Object) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
114 throw new IllegalArgumentException("Unsafe object access: field " + field.format("%H.%n:%T") + " not of expected kind Object" +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
115 " at offset " + displacement + " in " +
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
116 type.toJavaName() + " object");
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
117 }
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
118 }
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
119 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
120
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
121 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
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);
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
124 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
125 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
126 // 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
127 return true;
24116
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
128 } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
129 // ArrayKlass::_component_mirror is only valid for all ArrayKlass* values
df038ccc5943 missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 6 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24115
diff changeset
130 return ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().isArray();
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
131 }
94d87f6324a3 ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents: 19412
diff changeset
132 } 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
133 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
134 }
94d87f6324a3 ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents: 19412
diff changeset
135 }
94d87f6324a3 ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents: 19412
diff changeset
136 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
137 }
94d87f6324a3 ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents: 19412
diff changeset
138
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
139 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
140 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
141 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
142 return meta.getMetaspacePointer();
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
143 } else if (base instanceof PrimitiveConstant) {
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
144 PrimitiveConstant prim = (PrimitiveConstant) base;
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
145 if (prim.getJavaKind().isNumericInteger()) {
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
146 return prim.asLong();
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
147 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
148 }
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
149 throw new IllegalArgumentException(String.valueOf(base));
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
150 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
151
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
152 private static long readRawValue(HotSpotJVMCIRuntimeProvider runtime, Constant baseConstant, long displacement, JavaKind kind, int bits) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
153 Object base = asObject(runtime, baseConstant, kind, displacement);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
154 if (base != null) {
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
155 switch (bits) {
23322
f8178417d018 Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents: 23297
diff changeset
156 case Byte.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
157 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
158 case Short.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
159 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
160 case Integer.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
161 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
162 case Long.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
163 return UNSAFE.getLong(base, displacement);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
164 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
165 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
166 }
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
167 } else {
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
168 long pointer = asRawPointer(baseConstant);
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
169 switch (bits) {
23322
f8178417d018 Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents: 23297
diff changeset
170 case Byte.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
171 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
172 case Short.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
173 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
174 case Integer.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
175 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
176 case Long.SIZE:
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
177 return UNSAFE.getLong(pointer + displacement);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
178 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
179 throw new IllegalArgumentException(String.valueOf(bits));
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
180 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
181 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
182 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
183
23712
66059526b021 8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject
Roland Schatz <roland.schatz@oracle.com>
parents: 23679
diff changeset
184 private boolean verifyReadRawObject(Object expected, Constant base, long displacement) {
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
185 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
186 MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
187 if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
188 if (displacement == runtime.getConfig().classMirrorOffset) {
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
189 assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror();
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
190 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
191 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
192 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
193 return true;
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
194 }
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
195
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
196 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
197 long displacement = initialDisplacement;
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
198 Object ret;
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
199 Object base = asObject(runtime, baseConstant, JavaKind.Object, displacement);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
200 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
201 assert !compressed;
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
202 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
203 ret = runtime.getCompilerToVM().readUncompressedOop(displacement);
23712
66059526b021 8160177: [JVMCI] race condition in HotSpotMemoryAccessProviderImpl.verifyReadRawObject
Roland Schatz <roland.schatz@oracle.com>
parents: 23679
diff changeset
204 assert verifyReadRawObject(ret, baseConstant, initialDisplacement);
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
205 } 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
206 assert runtime.getConfig().useCompressedOops == compressed;
22542
15579668ec3a renamed constant field to UNSAFE
Doug Simon <doug.simon@oracle.com>
parents: 22541
diff changeset
207 ret = UNSAFE.getObject(base, displacement);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
208 }
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18530
diff changeset
209 return ret;
18359
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
210 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
211
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
212 JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
213 assert obj != null;
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
214 assert !field.isStatic() || obj instanceof Class;
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
215 long displacement = field.offset();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
216 if (field.getJavaKind() == JavaKind.Object) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
217 Object o = UNSAFE.getObject(obj, displacement);
18359
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
218 return HotSpotObjectConstantImpl.forObject(o);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
219 } else {
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
220 JavaKind kind = field.getJavaKind();
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
221 switch (kind) {
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
222 case Boolean:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
223 return JavaConstant.forBoolean(UNSAFE.getBoolean(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
224 case Byte:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
225 return JavaConstant.forByte(UNSAFE.getByte(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
226 case Char:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
227 return JavaConstant.forChar(UNSAFE.getChar(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
228 case Short:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
229 return JavaConstant.forShort(UNSAFE.getShort(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
230 case Int:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
231 return JavaConstant.forInt(UNSAFE.getInt(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
232 case Long:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
233 return JavaConstant.forLong(UNSAFE.getLong(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
234 case Float:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
235 return JavaConstant.forFloat(UNSAFE.getFloat(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
236 case Double:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
237 return JavaConstant.forDouble(UNSAFE.getDouble(obj, displacement));
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
238 default:
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
239 throw new IllegalArgumentException("Unsupported kind: " + kind);
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
240 }
18359
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
241 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
242 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
243
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
244 @Override
22536
dc1aeef79e7e Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
245 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
246 try {
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
247 long rawValue = readRawValue(runtime, baseConstant, initialDisplacement, kind, bits);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
248 switch (kind) {
18359
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
249 case Boolean:
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
250 return JavaConstant.forBoolean(rawValue != 0);
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
251 case Byte:
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
252 return JavaConstant.forByte((byte) rawValue);
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
253 case Char:
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
254 return JavaConstant.forChar((char) rawValue);
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
255 case Short:
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
256 return JavaConstant.forShort((short) rawValue);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
257 case Int:
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
258 return JavaConstant.forInt((int) rawValue);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
259 case Long:
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
260 return JavaConstant.forLong(rawValue);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
261 case Float:
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
262 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
263 case Double:
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
264 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
265 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
266 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
267 }
24113
8cf4cf3f9f2a missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail - part 3 (JDK-8177673)
Doug Simon <doug.simon@oracle.com>
parents: 24112
diff changeset
268 } catch (NullPointerException e) {
18359
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
269 return null;
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
270 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
271 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
272
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
273 @Override
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
274 public JavaConstant readObjectConstant(Constant base, long displacement) {
23361
dafcbf1bb9cd HotSpotMemoryAccessProviderImpl.readObjectConstant should support reading fields in objects (JDK-8155626)
Doug Simon <doug.simon@oracle.com>
parents: 23360
diff changeset
275 if (base instanceof HotSpotObjectConstantImpl) {
dafcbf1bb9cd HotSpotMemoryAccessProviderImpl.readObjectConstant should support reading fields in objects (JDK-8155626)
Doug Simon <doug.simon@oracle.com>
parents: 23360
diff changeset
276 Object o = readRawObject(base, displacement, runtime.getConfig().useCompressedOops);
dafcbf1bb9cd HotSpotMemoryAccessProviderImpl.readObjectConstant should support reading fields in objects (JDK-8155626)
Doug Simon <doug.simon@oracle.com>
parents: 23360
diff changeset
277 return HotSpotObjectConstantImpl.forObject(o);
dafcbf1bb9cd HotSpotMemoryAccessProviderImpl.readObjectConstant should support reading fields in objects (JDK-8155626)
Doug Simon <doug.simon@oracle.com>
parents: 23360
diff changeset
278 }
23400
0cbc2bd101c3 revert incorrect assertion and correct javadoc around MemoryAccessProvider.readObjectConstant
Doug Simon <doug.simon@oracle.com>
parents: 23398
diff changeset
279 if (!isValidObjectFieldDisplacement(base, displacement)) {
0cbc2bd101c3 revert incorrect assertion and correct javadoc around MemoryAccessProvider.readObjectConstant
Doug Simon <doug.simon@oracle.com>
parents: 23398
diff changeset
280 return null;
0cbc2bd101c3 revert incorrect assertion and correct javadoc around MemoryAccessProvider.readObjectConstant
Doug Simon <doug.simon@oracle.com>
parents: 23398
diff changeset
281 }
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
282 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
283 }
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
284
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
285 @Override
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23401
diff changeset
286 public JavaConstant readNarrowOopConstant(Constant base, long displacement) {
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
287 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
288 }
a3a2359ac88e Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents: 18340
diff changeset
289
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
290 private HotSpotResolvedObjectTypeImpl readKlass(Constant base, long displacement, boolean compressed) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
291 assert (base instanceof HotSpotMetaspaceConstantImpl) || (base instanceof HotSpotObjectConstantImpl) : base.getClass();
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
292 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
293 return runtime.getCompilerToVM().getResolvedJavaType(baseObject, displacement, compressed);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
294 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
295
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
296 @Override
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
297 public Constant readKlassPointerConstant(Constant base, long displacement) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
298 HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, false);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
299 if (klass == null) {
18735
e04e41c3cb6e Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18719
diff changeset
300 return JavaConstant.NULL_POINTER;
e04e41c3cb6e Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18719
diff changeset
301 }
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
302 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
303 }
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
304
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
305 @Override
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23401
diff changeset
306 public Constant readNarrowKlassPointerConstant(Constant base, long displacement) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
307 HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, true);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
308 if (klass == null) {
18779
7ea9a39bd7cc return proper kind of NULL
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18735
diff changeset
309 return HotSpotCompressedNullConstant.COMPRESSED_NULL;
18735
e04e41c3cb6e Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18719
diff changeset
310 }
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
311 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
312 }
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
313
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
314 @Override
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
315 public Constant readMethodPointerConstant(Constant base, long displacement) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
316 assert (base instanceof HotSpotObjectConstantImpl);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
317 Object baseObject = ((HotSpotObjectConstantImpl) base).object();
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
318 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
319 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(method, false);
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
320 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
321 }