< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java

Print this page




  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 static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
  26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  27 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
  28 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
  29 
  30 import java.lang.annotation.Annotation;
  31 import java.lang.reflect.Executable;
  32 import java.lang.reflect.InvocationTargetException;
  33 import java.lang.reflect.Method;
  34 import java.lang.reflect.Modifier;
  35 import java.lang.reflect.Type;
  36 import java.util.HashMap;
  37 import java.util.Map;
  38 
  39 import jdk.vm.ci.common.JVMCIError;

  40 import jdk.vm.ci.meta.Constant;
  41 import jdk.vm.ci.meta.ConstantPool;
  42 import jdk.vm.ci.meta.DefaultProfilingInfo;
  43 import jdk.vm.ci.meta.ExceptionHandler;
  44 import jdk.vm.ci.meta.JavaConstant;
  45 import jdk.vm.ci.meta.JavaMethod;
  46 import jdk.vm.ci.meta.JavaType;
  47 import jdk.vm.ci.meta.LineNumberTable;
  48 import jdk.vm.ci.meta.LineNumberTableImpl;
  49 import jdk.vm.ci.meta.Local;
  50 import jdk.vm.ci.meta.LocalImpl;
  51 import jdk.vm.ci.meta.LocalVariableTable;
  52 import jdk.vm.ci.meta.LocalVariableTableImpl;
  53 import jdk.vm.ci.meta.ModifiersProvider;
  54 import jdk.vm.ci.meta.ProfilingInfo;
  55 import jdk.vm.ci.meta.ResolvedJavaMethod;
  56 import jdk.vm.ci.meta.ResolvedJavaType;
  57 import jdk.vm.ci.meta.Signature;
  58 import jdk.vm.ci.meta.SpeculationLog;
  59 import jdk.vm.ci.meta.TriState;


 400      * Returns whether this method has compiled code.
 401      *
 402      * @return true if this method has compiled code, false otherwise
 403      */
 404     public boolean hasCompiledCode() {
 405         return getCompiledCode() != 0L;
 406     }
 407 
 408     /**
 409      * @param level
 410      * @return true if the currently installed code was generated at {@code level}.
 411      */
 412     public boolean hasCompiledCodeAtLevel(int level) {
 413         long compiledCode = getCompiledCode();
 414         if (compiledCode != 0) {
 415             return UNSAFE.getInt(compiledCode + config().nmethodCompLevelOffset) == level;
 416         }
 417         return false;
 418     }
 419 
 420     private static final String TraceMethodDataFilter = System.getProperty("jvmci.traceMethodDataFilter");
 421 
 422     @Override
 423     public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) {
 424         ProfilingInfo info;
 425 
 426         if (methodData == null) {
 427             long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + config().methodDataOffset);
 428             if (metaspaceMethodData != 0) {
 429                 methodData = new HotSpotMethodData(metaspaceMethodData, this);
 430                 if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) {
 431                     System.out.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
 432                     System.out.println(methodData.toString());
 433                 }
 434             }
 435         }
 436 
 437         if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) {
 438             // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in
 439             // case of a deoptimization.
 440             info = DefaultProfilingInfo.get(TriState.FALSE);




  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 static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
  26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  27 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
  28 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
  29 
  30 import java.lang.annotation.Annotation;
  31 import java.lang.reflect.Executable;
  32 import java.lang.reflect.InvocationTargetException;
  33 import java.lang.reflect.Method;
  34 import java.lang.reflect.Modifier;
  35 import java.lang.reflect.Type;
  36 import java.util.HashMap;
  37 import java.util.Map;
  38 
  39 import jdk.vm.ci.common.JVMCIError;
  40 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
  41 import jdk.vm.ci.meta.Constant;
  42 import jdk.vm.ci.meta.ConstantPool;
  43 import jdk.vm.ci.meta.DefaultProfilingInfo;
  44 import jdk.vm.ci.meta.ExceptionHandler;
  45 import jdk.vm.ci.meta.JavaConstant;
  46 import jdk.vm.ci.meta.JavaMethod;
  47 import jdk.vm.ci.meta.JavaType;
  48 import jdk.vm.ci.meta.LineNumberTable;
  49 import jdk.vm.ci.meta.LineNumberTableImpl;
  50 import jdk.vm.ci.meta.Local;
  51 import jdk.vm.ci.meta.LocalImpl;
  52 import jdk.vm.ci.meta.LocalVariableTable;
  53 import jdk.vm.ci.meta.LocalVariableTableImpl;
  54 import jdk.vm.ci.meta.ModifiersProvider;
  55 import jdk.vm.ci.meta.ProfilingInfo;
  56 import jdk.vm.ci.meta.ResolvedJavaMethod;
  57 import jdk.vm.ci.meta.ResolvedJavaType;
  58 import jdk.vm.ci.meta.Signature;
  59 import jdk.vm.ci.meta.SpeculationLog;
  60 import jdk.vm.ci.meta.TriState;


 401      * Returns whether this method has compiled code.
 402      *
 403      * @return true if this method has compiled code, false otherwise
 404      */
 405     public boolean hasCompiledCode() {
 406         return getCompiledCode() != 0L;
 407     }
 408 
 409     /**
 410      * @param level
 411      * @return true if the currently installed code was generated at {@code level}.
 412      */
 413     public boolean hasCompiledCodeAtLevel(int level) {
 414         long compiledCode = getCompiledCode();
 415         if (compiledCode != 0) {
 416             return UNSAFE.getInt(compiledCode + config().nmethodCompLevelOffset) == level;
 417         }
 418         return false;
 419     }
 420 
 421     private static final String TraceMethodDataFilter = HotSpotJVMCIRuntime.getProperty(Option.TraceMethodDataFilter, null);
 422 
 423     @Override
 424     public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) {
 425         ProfilingInfo info;
 426 
 427         if (methodData == null) {
 428             long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + config().methodDataOffset);
 429             if (metaspaceMethodData != 0) {
 430                 methodData = new HotSpotMethodData(metaspaceMethodData, this);
 431                 if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) {
 432                     System.out.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
 433                     System.out.println(methodData.toString());
 434                 }
 435             }
 436         }
 437 
 438         if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) {
 439             // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in
 440             // case of a deoptimization.
 441             info = DefaultProfilingInfo.get(TriState.FALSE);


< prev index next >