annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotConstantReflectionProvider.java @ 21527:07b088d61d5d

added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Fri, 22 May 2015 23:26:20 +0200
parents graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantReflectionProvider.java@f5c2bc68205e
children
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 /*
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
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 */
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
diff changeset
23 package com.oracle.graal.hotspot.jvmci;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
25 import static com.oracle.graal.compiler.common.GraalOptions.*;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
26 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 18867
diff changeset
27 import static com.oracle.graal.hotspot.stubs.SnippetStub.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 import java.lang.reflect.*;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
30 import java.util.*;
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 import com.oracle.graal.api.meta.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15053
diff changeset
33 import com.oracle.graal.compiler.common.*;
18340
a0381103324b More folding of constant classes and NodeClass references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18295
diff changeset
34 import com.oracle.graal.graph.*;
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
diff changeset
35 import com.oracle.graal.hotspot.meta.*;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
36 import com.oracle.graal.options.*;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
37 import com.oracle.graal.replacements.*;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
38 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
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 /**
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 * HotSpot implementation of {@link ConstantReflectionProvider}.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 */
18867
7f4cb7587f4c localized replay compilation marker interface to HotSpot specific code
Doug Simon <doug.simon@oracle.com>
parents: 18801
diff changeset
43 public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified {
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
44 private static final String SystemClassName = "Ljava/lang/System;";
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
diff changeset
46 protected final HotSpotJVMCIRuntimeProvider runtime;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
47 protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
48 protected final HotSpotMemoryAccessProviderImpl memoryAccess;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
diff changeset
50 public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) {
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
51 this.runtime = runtime;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
52 this.methodHandleAccess = new HotSpotMethodHandleAccessProvider(this);
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
53 this.memoryAccess = new HotSpotMemoryAccessProviderImpl(runtime);
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
54 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
55
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
56 public MethodHandleAccessProvider getMethodHandleAccess() {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
57 return methodHandleAccess;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 @Override
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
61 public MemoryAccessProvider getMemoryAccessProvider() {
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
62 return memoryAccess;
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
63 }
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
64
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
65 @Override
18188
8652481a1110 Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
66 public Boolean constantEquals(Constant x, Constant y) {
18471
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
67 if (x == y) {
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
68 return true;
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
69 } else if (x instanceof HotSpotObjectConstantImpl) {
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
70 return y instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) x).object() == ((HotSpotObjectConstantImpl) y).object();
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
71 } else {
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
72 return x.equals(y);
7b60f8334af0 Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents: 18465
diff changeset
73 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 @Override
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
77 public Integer readArrayLength(JavaConstant array) {
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
78 if (array.getKind() != Kind.Object || array.isNull()) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
79 return null;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
80 }
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
81
18290
e7d219e9d01f removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18266
diff changeset
82 Object arrayObject = ((HotSpotObjectConstantImpl) array).object();
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
83 if (!arrayObject.getClass().isArray()) {
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
84 return null;
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
85 }
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
86 return Array.getLength(arrayObject);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
89 public JavaConstant readConstantArrayElement(JavaConstant array, int index) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
90 if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
91 JavaConstant element = readArrayElement(array, index);
18505
3356ea593672 Add missing null check in readConstantArrayElement
Andreas Woess <andreas.woess@jku.at>
parents: 18487
diff changeset
92 if (element != null && (((HotSpotObjectConstantImpl) array).isDefaultStable() || !element.isDefaultForKind())) {
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
93 return element;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
94 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
95 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
96 return null;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
97 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
98
21459
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
99 /**
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
100 * Try to convert {@code offset} into an an index into {@code array}.
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
101 *
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
102 * @return -1 if the offset isn't within the array or the computed index
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
103 */
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
104 private int indexForOffset(JavaConstant array, long offset) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
105 if (array.getKind() != Kind.Object || array.isNull()) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
106 return -1;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
107 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
108 Class<?> componentType = ((HotSpotObjectConstantImpl) array).object().getClass().getComponentType();
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
109 Kind kind = runtime.getHostProviders().getMetaAccess().lookupJavaType(componentType).getKind();
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
110 int arraybase = runtime.getArrayBaseOffset(kind);
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
111 int scale = runtime.getArrayIndexScale(kind);
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
112 if (offset < arraybase) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
113 return -1;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
114 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
115 long index = offset - arraybase;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
116 if (index % scale != 0) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
117 return -1;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
118 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
119 long result = index / scale;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
120 if (result >= Integer.MAX_VALUE) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
121 return -1;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
122 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
123 return (int) result;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
124 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
125
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
126 public JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
127 if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
128 return readConstantArrayElement(array, indexForOffset(array, offset));
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
129 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
130 return null;
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
131 }
f5c2bc68205e support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21377
diff changeset
132
15023
652564fe42d5 Use CompressionNode for accessing compressed Klass pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
133 @Override
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
134 public JavaConstant readArrayElement(JavaConstant array, int index) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
135 if (array.getKind() != Kind.Object || array.isNull()) {
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
136 return null;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
137 }
18290
e7d219e9d01f removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18266
diff changeset
138 Object a = ((HotSpotObjectConstantImpl) array).object();
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
139
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
140 if (index < 0 || index >= Array.getLength(a)) {
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
141 return null;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
142 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
143
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
144 if (a instanceof Object[]) {
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
145 Object element = ((Object[]) a)[index];
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
146 if (((HotSpotObjectConstantImpl) array).getStableDimension() > 1) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
147 return HotSpotObjectConstantImpl.forStableArray(element, ((HotSpotObjectConstantImpl) array).getStableDimension() - 1, ((HotSpotObjectConstantImpl) array).isDefaultStable());
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
148 } else {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
149 return HotSpotObjectConstantImpl.forObject(element);
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
150 }
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
151 } else {
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
152 return JavaConstant.forBoxedPrimitive(Array.get(a, index));
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
153 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
154 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
155
18801
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
156 /**
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
157 * Check if the constant is a boxed value that is guaranteed to be cached by the platform.
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
158 * Otherwise the generated code might be the only reference to the boxed value and since object
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
159 * references from nmethods are weak this can cause GC problems.
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
160 *
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
161 * @param source
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
162 * @return true if the box is cached
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
163 */
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
164 private static boolean isBoxCached(JavaConstant source) {
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
165 switch (source.getKind()) {
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
166 case Boolean:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
167 return true;
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
168 case Char:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
169 return source.asInt() <= 127;
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
170 case Byte:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
171 case Short:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
172 case Int:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
173 return source.asInt() >= -128 && source.asInt() <= 127;
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
174 case Long:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
175 return source.asLong() >= -128 && source.asLong() <= 127;
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
176 case Float:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
177 case Double:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
178 return false;
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
179 default:
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
180 throw new IllegalArgumentException("unexpected kind " + source.getKind());
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
181 }
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
182 }
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
183
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
184 @Override
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
185 public JavaConstant boxPrimitive(JavaConstant source) {
18801
95249d5e794f Only embed boxed primitives when the box is cached by the JDK
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18686
diff changeset
186 if (!source.getKind().isPrimitive() || !isBoxCached(source)) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
187 return null;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
188 }
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18223
diff changeset
189 return HotSpotObjectConstantImpl.forObject(source.asBoxedPrimitive());
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
190 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
191
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
192 @Override
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
193 public JavaConstant unboxPrimitive(JavaConstant source) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
194 if (!source.getKind().isObject()) {
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
195 return null;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
196 }
18293
ab8fbaa5e72f fixed minor regressions after removing HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18290
diff changeset
197 if (source.isNull()) {
ab8fbaa5e72f fixed minor regressions after removing HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18290
diff changeset
198 return null;
ab8fbaa5e72f fixed minor regressions after removing HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18290
diff changeset
199 }
18290
e7d219e9d01f removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18266
diff changeset
200 return JavaConstant.forBoxedPrimitive(((HotSpotObjectConstantImpl) source).object());
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
201 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
202
18295
17bf458cf86e reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents: 18293
diff changeset
203 public JavaConstant forString(String value) {
17bf458cf86e reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents: 18293
diff changeset
204 return HotSpotObjectConstantImpl.forObject(value);
17bf458cf86e reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents: 18293
diff changeset
205 }
17bf458cf86e reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents: 18293
diff changeset
206
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
207 @Override
18487
0f4813e0b4a9 Use asConstant() instead of asJavaConstant() where possible.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
208 public ResolvedJavaType asJavaType(Constant constant) {
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15291
diff changeset
209 if (constant instanceof HotSpotObjectConstant) {
18290
e7d219e9d01f removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents: 18266
diff changeset
210 Object obj = ((HotSpotObjectConstantImpl) constant).object();
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
211 if (obj instanceof Class) {
21527
07b088d61d5d added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21459
diff changeset
212 return runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType((Class<?>) obj);
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
213 }
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
214 }
16183
b1be2a46cc5c canonicalize LoadMethodNodes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15909
diff changeset
215 if (constant instanceof HotSpotMetaspaceConstant) {
18266
ae181ec869c5 converted HotSpotMetaspaceConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18262
diff changeset
216 Object obj = HotSpotMetaspaceConstantImpl.getMetaspaceObject(constant);
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
217 if (obj instanceof HotSpotResolvedObjectTypeImpl) {
16183
b1be2a46cc5c canonicalize LoadMethodNodes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15909
diff changeset
218 return (ResolvedJavaType) obj;
b1be2a46cc5c canonicalize LoadMethodNodes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15909
diff changeset
219 }
b1be2a46cc5c canonicalize LoadMethodNodes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15909
diff changeset
220 }
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
221 return null;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13488
diff changeset
222 }
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
223
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
224 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
225 * {@inheritDoc}
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
226 * <p>
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
227 * The {@code value} field in {@link OptionValue} is considered constant if the type of
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
228 * {@code receiver} is (assignable to) {@link StableOptionValue}.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
229 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
230 public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 18867
diff changeset
231 assert !ImmutableCode.getValue() || isCalledForSnippets() || SnippetGraphUnderConstruction.get() != null || HotSpotLoadFieldPlugin.FieldReadEnabledInImmutableCode.get() == Boolean.TRUE : receiver;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
232 HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
233
21377
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
234 if (hotspotField.isStatic()) {
18507
c2b45b536677 Constant fold elements of switch table and enum values() arrays
Andreas Woess <andreas.woess@jku.at>
parents: 18505
diff changeset
235 if (hotspotField.isFinal() || hotspotField.isStable()) {
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
236 ResolvedJavaType holder = hotspotField.getDeclaringClass();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
237 if (holder.isInitialized() && !holder.getName().equals(SystemClassName) && isEmbeddable(hotspotField)) {
18507
c2b45b536677 Constant fold elements of switch table and enum values() arrays
Andreas Woess <andreas.woess@jku.at>
parents: 18505
diff changeset
238 JavaConstant value = readFieldValue(field, receiver);
c2b45b536677 Constant fold elements of switch table and enum values() arrays
Andreas Woess <andreas.woess@jku.at>
parents: 18505
diff changeset
239 if (hotspotField.isFinal() || !value.isDefaultForKind()) {
c2b45b536677 Constant fold elements of switch table and enum values() arrays
Andreas Woess <andreas.woess@jku.at>
parents: 18505
diff changeset
240 return value;
c2b45b536677 Constant fold elements of switch table and enum values() arrays
Andreas Woess <andreas.woess@jku.at>
parents: 18505
diff changeset
241 }
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
242 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
243 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
244 } else {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
245 /*
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
246 * for non-static final fields, we must assume that they are only initialized if they
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
247 * have a non-default value.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
248 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
249 Object object = receiver.isNull() ? null : ((HotSpotObjectConstantImpl) receiver).object();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
250
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
251 // Canonicalization may attempt to process an unsafe read before
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
252 // processing a guard (e.g. a null check or a type check) for this read
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
253 // so we need to check the object being read
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
254 if (object != null) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
255 if (hotspotField.isFinal()) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
256 if (hotspotField.isInObject(object)) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
257 JavaConstant value = readFieldValue(field, receiver);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
258 if (!value.isDefaultForKind() || assumeNonStaticFinalDefaultFieldsAsFinal(object.getClass())) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
259 return value;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
260 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
261 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
262 } else if (hotspotField.isStable()) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
263 if (hotspotField.isInObject(object)) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
264 JavaConstant value = readFieldValue(field, receiver);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
265 if (assumeDefaultStableFieldsAsFinal(object.getClass()) || !value.isDefaultForKind()) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
266 return value;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
267 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
268 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
269 } else {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
270 Class<?> clazz = object.getClass();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
271 if (StableOptionValue.class.isAssignableFrom(clazz)) {
18686
3f15de59df5e Support multiple fields in StableOptionValue
Christian Wimmer <christian.wimmer@oracle.com>
parents: 18571
diff changeset
272 if (hotspotField.isInObject(object) && hotspotField.getName().equals("value")) {
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
273 StableOptionValue<?> option = (StableOptionValue<?>) object;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
274 return HotSpotObjectConstantImpl.forObject(option.getValue());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
275 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
276 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
277 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
278 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
279 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
280 return null;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
281 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
282
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
283 public JavaConstant readFieldValue(JavaField field, JavaConstant receiver) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
284 HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
285 if (!hotspotField.isStable()) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
286 return readNonStableFieldValue(field, receiver);
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
287 } else {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
288 return readStableFieldValue(field, receiver, false);
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
289 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
290 }
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
291
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
292 private JavaConstant readNonStableFieldValue(JavaField field, JavaConstant receiver) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
293 HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
21377
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
294 if (hotspotField.isStatic()) {
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
295 HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
296 if (holder.isInitialized()) {
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18472
diff changeset
297 return memoryAccess.readUnsafeConstant(hotspotField.getKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset());
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
298 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
299 } else {
21377
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
300 if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) {
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
301 return memoryAccess.readUnsafeConstant(hotspotField.getKind(), receiver, hotspotField.offset());
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
302 }
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
303 }
21377
6f2ff1bccbf1 Adhere to specification described in JavaDoc of interface
Christian Wimmer <christian.wimmer@oracle.com>
parents: 21290
diff changeset
304 return null;
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
305 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
306
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
307 public JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
308 JavaConstant fieldValue = readNonStableFieldValue(field, receiver);
18571
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
309 if (fieldValue.isNonNull()) {
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
310 JavaType declaredType = field.getType();
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
311 if (declaredType.getComponentType() != null) {
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
312 int stableDimension = getArrayDimension(declaredType);
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
313 return HotSpotObjectConstantImpl.forStableArray(((HotSpotObjectConstantImpl) fieldValue).object(), stableDimension, isDefaultStable);
966081b8e830 guard against null element in HotSpotConstantReflectionProvider.readStableFieldValue
Doug Simon <doug.simon@oracle.com>
parents: 18530
diff changeset
314 }
18472
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
315 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
316 return fieldValue;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
317 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
318
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
319 private static int getArrayDimension(JavaType type) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
320 int dimensions = 0;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
321 JavaType componentType = type;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
322 while ((componentType = componentType.getComponentType()) != null) {
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
323 dimensions++;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
324 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
325 return dimensions;
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
326 }
de179c27cad3 Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents: 18471
diff changeset
327
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
328 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
329 * Compares two {@link StackTraceElement}s for equality, ignoring differences in
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
330 * {@linkplain StackTraceElement#getLineNumber() line number}.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
331 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
332 private static boolean equalsIgnoringLine(StackTraceElement left, StackTraceElement right) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
333 return left.getClassName().equals(right.getClassName()) && left.getMethodName().equals(right.getMethodName()) && left.getFileName().equals(right.getFileName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
334 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
335
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
336 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
337 * If the compiler is configured for AOT mode,
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
338 * {@link #readConstantFieldValue(JavaField, JavaConstant)} should be only called for snippets
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
339 * or replacements.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
340 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
341 private static boolean isCalledForSnippets() {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
342 MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
343 ResolvedJavaMethod makeGraphMethod = null;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
344 ResolvedJavaMethod initMethod = null;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
345 try {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
346 Class<?> rjm = ResolvedJavaMethod.class;
21290
ed1fcadffda1 removed FrameStateProcessing and CollapseFrameForSingleSideEffectPhase
Doug Simon <doug.simon@oracle.com>
parents: 19994
diff changeset
347 makeGraphMethod = metaAccess.lookupJavaMethod(ReplacementsImpl.class.getDeclaredMethod("makeGraph", rjm, Object[].class, rjm));
18465
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
348 initMethod = metaAccess.lookupJavaMethod(SnippetTemplate.AbstractTemplates.class.getDeclaredMethod("template", Arguments.class));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
349 } catch (NoSuchMethodException | SecurityException e) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
350 throw new GraalInternalError(e);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
351 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
352 StackTraceElement makeGraphSTE = makeGraphMethod.asStackTraceElement(0);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
353 StackTraceElement initSTE = initMethod.asStackTraceElement(0);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
354
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
355 StackTraceElement[] stackTrace = new Exception().getStackTrace();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
356 for (StackTraceElement element : stackTrace) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
357 // Ignoring line numbers should not weaken this check too much while at
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
358 // the same time making it more robust against source code changes
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
359 if (equalsIgnoringLine(makeGraphSTE, element) || equalsIgnoringLine(initSTE, element)) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
360 return true;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
361 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
362 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
363 return false;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
364 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
365
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
366 private static boolean assumeNonStaticFinalDefaultFieldsAsFinal(Class<?> clazz) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
367 if (TrustFinalDefaultFields.getValue()) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
368 return true;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
369 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
370 return clazz == SnippetCounter.class || clazz == NodeClass.class;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
371 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
372
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
373 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
374 * Usually {@link Stable} fields are not considered constant if the value is the
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
375 * {@link JavaConstant#isDefaultForKind default value}. For some special classes we want to
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
376 * override this behavior.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
377 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
378 private static boolean assumeDefaultStableFieldsAsFinal(Class<?> clazz) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
379 // HotSpotVMConfig has a lot of zero-value fields which we know are stable and want to be
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
380 // considered as constants.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
381 if (clazz == HotSpotVMConfig.class) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
382 return true;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
383 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
384 return false;
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
385 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
386
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
387 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
388 * in AOT mode, some fields should never be embedded even for snippets/replacements.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
389 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
390 private static boolean isEmbeddable(HotSpotResolvedJavaField field) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
391 return Embeddable.test(field);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
392 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
393
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
394 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
395 * Separate out the static initialization to eliminate cycles between clinit and other locks
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
396 * that could lead to deadlock. Static code that doesn't call back into type or field machinery
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
397 * is probably ok but anything else should be made lazy.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
398 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
399 static class Embeddable {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
400
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
401 /**
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
402 * @return Return true if it's ok to embed the value of {@code field}.
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
403 */
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
404 public static boolean test(HotSpotResolvedJavaField field) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
405 return !ImmutableCode.getValue() || !fields.contains(field);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
406 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
407
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
408 private static final List<ResolvedJavaField> fields = new ArrayList<>();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
409 static {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
410 try {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
411 MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
412 fields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("TRUE")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
413 fields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("FALSE")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
414
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
415 Class<?> characterCacheClass = Character.class.getDeclaredClasses()[0];
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
416 assert "java.lang.Character$CharacterCache".equals(characterCacheClass.getName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
417 fields.add(metaAccess.lookupJavaField(characterCacheClass.getDeclaredField("cache")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
418
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
419 Class<?> byteCacheClass = Byte.class.getDeclaredClasses()[0];
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
420 assert "java.lang.Byte$ByteCache".equals(byteCacheClass.getName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
421 fields.add(metaAccess.lookupJavaField(byteCacheClass.getDeclaredField("cache")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
422
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
423 Class<?> shortCacheClass = Short.class.getDeclaredClasses()[0];
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
424 assert "java.lang.Short$ShortCache".equals(shortCacheClass.getName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
425 fields.add(metaAccess.lookupJavaField(shortCacheClass.getDeclaredField("cache")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
426
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
427 Class<?> integerCacheClass = Integer.class.getDeclaredClasses()[0];
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
428 assert "java.lang.Integer$IntegerCache".equals(integerCacheClass.getName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
429 fields.add(metaAccess.lookupJavaField(integerCacheClass.getDeclaredField("cache")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
430
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
431 Class<?> longCacheClass = Long.class.getDeclaredClasses()[0];
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
432 assert "java.lang.Long$LongCache".equals(longCacheClass.getName());
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
433 fields.add(metaAccess.lookupJavaField(longCacheClass.getDeclaredField("cache")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
434
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
435 fields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("UNASSIGNED_STACK")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
436 fields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("SUPPRESSED_SENTINEL")));
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
437 } catch (SecurityException | NoSuchFieldException e) {
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
438 throw new GraalInternalError(e);
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
439 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
440 }
f0a8b72315c1 Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents: 18362
diff changeset
441 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
442 }