comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java @ 14107:800057208a2c

enable C1 + Graal tiered
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 06 Mar 2014 17:11:39 -0800
parents f62c770c22be
children fd7fcd2d2072
comparison
equal deleted inserted replaced
14106:ca37cb080dad 14107:800057208a2c
36 import com.oracle.graal.api.meta.ProfilingInfo.TriState; 36 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
37 import com.oracle.graal.debug.*; 37 import com.oracle.graal.debug.*;
38 import com.oracle.graal.graph.*; 38 import com.oracle.graal.graph.*;
39 import com.oracle.graal.hotspot.*; 39 import com.oracle.graal.hotspot.*;
40 import com.oracle.graal.hotspot.debug.*; 40 import com.oracle.graal.hotspot.debug.*;
41 import com.oracle.graal.nodes.*;
41 42
42 /** 43 /**
43 * Implementation of {@link JavaMethod} for resolved HotSpot methods. 44 * Implementation of {@link JavaMethod} for resolved HotSpot methods.
44 */ 45 */
45 public final class HotSpotResolvedJavaMethod extends HotSpotMethod implements ResolvedJavaMethod { 46 public final class HotSpotResolvedJavaMethod extends HotSpotMethod implements ResolvedJavaMethod {
344 345
345 public int getCompiledCodeSize() { 346 public int getCompiledCodeSize() {
346 return runtime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); 347 return runtime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod);
347 } 348 }
348 349
350 /**
351 * Gets the value of {@code Method::_code}.
352 *
353 * @return the value of {@code Method::_code}
354 */
355 private long getCompiledCode() {
356 HotSpotVMConfig config = runtime().getConfig();
357 return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset);
358 }
359
360 /**
361 * Returns whether this method has compiled code.
362 *
363 * @return true if this method has compiled code, false otherwise
364 */
349 public boolean hasCompiledCode() { 365 public boolean hasCompiledCode() {
350 return getCompiledCodeSize() > 0; 366 return getCompiledCode() != 0L;
367 }
368
369 /**
370 * Gets the compilation level of the currently installed code for this method.
371 *
372 * @return compilation level
373 */
374 public boolean hasCompiledCodeAtLevel(int level) {
375 long compiledCode = getCompiledCode();
376 if (compiledCode != 0) {
377 return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level;
378 }
379 return false;
351 } 380 }
352 381
353 private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter"); 382 private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter");
354 383
355 @Override 384 @Override
679 } 708 }
680 709
681 private long getAccessFlagsAddress() { 710 private long getAccessFlagsAddress() {
682 return metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset; 711 return metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset;
683 } 712 }
713
714 public boolean hasCodeAtLevel(int entryBCI, int level) {
715 if (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI) {
716 return hasCompiledCodeAtLevel(level);
717 }
718 return runtime().getCompilerToVM().hasCompiledCodeForOSR(metaspaceMethod, entryBCI, level);
719 }
684 } 720 }