Mercurial > hg > graal-compiler
comparison graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java @ 21789:5b9adb645217
fixed remnants of "graal" names in JVMCI code
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 08 Jun 2015 20:24:51 +0200 |
parents | 3d15183f3c93 |
children |
comparison
equal
deleted
inserted
replaced
21788:c1610658bba0 | 21789:5b9adb645217 |
---|---|
72 * current compiler thread, e.g. total allocated bytes. | 72 * current compiler thread, e.g. total allocated bytes. |
73 */ | 73 */ |
74 private static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean(); | 74 private static final com.sun.management.ThreadMXBean threadMXBean = (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean(); |
75 | 75 |
76 /** | 76 /** |
77 * The address of the GraalEnv associated with this compilation or 0L if no such object exists. | 77 * The address of the JVMCIEnv associated with this compilation or 0L if no such object exists. |
78 */ | 78 */ |
79 private final long graalEnv; | 79 private final long jvmciEnv; |
80 | 80 |
81 public CompilationTask(HotSpotResolvedJavaMethod method, int entryBCI, long graalEnv, int id, boolean installAsDefault) { | 81 public CompilationTask(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id, boolean installAsDefault) { |
82 this.method = method; | 82 this.method = method; |
83 this.entryBCI = entryBCI; | 83 this.entryBCI = entryBCI; |
84 this.id = id; | 84 this.id = id; |
85 this.graalEnv = graalEnv; | 85 this.jvmciEnv = jvmciEnv; |
86 this.installAsDefault = installAsDefault; | 86 this.installAsDefault = installAsDefault; |
87 } | 87 } |
88 | 88 |
89 public ResolvedJavaMethod getMethod() { | 89 public ResolvedJavaMethod getMethod() { |
90 return method; | 90 return method; |
124 | 124 |
125 // Log a compilation event. | 125 // Log a compilation event. |
126 CompilationEvent compilationEvent = eventProvider.newCompilationEvent(); | 126 CompilationEvent compilationEvent = eventProvider.newCompilationEvent(); |
127 | 127 |
128 // If there is already compiled code for this method on our level we simply return. | 128 // If there is already compiled code for this method on our level we simply return. |
129 // Graal compiles are always at the highest compile level, even in non-tiered mode so we | 129 // JVMCI compiles are always at the highest compile level, even in non-tiered mode so we |
130 // only need to check for that value. | 130 // only need to check for that value. |
131 if (method.hasCodeAtLevel(entryBCI, config.compilationLevelFullOptimization)) { | 131 if (method.hasCodeAtLevel(entryBCI, config.compilationLevelFullOptimization)) { |
132 return; | 132 return; |
133 } | 133 } |
134 | 134 |
167 final long allocatedBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024; | 167 final long allocatedBytes = (allocatedBytesAfter - allocatedBytesBefore) / 1024; |
168 | 168 |
169 if (printAfterCompilation) { | 169 if (printAfterCompilation) { |
170 TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dkB", stop - start, targetCodeSize, allocatedBytes)); | 170 TTY.println(getMethodDescription() + String.format(" | %4dms %5dB %5dkB", stop - start, targetCodeSize, allocatedBytes)); |
171 } else if (printCompilation) { | 171 } else if (printCompilation) { |
172 TTY.println(String.format("%-6d Graal %-70s %-45s %-50s | %4dms %5dB %5dkB", id, "", "", "", stop - start, targetCodeSize, allocatedBytes)); | 172 TTY.println(String.format("%-6d JVMCI %-70s %-45s %-50s | %4dms %5dB %5dkB", id, "", "", "", stop - start, targetCodeSize, allocatedBytes)); |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 try (DebugCloseable b = CodeInstallationTime.start()) { | 177 try (DebugCloseable b = CodeInstallationTime.start()) { |
225 compilationEvent.setCodeSize(codeSize); | 225 compilationEvent.setCodeSize(codeSize); |
226 compilationEvent.setInlinedBytes(compiledBytecodes); | 226 compilationEvent.setInlinedBytes(compiledBytecodes); |
227 compilationEvent.commit(); | 227 compilationEvent.commit(); |
228 } | 228 } |
229 | 229 |
230 if (graalEnv != 0) { | 230 if (jvmciEnv != 0) { |
231 long ctask = unsafe.getAddress(graalEnv + config.jvmciEnvTaskOffset); | 231 long ctask = unsafe.getAddress(jvmciEnv + config.jvmciEnvTaskOffset); |
232 assert ctask != 0L; | 232 assert ctask != 0L; |
233 unsafe.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes); | 233 unsafe.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes); |
234 } | 234 } |
235 long compilationTime = System.nanoTime() - startCompilationTime; | 235 long compilationTime = System.nanoTime() - startCompilationTime; |
236 if ((config.ciTime || config.ciTimeEach) && installedCode != null) { | 236 if ((config.ciTime || config.ciTimeEach) && installedCode != null) { |
246 */ | 246 */ |
247 private boolean mustRecordMethodInlining(HotSpotVMConfig config) { | 247 private boolean mustRecordMethodInlining(HotSpotVMConfig config) { |
248 if (config.ciTime || config.ciTimeEach || CompiledBytecodes.isEnabled()) { | 248 if (config.ciTime || config.ciTimeEach || CompiledBytecodes.isEnabled()) { |
249 return true; | 249 return true; |
250 } | 250 } |
251 if (graalEnv == 0 || unsafe.getByte(graalEnv + config.jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) { | 251 if (jvmciEnv == 0 || unsafe.getByte(jvmciEnv + config.jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) { |
252 return true; | 252 return true; |
253 } | 253 } |
254 return false; | 254 return false; |
255 } | 255 } |
256 | 256 |
257 private String getMethodDescription() { | 257 private String getMethodDescription() { |
258 return String.format("%-6d Graal %-70s %-45s %-50s %s", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature().toMethodDescriptor(), | 258 return String.format("%-6d JVMCI %-70s %-45s %-50s %s", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature().toMethodDescriptor(), |
259 entryBCI == Compiler.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") "); | 259 entryBCI == Compiler.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") "); |
260 } | 260 } |
261 | 261 |
262 private InstalledCode installMethod(final CompilationResult compResult) { | 262 private InstalledCode installMethod(final CompilationResult compResult) { |
263 final HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend().getCodeCache(); | 263 final HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend().getCodeCache(); |
264 InstalledCode installedCode = null; | 264 InstalledCode installedCode = null; |
265 try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) { | 265 try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(id), true), codeCache, method)) { |
266 installedCode = codeCache.installMethod(method, compResult, graalEnv, installAsDefault); | 266 installedCode = codeCache.installMethod(method, compResult, jvmciEnv, installAsDefault); |
267 } catch (Throwable e) { | 267 } catch (Throwable e) { |
268 throw Debug.handle(e); | 268 throw Debug.handle(e); |
269 } | 269 } |
270 return installedCode; | 270 return installedCode; |
271 } | 271 } |
276 } | 276 } |
277 | 277 |
278 /** | 278 /** |
279 * Compiles a method to machine code. | 279 * Compiles a method to machine code. |
280 */ | 280 */ |
281 public static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long graalEnv, int id) { | 281 public static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) { |
282 // Ensure a debug configuration for this thread is initialized | 282 // Ensure a debug configuration for this thread is initialized |
283 if (Debug.isEnabled() && DebugScope.getConfig() == null) { | 283 if (Debug.isEnabled() && DebugScope.getConfig() == null) { |
284 DebugEnvironment.initialize(TTY.cachedOut); | 284 DebugEnvironment.initialize(TTY.cachedOut); |
285 } | 285 } |
286 | 286 |
287 CompilationTask task = new CompilationTask(method, entryBCI, graalEnv, id, true); | 287 CompilationTask task = new CompilationTask(method, entryBCI, jvmciEnv, id, true); |
288 try (DebugConfigScope dcs = setConfig(new TopLevelDebugConfig())) { | 288 try (DebugConfigScope dcs = setConfig(new TopLevelDebugConfig())) { |
289 task.runCompilation(); | 289 task.runCompilation(); |
290 } | 290 } |
291 return; | 291 return; |
292 } | 292 } |