Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java @ 22672:1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 08 Oct 2015 17:28:41 -0700 |
parents | jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java@b6b46b741102 |
children | 57646377e480 |
comparison
equal
deleted
inserted
replaced
22671:97f30e4d0e95 | 22672:1bbd4a7c274b |
---|---|
1 /* | |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package jdk.vm.ci.hotspot; | |
24 | |
25 import java.io.OutputStream; | |
26 | |
27 import jdk.vm.ci.common.JVMCIError; | |
28 import jdk.vm.ci.compiler.Compiler; | |
29 import jdk.vm.ci.meta.JVMCIMetaAccessContext; | |
30 import jdk.vm.ci.meta.JavaKind; | |
31 import jdk.vm.ci.meta.JavaType; | |
32 import jdk.vm.ci.meta.ResolvedJavaType; | |
33 import jdk.vm.ci.runtime.JVMCIRuntime; | |
34 import sun.misc.Unsafe; | |
35 | |
36 //JaCoCo Exclude | |
37 | |
38 /** | |
39 * Configuration information for the HotSpot JVMCI runtime. | |
40 */ | |
41 public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime { | |
42 | |
43 HotSpotVMConfig getConfig(); | |
44 | |
45 CompilerToVM getCompilerToVM(); | |
46 | |
47 Compiler getCompiler(); | |
48 | |
49 /** | |
50 * Gets an output stream that writes to the HotSpot's {@code tty} stream. | |
51 */ | |
52 OutputStream getLogStream(); | |
53 | |
54 /** | |
55 * Converts a name to a Java type. This method attempts to resolve {@code name} to a | |
56 * {@link ResolvedJavaType}. | |
57 * | |
58 * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format | |
59 * @param accessingType the context of resolution which must be non-null | |
60 * @param resolve specifies whether resolution failure results in an unresolved type being | |
61 * return or a {@link LinkageError} being thrown | |
62 * @return a Java type for {@code name} which is guaranteed to be of type | |
63 * {@link ResolvedJavaType} if {@code resolve == true} | |
64 * @throws LinkageError if {@code resolve == true} and the resolution failed | |
65 * @throws NullPointerException if {@code accessingClass} is {@code null} | |
66 */ | |
67 JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve); | |
68 | |
69 /** | |
70 * Gets the JVMCI mirror for a {@link Class} object. | |
71 * | |
72 * @return the {@link ResolvedJavaType} corresponding to {@code javaClass} | |
73 */ | |
74 ResolvedJavaType fromClass(Class<?> clazz); | |
75 | |
76 JVMCIMetaAccessContext getMetaAccessContext(); | |
77 | |
78 /** | |
79 * The offset from the origin of an array to the first element. | |
80 * | |
81 * @return the offset in bytes | |
82 */ | |
83 static int getArrayBaseOffset(JavaKind kind) { | |
84 switch (kind) { | |
85 case Boolean: | |
86 return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; | |
87 case Byte: | |
88 return Unsafe.ARRAY_BYTE_BASE_OFFSET; | |
89 case Char: | |
90 return Unsafe.ARRAY_CHAR_BASE_OFFSET; | |
91 case Short: | |
92 return Unsafe.ARRAY_SHORT_BASE_OFFSET; | |
93 case Int: | |
94 return Unsafe.ARRAY_INT_BASE_OFFSET; | |
95 case Long: | |
96 return Unsafe.ARRAY_LONG_BASE_OFFSET; | |
97 case Float: | |
98 return Unsafe.ARRAY_FLOAT_BASE_OFFSET; | |
99 case Double: | |
100 return Unsafe.ARRAY_DOUBLE_BASE_OFFSET; | |
101 case Object: | |
102 return Unsafe.ARRAY_OBJECT_BASE_OFFSET; | |
103 default: | |
104 throw new JVMCIError("%s", kind); | |
105 } | |
106 } | |
107 | |
108 /** | |
109 * The scale used for the index when accessing elements of an array of this kind. | |
110 * | |
111 * @return the scale in order to convert the index into a byte offset | |
112 */ | |
113 static int getArrayIndexScale(JavaKind kind) { | |
114 switch (kind) { | |
115 case Boolean: | |
116 return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; | |
117 case Byte: | |
118 return Unsafe.ARRAY_BYTE_INDEX_SCALE; | |
119 case Char: | |
120 return Unsafe.ARRAY_CHAR_INDEX_SCALE; | |
121 case Short: | |
122 return Unsafe.ARRAY_SHORT_INDEX_SCALE; | |
123 case Int: | |
124 return Unsafe.ARRAY_INT_INDEX_SCALE; | |
125 case Long: | |
126 return Unsafe.ARRAY_LONG_INDEX_SCALE; | |
127 case Float: | |
128 return Unsafe.ARRAY_FLOAT_INDEX_SCALE; | |
129 case Double: | |
130 return Unsafe.ARRAY_DOUBLE_INDEX_SCALE; | |
131 case Object: | |
132 return Unsafe.ARRAY_OBJECT_INDEX_SCALE; | |
133 default: | |
134 throw new JVMCIError("%s", kind); | |
135 } | |
136 } | |
137 } |