Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java @ 23703:9ac04c6047c8
sync with jdk9 changes for JDK-8159613
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Jun 2016 09:48:02 +0200 |
parents | 1d4ce2d19e52 |
children | d6bd0b9cd0b6 |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
23322
f8178417d018
Expose SharedRuntime::throw_and_post_jvmti_exception to JVMCI compilers.
Roland Schatz <roland.schatz@oracle.com>
parents:
23316
diff
changeset
|
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
27 import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
28 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
13263 | 29 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
30 import java.lang.reflect.Array; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
31 import java.lang.reflect.Constructor; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
32 import java.lang.reflect.Executable; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
33 import java.lang.reflect.Field; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
34 import java.lang.reflect.Method; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22555
diff
changeset
|
35 import java.lang.reflect.Modifier; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
37 import jdk.vm.ci.code.CodeUtil; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
38 import jdk.vm.ci.code.TargetDescription; |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
39 import jdk.vm.ci.common.JVMCIError; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
40 import jdk.vm.ci.meta.DeoptimizationAction; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
41 import jdk.vm.ci.meta.DeoptimizationReason; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
42 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
43 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
44 import jdk.vm.ci.meta.MetaAccessProvider; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
45 import jdk.vm.ci.meta.ResolvedJavaField; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
46 import jdk.vm.ci.meta.ResolvedJavaMethod; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
47 import jdk.vm.ci.meta.ResolvedJavaType; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22570
diff
changeset
|
48 import jdk.vm.ci.meta.Signature; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
21665
6166968c6359
Add missing JaCoCo excludes
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
50 // JaCoCo Exclude |
6166968c6359
Add missing JaCoCo excludes
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
51 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 * HotSpot implementation of {@link MetaAccessProvider}. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 */ |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23392
diff
changeset
|
55 public class HotSpotMetaAccessProvider implements MetaAccessProvider { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 |
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:
18867
diff
changeset
|
57 protected final HotSpotJVMCIRuntimeProvider runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
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:
18867
diff
changeset
|
59 public HotSpotMetaAccessProvider(HotSpotJVMCIRuntimeProvider runtime) { |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
60 this.runtime = runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 |
18544
17b5e453ab41
replaced concrete types with interface types to support replay compilation
Doug Simon <doug.simon@oracle.com>
parents:
18540
diff
changeset
|
63 public ResolvedJavaType lookupJavaType(Class<?> clazz) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 if (clazz == null) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 throw new IllegalArgumentException("Class parameter was null"); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 } |
18544
17b5e453ab41
replaced concrete types with interface types to support replay compilation
Doug Simon <doug.simon@oracle.com>
parents:
18540
diff
changeset
|
67 return runtime.fromClass(clazz); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 |
18544
17b5e453ab41
replaced concrete types with interface types to support replay compilation
Doug Simon <doug.simon@oracle.com>
parents:
18540
diff
changeset
|
70 public HotSpotResolvedObjectType lookupJavaType(JavaConstant constant) { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15291
diff
changeset
|
71 if (constant.isNull() || !(constant instanceof HotSpotObjectConstant)) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 return null; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 } |
18544
17b5e453ab41
replaced concrete types with interface types to support replay compilation
Doug Simon <doug.simon@oracle.com>
parents:
18540
diff
changeset
|
74 return ((HotSpotObjectConstant) constant).getType(); |
12429
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 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 public Signature parseMethodDescriptor(String signature) { |
18540
21384a8fbb64
removed static accesses to HotSpotGraalRuntime from some HotSpot meta API classes
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
78 return new HotSpotSignature(runtime, signature); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
81 /** |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
82 * {@link Field} object of {@link Method#slot}. |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
83 */ |
22531
99dc98466321
removed no longer necessary applications of @SuppressWarnings("javadoc")
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
84 private Field reflectionMethodSlot = getReflectionSlotField(Method.class); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
85 |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
86 /** |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
87 * {@link Field} object of {@link Constructor#slot}. |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
88 */ |
22531
99dc98466321
removed no longer necessary applications of @SuppressWarnings("javadoc")
Doug Simon <doug.simon@oracle.com>
parents:
22454
diff
changeset
|
89 private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
90 |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
91 private static Field getReflectionSlotField(Class<?> reflectionClass) { |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
92 try { |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
93 Field field = reflectionClass.getDeclaredField("slot"); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
94 field.setAccessible(true); |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
95 return field; |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
96 } catch (NoSuchFieldException | SecurityException e) { |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
97 throw new JVMCIError(e); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
98 } |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
99 } |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
100 |
18373
91283d4a1218
Use the base class Executable (introduced in Java 8) to unify the handling of Method and Constructor in MetaAccessProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18290
diff
changeset
|
101 public ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod) { |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
102 try { |
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
103 Class<?> holder = reflectionMethod.getDeclaringClass(); |
18373
91283d4a1218
Use the base class Executable (introduced in Java 8) to unify the handling of Method and Constructor in MetaAccessProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18290
diff
changeset
|
104 Field slotField = reflectionMethod instanceof Constructor ? reflectionConstructorSlot : reflectionMethodSlot; |
91283d4a1218
Use the base class Executable (introduced in Java 8) to unify the handling of Method and Constructor in MetaAccessProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
18290
diff
changeset
|
105 final int slot = slotField.getInt(reflectionMethod); |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22422
diff
changeset
|
106 return runtime.getCompilerToVM().getResolvedJavaMethodAtSlot(holder, slot); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
107 } catch (IllegalArgumentException | IllegalAccessException e) { |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
108 throw new JVMCIError(e); |
13264
b23cbfb4366a
merged CompilerToVM.getMetaspaceConstructor into CompilerToVM.getMetaspaceMethod
twisti
parents:
13263
diff
changeset
|
109 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 public ResolvedJavaField lookupJavaField(Field reflectionField) { |
23315
21fe118a18e6
Backed out changeset 2d1ca131b8be
Doug Simon <doug.simon@oracle.com>
parents:
23314
diff
changeset
|
113 Class<?> fieldHolder = reflectionField.getDeclaringClass(); |
13263 | 114 |
23315
21fe118a18e6
Backed out changeset 2d1ca131b8be
Doug Simon <doug.simon@oracle.com>
parents:
23314
diff
changeset
|
115 HotSpotResolvedObjectType holder = fromObjectClass(fieldHolder); |
23316
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
116 if (Modifier.isStatic(reflectionField.getModifiers())) { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
117 final long offset = UNSAFE.staticFieldOffset(reflectionField); |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
118 for (ResolvedJavaField field : holder.getStaticFields()) { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
119 if (offset == ((HotSpotResolvedJavaField) field).offset()) { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
120 return field; |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
121 } |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
122 } |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
123 } else { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
124 final long offset = UNSAFE.objectFieldOffset(reflectionField); |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
125 for (ResolvedJavaField field : holder.getInstanceFields(false)) { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
126 if (offset == ((HotSpotResolvedJavaField) field).offset()) { |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
127 return field; |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
128 } |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
129 } |
c0df579bf9db
get VM internal flags when creating HotSpotResolvedJavaFieldImpl from Field reflection object (JDK-8151266)
Doug Simon <doug.simon@oracle.com>
parents:
23315
diff
changeset
|
130 } |
13263 | 131 |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
132 throw new JVMCIError("unresolved field %s", reflectionField); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 |
12757
a36839dafe50
Remove some useless short casts, synchronize deoptimization.hpp with HotSpotMetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12719
diff
changeset
|
135 private static int intMaskRight(int n) { |
a36839dafe50
Remove some useless short casts, synchronize deoptimization.hpp with HotSpotMetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12719
diff
changeset
|
136 assert n <= 32; |
a36839dafe50
Remove some useless short casts, synchronize deoptimization.hpp with HotSpotMetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12719
diff
changeset
|
137 return n == 32 ? -1 : (1 << n) - 1; |
a36839dafe50
Remove some useless short casts, synchronize deoptimization.hpp with HotSpotMetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12719
diff
changeset
|
138 } |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
139 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
141 public JavaConstant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int debugId) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
142 HotSpotVMConfig config = runtime.getConfig(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 int actionValue = convertDeoptAction(action); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 int reasonValue = convertDeoptReason(reason); |
13677
45fcb3ec0d43
Rename more 'speculation id' to 'debug id'. Add decodeDebugId to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
145 int debugValue = debugId & intMaskRight(config.deoptimizationDebugIdBits); |
23345
1c4b6a7f1917
update to Eclipse 4.5.2 format style
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
146 JavaConstant c = JavaConstant.forInt( |
1c4b6a7f1917
update to Eclipse 4.5.2 format style
Doug Simon <doug.simon@oracle.com>
parents:
23322
diff
changeset
|
147 ~((debugValue << config.deoptimizationDebugIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift))); |
12717
dd856c84a75c
Mask the speculation id correctly in HotSpotMetaAccessProvider.encodeDeoptActionAndReason
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12699
diff
changeset
|
148 assert c.asInt() < 0; |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
149 return c; |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
150 } |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
151 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
152 public DeoptimizationReason decodeDeoptReason(JavaConstant constant) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
153 HotSpotVMConfig config = runtime.getConfig(); |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
154 int reasonValue = ((~constant.asInt()) >> config.deoptimizationReasonShift) & intMaskRight(config.deoptimizationReasonBits); |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
155 DeoptimizationReason reason = convertDeoptReason(reasonValue); |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
156 return reason; |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
157 } |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
158 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
159 public DeoptimizationAction decodeDeoptAction(JavaConstant constant) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
160 HotSpotVMConfig config = runtime.getConfig(); |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
161 int actionValue = ((~constant.asInt()) >> config.deoptimizationActionShift) & intMaskRight(config.deoptimizationActionBits); |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
162 DeoptimizationAction action = convertDeoptAction(actionValue); |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
163 return action; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
166 public int decodeDebugId(JavaConstant constant) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
167 HotSpotVMConfig config = runtime.getConfig(); |
13677
45fcb3ec0d43
Rename more 'speculation id' to 'debug id'. Add decodeDebugId to MetaAccessProvider
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
168 return ((~constant.asInt()) >> config.deoptimizationDebugIdShift) & intMaskRight(config.deoptimizationDebugIdBits); |
12699
38b84d5a66fd
Start passing down a 'speculation id' to deoptimizations.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12484
diff
changeset
|
169 } |
38b84d5a66fd
Start passing down a 'speculation id' to deoptimizations.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12484
diff
changeset
|
170 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 public int convertDeoptAction(DeoptimizationAction action) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
172 HotSpotVMConfig config = runtime.getConfig(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 switch (action) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 case None: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
175 return config.deoptActionNone; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 case RecompileIfTooManyDeopts: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
177 return config.deoptActionMaybeRecompile; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 case InvalidateReprofile: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
179 return config.deoptActionReinterpret; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 case InvalidateRecompile: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
181 return config.deoptActionMakeNotEntrant; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 case InvalidateStopCompiling: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
183 return config.deoptActionMakeNotCompilable; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
185 throw new JVMCIError("%s", action); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
189 public DeoptimizationAction convertDeoptAction(int action) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
190 HotSpotVMConfig config = runtime.getConfig(); |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
191 if (action == config.deoptActionNone) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
192 return DeoptimizationAction.None; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
193 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
194 if (action == config.deoptActionMaybeRecompile) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
195 return DeoptimizationAction.RecompileIfTooManyDeopts; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
196 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
197 if (action == config.deoptActionReinterpret) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
198 return DeoptimizationAction.InvalidateReprofile; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
199 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
200 if (action == config.deoptActionMakeNotEntrant) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
201 return DeoptimizationAction.InvalidateRecompile; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
202 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
203 if (action == config.deoptActionMakeNotCompilable) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
204 return DeoptimizationAction.InvalidateStopCompiling; |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
205 } |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
206 throw new JVMCIError("%d", action); |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
207 } |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
208 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 public int convertDeoptReason(DeoptimizationReason reason) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
210 HotSpotVMConfig config = runtime.getConfig(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 switch (reason) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 case None: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
213 return config.deoptReasonNone; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 case NullCheckException: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
215 return config.deoptReasonNullCheck; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 case BoundsCheckException: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
217 return config.deoptReasonRangeCheck; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 case ClassCastException: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
219 return config.deoptReasonClassCheck; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 case ArrayStoreException: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
221 return config.deoptReasonArrayCheck; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 case UnreachedCode: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
223 return config.deoptReasonUnreached0; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 case TypeCheckedInliningViolated: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
225 return config.deoptReasonTypeCheckInlining; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 case OptimizedTypeCheckViolated: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
227 return config.deoptReasonOptimizedTypeCheck; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 case NotCompiledExceptionHandler: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
229 return config.deoptReasonNotCompiledExceptionHandler; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 case Unresolved: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
231 return config.deoptReasonUnresolved; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 case JavaSubroutineMismatch: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
233 return config.deoptReasonJsrMismatch; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 case ArithmeticException: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
235 return config.deoptReasonDiv0Check; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 case RuntimeConstraint: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
237 return config.deoptReasonConstraint; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 case LoopLimitCheck: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
239 return config.deoptReasonLoopLimitCheck; |
13155
1dd9aa5a9ee5
Deoptimization reason for failed aliasing assumptions.
Roland Schatz <roland.schatz@oracle.com>
parents:
12757
diff
changeset
|
240 case Aliasing: |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
241 return config.deoptReasonAliasing; |
16535
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15909
diff
changeset
|
242 case TransferToInterpreter: |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15909
diff
changeset
|
243 return config.deoptReasonTransferToInterpreter; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 default: |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
245 throw new JVMCIError("%s", reason); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
246 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 } |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
248 |
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
249 public DeoptimizationReason convertDeoptReason(int reason) { |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
250 HotSpotVMConfig config = runtime.getConfig(); |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
251 if (reason == config.deoptReasonNone) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
252 return DeoptimizationReason.None; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
253 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
254 if (reason == config.deoptReasonNullCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
255 return DeoptimizationReason.NullCheckException; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
256 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
257 if (reason == config.deoptReasonRangeCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
258 return DeoptimizationReason.BoundsCheckException; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
259 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
260 if (reason == config.deoptReasonClassCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
261 return DeoptimizationReason.ClassCastException; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
262 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
263 if (reason == config.deoptReasonArrayCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
264 return DeoptimizationReason.ArrayStoreException; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
265 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
266 if (reason == config.deoptReasonUnreached0) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
267 return DeoptimizationReason.UnreachedCode; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
268 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
269 if (reason == config.deoptReasonTypeCheckInlining) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
270 return DeoptimizationReason.TypeCheckedInliningViolated; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
271 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
272 if (reason == config.deoptReasonOptimizedTypeCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
273 return DeoptimizationReason.OptimizedTypeCheckViolated; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
274 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
275 if (reason == config.deoptReasonNotCompiledExceptionHandler) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
276 return DeoptimizationReason.NotCompiledExceptionHandler; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
277 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
278 if (reason == config.deoptReasonUnresolved) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
279 return DeoptimizationReason.Unresolved; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
280 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
281 if (reason == config.deoptReasonJsrMismatch) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
282 return DeoptimizationReason.JavaSubroutineMismatch; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
283 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
284 if (reason == config.deoptReasonDiv0Check) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
285 return DeoptimizationReason.ArithmeticException; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
286 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
287 if (reason == config.deoptReasonConstraint) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
288 return DeoptimizationReason.RuntimeConstraint; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
289 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
290 if (reason == config.deoptReasonLoopLimitCheck) { |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
291 return DeoptimizationReason.LoopLimitCheck; |
13257
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
292 } |
4eacfd0767ed
get deoptimization constants in HotSpotMetaAccessProvider from HotSpotVMConfig
twisti
parents:
13155
diff
changeset
|
293 if (reason == config.deoptReasonAliasing) { |
13155
1dd9aa5a9ee5
Deoptimization reason for failed aliasing assumptions.
Roland Schatz <roland.schatz@oracle.com>
parents:
12757
diff
changeset
|
294 return DeoptimizationReason.Aliasing; |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
295 } |
16535
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15909
diff
changeset
|
296 if (reason == config.deoptReasonTransferToInterpreter) { |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15909
diff
changeset
|
297 return DeoptimizationReason.TransferToInterpreter; |
ada0a7729b6f
Truffle: introduce debug option to print the stack trace when transferring to the interpreter
Andreas Woess <andreas.woess@jku.at>
parents:
15909
diff
changeset
|
298 } |
23392
b3a816d3b844
Backed out changeset: a920338dd4d4
Doug Simon <doug.simon@oracle.com>
parents:
23390
diff
changeset
|
299 throw new JVMCIError("%x", reason); |
12484
2d8a8980eda8
Canonicalize DynamicDeoptimize nodes back to Deoptimize when used with a constant reason&action
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12431
diff
changeset
|
300 } |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
301 |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
302 @Override |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18167
diff
changeset
|
303 public long getMemorySize(JavaConstant constant) { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22531
diff
changeset
|
304 if (constant.getJavaKind() == JavaKind.Object) { |
18544
17b5e453ab41
replaced concrete types with interface types to support replay compilation
Doug Simon <doug.simon@oracle.com>
parents:
18540
diff
changeset
|
305 HotSpotResolvedObjectType lookupJavaType = lookupJavaType(constant); |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
306 |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
307 if (lookupJavaType == null) { |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
308 return 0; |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
309 } else { |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
310 if (lookupJavaType.isArray()) { |
18290
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
311 int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object()); |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
312 ResolvedJavaType elementType = lookupJavaType.getComponentType(); |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22531
diff
changeset
|
313 JavaKind elementKind = elementType.getJavaKind(); |
22555
2fe06375f2d3
made HotSpotJVMCIRuntimeProvider.getArrayBaseOffset and HotSpotJVMCIRuntimeProvider.getArrayIndexScale static
Doug Simon <doug.simon@oracle.com>
parents:
22542
diff
changeset
|
314 final int headerSize = getArrayBaseOffset(elementKind); |
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:
18867
diff
changeset
|
315 TargetDescription target = runtime.getHostJVMCIBackend().getTarget(); |
22570
425950fdcccb
Use arrayIndexScale instead of element size to calculate memory consumption of arrays.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
316 int sizeOfElement = getArrayIndexScale(elementKind); |
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:
18867
diff
changeset
|
317 int alignment = target.wordSize; |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
318 int log2ElementSize = CodeUtil.log2(sizeOfElement); |
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:
18867
diff
changeset
|
319 return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize); |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
320 } |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
321 return lookupJavaType.instanceSize(); |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
322 } |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
323 } else { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22531
diff
changeset
|
324 return constant.getJavaKind().getByteCount(); |
13966
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
325 } |
be0d961e3a88
New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13677
diff
changeset
|
326 } |
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:
18867
diff
changeset
|
327 |
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:
18867
diff
changeset
|
328 /** |
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:
18867
diff
changeset
|
329 * Computes the size of the memory chunk allocated for an array. This size accounts for the |
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:
18867
diff
changeset
|
330 * array header size, body size and any padding after the last element to satisfy object |
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:
18867
diff
changeset
|
331 * alignment requirements. |
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:
18867
diff
changeset
|
332 * |
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:
18867
diff
changeset
|
333 * @param length the number of elements in the array |
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:
18867
diff
changeset
|
334 * @param alignment the object alignment requirement |
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:
18867
diff
changeset
|
335 * @param headerSize the size of the array header |
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:
18867
diff
changeset
|
336 * @param log2ElementSize log2 of the size of an element in the array |
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:
18867
diff
changeset
|
337 */ |
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:
18867
diff
changeset
|
338 public static int computeArrayAllocationSize(int length, int alignment, int headerSize, int log2ElementSize) { |
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:
18867
diff
changeset
|
339 int size = (length << log2ElementSize) + headerSize + (alignment - 1); |
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:
18867
diff
changeset
|
340 int mask = ~(alignment - 1); |
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:
18867
diff
changeset
|
341 return size & mask; |
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:
18867
diff
changeset
|
342 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
343 } |