Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java @ 21652:5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 12:55:56 +0200 |
parents | 48c1ebd24120 |
children |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
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
|
2 * Copyright (c) 2011, 2015, 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 */ |
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
|
23 package com.oracle.jvmci.hotspot; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
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
|
25 import static com.oracle.jvmci.common.UnsafeAccess.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
27 import com.oracle.jvmci.code.*; |
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
|
28 import com.oracle.jvmci.common.*; |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
29 import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
30 import com.oracle.jvmci.meta.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 /** |
18482
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
33 * HotSpot implementation of {@link MemoryAccessProvider}. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 */ |
18867
7f4cb7587f4c
localized replay compilation marker interface to HotSpot specific code
Doug Simon <doug.simon@oracle.com>
parents:
18779
diff
changeset
|
35 public class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
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
|
37 protected final HotSpotJVMCIRuntimeProvider runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
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
|
39 public HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
40 this.runtime = runtime; |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18471
diff
changeset
|
41 } |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18471
diff
changeset
|
42 |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
43 private static Object asObject(Constant base) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
44 if (base instanceof HotSpotObjectConstantImpl) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
45 return ((HotSpotObjectConstantImpl) base).object(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
46 } else { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
47 return null; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
48 } |
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 |
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
|
51 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
|
52 if (base instanceof HotSpotMetaspaceConstant) { |
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 Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); |
94d87f6324a3
ensure an offset into a HotSpot metaspace object is valid before reading it
Doug Simon <doug.simon@oracle.com>
parents:
19412
diff
changeset
|
54 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
|
55 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
|
56 // 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
|
57 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
|
58 } 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
|
59 // 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
|
60 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
|
61 } |
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 } else { |
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
|
63 throw new JVMCIError("%s", 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
|
64 } |
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 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
|
67 } |
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 |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
69 private static long asRawPointer(Constant base) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
70 if (base instanceof HotSpotMetaspaceConstant) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
71 return ((HotSpotMetaspaceConstant) base).rawValue(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
72 } else if (base instanceof PrimitiveConstant) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
73 PrimitiveConstant prim = (PrimitiveConstant) base; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
74 if (prim.getKind().isNumericInteger()) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
75 return prim.asLong(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
76 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
77 } |
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
|
78 throw new JVMCIError("%s", base); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
79 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
80 |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
81 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
|
82 Object base = asObject(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
83 if (base != null) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
84 switch (bits) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
85 case 8: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
86 return unsafe.getByte(base, displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
87 case 16: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
88 return unsafe.getShort(base, displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
89 case 32: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
90 return unsafe.getInt(base, displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
91 case 64: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
92 return unsafe.getLong(base, displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
93 default: |
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
|
94 throw new JVMCIError("%d", bits); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
95 } |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
96 } else { |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
97 long pointer = asRawPointer(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
98 switch (bits) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
99 case 8: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
100 return unsafe.getByte(pointer + displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
101 case 16: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
102 return unsafe.getShort(pointer + displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
103 case 32: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
104 return unsafe.getInt(pointer + displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
105 case 64: |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
106 return unsafe.getLong(pointer + displacement); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
107 default: |
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
|
108 throw new JVMCIError("%d", bits); |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
109 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
110 } |
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 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
|
114 if (compressed == runtime.getConfig().useCompressedOops) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
115 Object obj = asObject(base); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
116 if (obj != null) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
117 assert expected == unsafe.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
118 } |
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 if (base instanceof HotSpotMetaspaceConstant) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
121 Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
122 if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
123 if (displacement == runtime.getConfig().classMirrorOffset) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
124 assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
125 } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) { |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
126 assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().getComponentType(); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
127 } |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
128 } |
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 return true; |
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 |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
133 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
|
134 long displacement = initialDisplacement; |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
135 |
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
|
136 Object ret; |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
137 Object base = asObject(baseConstant); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
138 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
|
139 assert !compressed; |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
140 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
|
141 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
|
142 } 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
|
143 assert runtime.getConfig().useCompressedOops == compressed; |
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 ret = unsafe.getObject(base, displacement); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
145 } |
18719
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
146 assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed); |
6484e5c068c7
Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18530
diff
changeset
|
147 return ret; |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
148 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
149 |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
150 @Override |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
151 public JavaConstant readUnsafeConstant(Kind kind, JavaConstant baseConstant, long displacement) { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
152 if (kind == Kind.Object) { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
153 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
|
154 return HotSpotObjectConstantImpl.forObject(o); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
155 } else { |
18482
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
156 return readPrimitiveConstant(kind, baseConstant, displacement, kind.getByteCount() * 8); |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
157 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
158 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
159 |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
160 @Override |
18482
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
161 public JavaConstant readPrimitiveConstant(Kind 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
|
162 try { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
163 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
|
164 switch (kind) { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
165 case Boolean: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
166 return JavaConstant.forBoolean(rawValue != 0); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
167 case Byte: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
168 return JavaConstant.forByte((byte) rawValue); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
169 case Char: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
170 return JavaConstant.forChar((char) rawValue); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
171 case Short: |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
172 return JavaConstant.forShort((short) rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
173 case Int: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
174 return JavaConstant.forInt((int) rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
175 case Long: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
176 return JavaConstant.forLong(rawValue); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
177 case Float: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
178 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
|
179 case Double: |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
180 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
|
181 default: |
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
|
182 throw new JVMCIError("Unsupported kind: %s", kind); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
183 } |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
184 } catch (NullPointerException e) { |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
185 return null; |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
186 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
187 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
188 |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
189 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 } |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
194 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
|
195 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
196 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
197 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
198 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
|
199 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
|
200 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
|
201 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18340
diff
changeset
|
202 |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
203 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
204 public Constant readKlassPointerConstant(Constant base, long displacement) { |
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
|
205 TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget(); |
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
|
206 long klass = readRawValue(base, displacement, target.wordSize * 8); |
18735
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
207 if (klass == 0) { |
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
208 return JavaConstant.NULL_POINTER; |
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
209 } |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
210 HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass); |
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
|
211 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, klass, metaKlass, false); |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
212 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
213 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
214 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
215 public Constant readNarrowKlassPointerConstant(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
|
216 int compressed = (int) readRawValue(base, displacement, 32); |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
217 long klass = encoding.uncompress(compressed); |
18735
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
218 if (klass == 0) { |
18779
7ea9a39bd7cc
return proper kind of NULL
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18735
diff
changeset
|
219 return HotSpotCompressedNullConstant.COMPRESSED_NULL; |
18735
e04e41c3cb6e
Handle null in readKlassPointer
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18719
diff
changeset
|
220 } |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
221 HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass); |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
222 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, compressed, metaKlass, true); |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
223 } |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
224 |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
225 @Override |
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
226 public Constant readMethodPointerConstant(Constant base, long displacement) { |
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
|
227 TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget(); |
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
|
228 long method = readRawValue(base, displacement, target.wordSize * 8); |
18483
d7cc487d1325
Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
229 HotSpotResolvedJavaMethod metaMethod = HotSpotResolvedJavaMethodImpl.fromMetaspace(method); |
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
|
230 return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, method, metaMethod, false); |
15023
652564fe42d5
Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
231 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 } |