Mercurial > hg > truffle
comparison graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java @ 21551:5324104ac4f3
moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 26 May 2015 17:13:37 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
21550:f48a6cea31eb | 21551:5324104ac4f3 |
---|---|
1 /* | |
2 * Copyright (c) 2011, 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 | |
24 package com.oracle.jvmci.hotspot; | |
25 | |
26 import static com.oracle.jvmci.hotspot.InitTimer.*; | |
27 | |
28 import com.oracle.graal.api.code.*; | |
29 | |
30 /** | |
31 * Entries into the HotSpot VM from Java code. | |
32 */ | |
33 public class CompilerToVMImpl implements CompilerToVM { | |
34 | |
35 /** | |
36 * Initializes the native part of the Graal runtime. | |
37 */ | |
38 private static native void init(); | |
39 | |
40 static { | |
41 try (InitTimer t = timer("CompilerToVMImpl.init")) { | |
42 init(); | |
43 } | |
44 } | |
45 | |
46 @Override | |
47 public native int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog); | |
48 | |
49 @Override | |
50 public native long getMetaspaceMethod(Class<?> holder, int slot); | |
51 | |
52 @Override | |
53 public native byte[] getBytecode(long metaspaceMethod); | |
54 | |
55 @Override | |
56 public native int exceptionTableLength(long metaspaceMethod); | |
57 | |
58 @Override | |
59 public native long exceptionTableStart(long metaspaceMethod); | |
60 | |
61 @Override | |
62 public native boolean hasBalancedMonitors(long metaspaceMethod); | |
63 | |
64 @Override | |
65 public native long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod); | |
66 | |
67 @Override | |
68 public native long getKlassImplementor(long metaspaceKlass); | |
69 | |
70 @Override | |
71 public native long lookupType(String name, Class<?> accessingClass, boolean eagerResolve); | |
72 | |
73 public native Object resolveConstantInPool(long metaspaceConstantPool, int cpi); | |
74 | |
75 public native Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi); | |
76 | |
77 @Override | |
78 public native int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi); | |
79 | |
80 @Override | |
81 public native String lookupNameRefInPool(long metaspaceConstantPool, int cpi); | |
82 | |
83 @Override | |
84 public native String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi); | |
85 | |
86 @Override | |
87 public native int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi); | |
88 | |
89 public native long constantPoolKlassAt(long metaspaceConstantPool, int cpi); | |
90 | |
91 @Override | |
92 public native long lookupKlassInPool(long metaspaceConstantPool, int cpi); | |
93 | |
94 @Override | |
95 public native long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode); | |
96 | |
97 @Override | |
98 public native long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info); | |
99 | |
100 public native int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi); | |
101 | |
102 @Override | |
103 public native Object lookupAppendixInPool(long metaspaceConstantPool, int cpi); | |
104 | |
105 @Override | |
106 public native void initializeConfiguration(HotSpotVMConfig config); | |
107 | |
108 @Override | |
109 public native long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller); | |
110 | |
111 @Override | |
112 public native boolean hasFinalizableSubclass(long metaspaceKlass); | |
113 | |
114 public native boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod); | |
115 | |
116 @Override | |
117 public native long getClassInitializer(long metaspaceKlass); | |
118 | |
119 @Override | |
120 public native long getMaxCallTargetOffset(long address); | |
121 | |
122 // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage | |
123 @Override | |
124 public synchronized native String disassembleCodeBlob(long codeBlob); | |
125 | |
126 @Override | |
127 public native StackTraceElement getStackTraceElement(long metaspaceMethod, int bci); | |
128 | |
129 @Override | |
130 public native Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode); | |
131 | |
132 @Override | |
133 public native long[] getLineNumberTable(long metaspaceMethod); | |
134 | |
135 @Override | |
136 public native long getLocalVariableTableStart(long metaspaceMethod); | |
137 | |
138 @Override | |
139 public native int getLocalVariableTableLength(long metaspaceMethod); | |
140 | |
141 @Override | |
142 public native String getFileName(HotSpotResolvedJavaType method); | |
143 | |
144 @Override | |
145 public native void reprofile(long metaspaceMethod); | |
146 | |
147 @Override | |
148 public native void invalidateInstalledCode(InstalledCode hotspotInstalledCode); | |
149 | |
150 @Override | |
151 public native Class<?> getJavaMirror(long metaspaceKlass); | |
152 | |
153 @Override | |
154 public native long readUnsafeKlassPointer(Object o); | |
155 | |
156 @Override | |
157 public native Object readUncompressedOop(long address); | |
158 | |
159 @Override | |
160 public native void doNotInlineOrCompile(long metaspaceMethod); | |
161 | |
162 @Override | |
163 public Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException { | |
164 return executeCompiledMethodVarargs(new Object[]{arg1, arg2, arg3}, hotspotInstalledCode); | |
165 } | |
166 | |
167 public synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, | |
168 InstalledCode installedCode); | |
169 | |
170 public native void resetCompilationStatistics(); | |
171 | |
172 public native long[] collectCounters(); | |
173 | |
174 public native boolean isMature(long method); | |
175 | |
176 public native int allocateCompileId(long metaspaceMethod, int entryBCI); | |
177 | |
178 public String getGPUs() { | |
179 return ""; | |
180 } | |
181 | |
182 public native boolean canInlineMethod(long metaspaceMethod); | |
183 | |
184 public native boolean shouldInlineMethod(long metaspaceMethod); | |
185 | |
186 public native boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level); | |
187 | |
188 public native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip); | |
189 | |
190 public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); | |
191 | |
192 public native long getTimeStamp(); | |
193 | |
194 public native String getSymbol(long metaspaceSymbol); | |
195 | |
196 public native void resolveInvokeDynamic(long metaspaceConstantPool, int index); | |
197 | |
198 public native int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod); | |
199 | |
200 public native boolean shouldDebugNonSafepoints(); | |
201 | |
202 public native void writeDebugOutput(byte[] bytes, int offset, int length); | |
203 | |
204 public native void flushDebugOutput(); | |
205 } |