comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java @ 1416:1b41af477605

Added HotSpotVM project Java source files.
author Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
date Wed, 23 Jun 2010 16:36:58 +0200
parents
children 55ac38887415
comparison
equal deleted inserted replaced
1415:712c7ff1afc1 1416:1b41af477605
1 /*
2 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
3 *
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product
5 * that is described in this document. In particular, and without limitation, these intellectual property
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or
7 * more additional patents or pending patent applications in the U.S. and in other countries.
8 *
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its
11 * supplements.
12 *
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the
16 * U.S. and other countries.
17 *
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open
19 * Company, Ltd.
20 */
21 package com.sun.hotspot.c1x;
22
23 import com.sun.c1x.C1XCompiler;
24 import com.sun.c1x.C1XOptions;
25 import com.sun.c1x.target.amd64.AMD64;
26 import com.sun.cri.ci.CiCompiler;
27 import com.sun.cri.ci.CiTarget;
28 import com.sun.cri.ri.RiRegisterConfig;
29 import com.sun.cri.xir.RiXirGenerator;
30
31 /**
32 *
33 * @author Thomas Wuerthinger
34 *
35 * Singleton class holding the instance of the C1XCompiler.
36 *
37 */
38 public class Compiler {
39
40 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
54 final HotSpotRuntime runtime = new HotSpotRuntime();
55 final RiXirGenerator generator = new HotSpotXirGenerator();
56 final int wordSize = 8;
57 final int stackFrameAlignment = 8;
58 final int pageSize = 1024;
59 final RiRegisterConfig config = new HotSpotRegisterConfig();
60 final CiTarget target = new CiTarget(new AMD64(), config, true, wordSize, wordSize, wordSize, stackFrameAlignment, pageSize, wordSize, wordSize, 16);
61 final CiCompiler compiler = new C1XCompiler(runtime, target, generator);
62
63 C1XOptions.setOptimizationLevel(3);
64 C1XOptions.TraceBytecodeParserLevel = 4;
65 C1XOptions.PrintCFGToFile = false;
66 C1XOptions.PrintAssembly = false;//true;
67 C1XOptions.PrintCompilation = true;
68 return compiler;
69
70 }
71 }