comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java @ 1420:44efca8a02d6

reformatting similar to other maxine projects (tabs, etc.)
author Lukas Stadler <lukas.stadler@oracle.com>
date Tue, 13 Jul 2010 11:47:55 -0700
parents 7bf6a77b9c5a
children 6223633ce7dd
comparison
equal deleted inserted replaced
1419:7bf6a77b9c5a 1420:44efca8a02d6
1 /* 1 /*
2 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. 2 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
3 * 3 *
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product 4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is
5 * that is described in this document. In particular, and without limitation, these intellectual property 5 * described in this document. In particular, and without limitation, these intellectual property rights may include one
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or 6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent
7 * more additional patents or pending patent applications in the U.S. and in other countries. 7 * applications in the U.S. and in other countries.
8 * 8 *
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun 9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its 10 * license agreement and applicable provisions of the FAR and its supplements.
11 * supplements.
12 * 11 *
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or 12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks 13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the 14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries.
16 * U.S. and other countries.
17 * 15 *
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open 16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
19 * Company, Ltd.
20 */ 17 */
21 package com.sun.hotspot.c1x; 18 package com.sun.hotspot.c1x;
22 19
23 import com.sun.c1x.C1XCompiler; 20 import com.sun.c1x.C1XCompiler;
24 import com.sun.c1x.C1XOptions; 21 import com.sun.c1x.C1XOptions;
27 import com.sun.cri.ci.CiTarget; 24 import com.sun.cri.ci.CiTarget;
28 import com.sun.cri.ri.RiRegisterConfig; 25 import com.sun.cri.ri.RiRegisterConfig;
29 import com.sun.cri.xir.RiXirGenerator; 26 import com.sun.cri.xir.RiXirGenerator;
30 27
31 /** 28 /**
32 * 29 *
33 * @author Thomas Wuerthinger 30 * @author Thomas Wuerthinger
34 * 31 *
35 * Singleton class holding the instance of the C1XCompiler. 32 * Singleton class holding the instance of the C1XCompiler.
36 * 33 *
37 */ 34 */
38 public class Compiler { 35 public class Compiler {
39 36
40 private static CiCompiler compiler; 37 private static CiCompiler compiler;
41
42 public static CiCompiler getCompiler() {
43
44 if (compiler == null) {
45 compiler = createCompiler();
46 }
47
48 return compiler;
49 }
50
51
52 private static CiCompiler createCompiler() {
53 38
54 final HotSpotVMConfig config = VMEntries.getConfiguration(); 39 public static CiCompiler getCompiler() {
55 final HotSpotRuntime runtime = new HotSpotRuntime(config); 40
56 final RiXirGenerator generator = new HotSpotXirGenerator(config); 41 if (compiler == null) {
57 final int wordSize = 8; 42 compiler = createCompiler();
58 final int stackFrameAlignment = 8; 43 }
59 final int pageSize = 1024; 44
60 final RiRegisterConfig registerConfig = new HotSpotRegisterConfig(config); 45 return compiler;
46 }
47
48 private static CiCompiler createCompiler() {
49
50 final HotSpotVMConfig config = VMEntries.getConfiguration();
51 final HotSpotRuntime runtime = new HotSpotRuntime(config);
52 final RiXirGenerator generator = new HotSpotXirGenerator(config);
53 final int wordSize = 8;
54 final int stackFrameAlignment = 8;
55 final int pageSize = 1024;
56 final RiRegisterConfig registerConfig = new HotSpotRegisterConfig(config);
61 final CiTarget target = new CiTarget(new AMD64(), registerConfig, true, wordSize, wordSize, wordSize, stackFrameAlignment, pageSize, wordSize, wordSize, 16); 57 final CiTarget target = new CiTarget(new AMD64(), registerConfig, true, wordSize, wordSize, wordSize, stackFrameAlignment, pageSize, wordSize, wordSize, 16);
62 final CiCompiler compiler = new C1XCompiler(runtime, target, generator); 58 final CiCompiler compiler = new C1XCompiler(runtime, target, generator);
63 59
64 C1XOptions.setOptimizationLevel(3); 60 C1XOptions.setOptimizationLevel(3);
65 C1XOptions.TraceBytecodeParserLevel = 4; 61 C1XOptions.TraceBytecodeParserLevel = 4;
66 C1XOptions.PrintCFGToFile = false; 62 C1XOptions.PrintCFGToFile = false;
67 C1XOptions.PrintAssembly = false;//true; 63 C1XOptions.PrintAssembly = false;// true;
68 C1XOptions.PrintCompilation = true; 64 C1XOptions.PrintCompilation = true;
69 return compiler; 65 return compiler;
70 66
71 } 67 }
72 } 68 }