comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/CompilerImpl.java @ 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 8c426c2891c8
children e3c42b8de67e
comparison
equal deleted inserted replaced
2291:12846d31d7ec 2292:175e7b4d7322
41 private static boolean PrintGCStats = false; 41 private static boolean PrintGCStats = false;
42 42
43 private final VMEntries vmEntries; 43 private final VMEntries vmEntries;
44 private final VMExits vmExits; 44 private final VMExits vmExits;
45 45
46 private final C1XCompiler compiler; 46 private C1XCompiler compiler;
47 private final HotSpotRuntime runtime;
48 private final RiXirGenerator generator;
49 private final HotSpotTarget target;
50 private final HotSpotRegisterConfig registerConfig;
47 51
48 public static Compiler getInstance() { 52 public static Compiler getInstance() {
49 if (theInstance == null) { 53 if (theInstance == null) {
50 // remote compilation (will not create a C1XCompiler) 54 // remote compilation (will not create a C1XCompiler)
51 String remote = System.getProperty("c1x.remote"); 55 String remote = System.getProperty("c1x.remote");
157 C1XOptions.GenSpecialDivChecks = true; 161 C1XOptions.GenSpecialDivChecks = true;
158 C1XOptions.NullCheckUniquePc = true; 162 C1XOptions.NullCheckUniquePc = true;
159 C1XOptions.InvokeSnippetAfterArguments = true; 163 C1XOptions.InvokeSnippetAfterArguments = true;
160 C1XOptions.StackShadowPages = config.stackShadowPages; 164 C1XOptions.StackShadowPages = config.stackShadowPages;
161 165
162 HotSpotRuntime runtime = new HotSpotRuntime(config, this); 166 runtime = new HotSpotRuntime(config, this);
163 HotSpotRegisterConfig registerConfig = runtime.globalStubRegConfig; 167 registerConfig = runtime.globalStubRegConfig;
164 168
165 final int wordSize = 8; 169 final int wordSize = 8;
166 final int stackFrameAlignment = 16; 170 final int stackFrameAlignment = 16;
167 HotSpotTarget target = new HotSpotTarget(new AMD64(), true, wordSize, stackFrameAlignment, config.vmPageSize, wordSize, true); 171 target = new HotSpotTarget(new AMD64(), true, wordSize, stackFrameAlignment, config.vmPageSize, wordSize, true);
168 172
169 RiXirGenerator generator = new HotSpotXirGenerator(config, target, registerConfig, this); 173 RiXirGenerator generator = new HotSpotXirGenerator(config, target, registerConfig, this);
170 if (Logger.ENABLED) { 174 if (Logger.ENABLED) {
171 generator = LoggingProxy.getProxy(RiXirGenerator.class, generator); 175 generator = LoggingProxy.getProxy(RiXirGenerator.class, generator);
172 } 176 }
173 compiler = new C1XCompiler(runtime, target, generator, registerConfig); 177 this.generator = generator;
174 } 178 }
175 179
176 @Override 180 @Override
177 public C1XCompiler getCompiler() { 181 public C1XCompiler getCompiler() {
182 if (compiler == null) {
183 compiler = new C1XCompiler(runtime, target, generator, registerConfig);
184 }
178 return compiler; 185 return compiler;
179 } 186 }
180 187
181 } 188 }