< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/CompileTheWorld.java

Print this page




  85 import org.graalvm.compiler.debug.TTY;
  86 import org.graalvm.compiler.debug.internal.DebugScope;
  87 import org.graalvm.compiler.debug.internal.MemUseTrackerImpl;
  88 import org.graalvm.compiler.options.OptionDescriptor;
  89 import org.graalvm.compiler.options.OptionDescriptors;
  90 import org.graalvm.compiler.options.OptionValue;
  91 import org.graalvm.compiler.options.OptionValue.OverrideScope;
  92 import org.graalvm.compiler.options.OptionsParser;
  93 import org.graalvm.compiler.options.OptionsParser.OptionConsumer;
  94 
  95 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
  96 import jdk.vm.ci.hotspot.HotSpotInstalledCode;
  97 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
  98 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
  99 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 100 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 101 import jdk.vm.ci.meta.ConstantPool;
 102 import jdk.vm.ci.meta.MetaAccessProvider;
 103 import jdk.vm.ci.runtime.JVMCI;
 104 import jdk.vm.ci.runtime.JVMCICompiler;
 105 import jdk.vm.ci.services.Services;
 106 
 107 /**
 108  * This class implements compile-the-world functionality with JVMCI.
 109  */
 110 public final class CompileTheWorld {
 111 
 112     /**
 113      * Magic token to denote that JDK classes are to be compiled. If {@link Util#Java8OrEarlier},
 114      * then the classes in {@code rt.jar} are compiled. Otherwise the classes in {@code
 115      * <java.home>/lib/modules} are compiled.
 116      */
 117     public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
 118 
 119     /**
 120      * A mechanism for overriding JVMCI options that affect compilation. A {@link Config} object
 121      * should be used in a try-with-resources statement to ensure overriding of options is scoped
 122      * properly. For example:
 123      *
 124      * <pre>
 125      *     Config config = ...;


 768             println(verbose || methodFilters != null,
 769                             String.format("CompileTheWorld (%d) : Skipping huge method %s (use -XX:-DontCompileHugeMethods or -XX:HugeMethodLimit=%d to include it)", classFileCounter,
 770                                             javaMethod.format("%H.%n(%p):%r"),
 771                                             javaMethod.getCodeSize()));
 772             return false;
 773         }
 774         // Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
 775         if (!javaMethod.canBeInlined()) {
 776             return false;
 777         }
 778         // Skip @Snippets for now
 779         for (Annotation annotation : javaMethod.getAnnotations()) {
 780             if (annotation.annotationType().equals(Snippet.class)) {
 781                 return false;
 782             }
 783         }
 784         return true;
 785     }
 786 
 787     public static void main(String[] args) throws Throwable {
 788         Services.exportJVMCITo(CompileTheWorld.class);
 789         HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) HotSpotJVMCIRuntime.runtime().getCompiler();
 790         compiler.compileTheWorld();
 791     }
 792 }


  85 import org.graalvm.compiler.debug.TTY;
  86 import org.graalvm.compiler.debug.internal.DebugScope;
  87 import org.graalvm.compiler.debug.internal.MemUseTrackerImpl;
  88 import org.graalvm.compiler.options.OptionDescriptor;
  89 import org.graalvm.compiler.options.OptionDescriptors;
  90 import org.graalvm.compiler.options.OptionValue;
  91 import org.graalvm.compiler.options.OptionValue.OverrideScope;
  92 import org.graalvm.compiler.options.OptionsParser;
  93 import org.graalvm.compiler.options.OptionsParser.OptionConsumer;
  94 
  95 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
  96 import jdk.vm.ci.hotspot.HotSpotInstalledCode;
  97 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
  98 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
  99 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 100 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 101 import jdk.vm.ci.meta.ConstantPool;
 102 import jdk.vm.ci.meta.MetaAccessProvider;
 103 import jdk.vm.ci.runtime.JVMCI;
 104 import jdk.vm.ci.runtime.JVMCICompiler;

 105 
 106 /**
 107  * This class implements compile-the-world functionality with JVMCI.
 108  */
 109 public final class CompileTheWorld {
 110 
 111     /**
 112      * Magic token to denote that JDK classes are to be compiled. If {@link Util#Java8OrEarlier},
 113      * then the classes in {@code rt.jar} are compiled. Otherwise the classes in {@code
 114      * <java.home>/lib/modules} are compiled.
 115      */
 116     public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
 117 
 118     /**
 119      * A mechanism for overriding JVMCI options that affect compilation. A {@link Config} object
 120      * should be used in a try-with-resources statement to ensure overriding of options is scoped
 121      * properly. For example:
 122      *
 123      * <pre>
 124      *     Config config = ...;


 767             println(verbose || methodFilters != null,
 768                             String.format("CompileTheWorld (%d) : Skipping huge method %s (use -XX:-DontCompileHugeMethods or -XX:HugeMethodLimit=%d to include it)", classFileCounter,
 769                                             javaMethod.format("%H.%n(%p):%r"),
 770                                             javaMethod.getCodeSize()));
 771             return false;
 772         }
 773         // Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
 774         if (!javaMethod.canBeInlined()) {
 775             return false;
 776         }
 777         // Skip @Snippets for now
 778         for (Annotation annotation : javaMethod.getAnnotations()) {
 779             if (annotation.annotationType().equals(Snippet.class)) {
 780                 return false;
 781             }
 782         }
 783         return true;
 784     }
 785 
 786     public static void main(String[] args) throws Throwable {

 787         HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) HotSpotJVMCIRuntime.runtime().getCompiler();
 788         compiler.compileTheWorld();
 789     }
 790 }
< prev index next >