changeset 2292:175e7b4d7322

In CompilerImpl, instantiate C1XCompiler lazily (i.e. just before the first compilation) so that C1XOptions are already set during C1XCompiler's initialization
author Peter Hofer <peter.hofer@jku.at>
date Mon, 11 Apr 2011 17:12:01 +0200
parents 12846d31d7ec
children e3c42b8de67e
files c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java	Mon Apr 11 14:31:21 2011 +0200
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java	Mon Apr 11 17:12:01 2011 +0200
@@ -43,7 +43,11 @@
     private final VMEntries vmEntries;
     private final VMExits vmExits;
 
-    private final C1XCompiler compiler;
+    private C1XCompiler compiler;
+    private final HotSpotRuntime runtime;
+    private final RiXirGenerator generator;
+    private final HotSpotTarget target;
+    private final HotSpotRegisterConfig registerConfig;
 
     public static Compiler getInstance() {
         if (theInstance == null) {
@@ -159,22 +163,25 @@
         C1XOptions.InvokeSnippetAfterArguments = true;
         C1XOptions.StackShadowPages = config.stackShadowPages;
 
-        HotSpotRuntime runtime = new HotSpotRuntime(config, this);
-        HotSpotRegisterConfig registerConfig = runtime.globalStubRegConfig;
+        runtime = new HotSpotRuntime(config, this);
+        registerConfig = runtime.globalStubRegConfig;
 
         final int wordSize = 8;
         final int stackFrameAlignment = 16;
-        HotSpotTarget target = new HotSpotTarget(new AMD64(), true, wordSize, stackFrameAlignment, config.vmPageSize, wordSize, true);
+        target = new HotSpotTarget(new AMD64(), true, wordSize, stackFrameAlignment, config.vmPageSize, wordSize, true);
 
         RiXirGenerator generator = new HotSpotXirGenerator(config, target, registerConfig, this);
         if (Logger.ENABLED) {
             generator = LoggingProxy.getProxy(RiXirGenerator.class, generator);
         }
-        compiler = new C1XCompiler(runtime, target, generator, registerConfig);
+        this.generator = generator;
     }
 
     @Override
     public C1XCompiler getCompiler() {
+        if (compiler == null) {
+            compiler = new C1XCompiler(runtime, target, generator, registerConfig);
+        }
         return compiler;
     }