annotate c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/Compiler.java @ 1472:7641338cfc92

Small NPE fix. More detailed error in case of wrong bytecode in patching stub.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Thu, 25 Nov 2010 19:21:22 +0100
parents ef7761803480
children cb04e4217df0 fe69dec9a1ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
1 /*
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
3 *
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
5 * that is described in this document. In particular, and without limitation, these intellectual property
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
6 * rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
7 * more additional patents or pending patent applications in the U.S. and in other countries.
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
8 *
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
10 * Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
11 * supplements.
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
12 *
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
13 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
14 * registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
15 * are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
16 * U.S. and other countries.
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
17 *
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
18 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
19 * Company, Ltd.
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
20 */
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
21 package com.sun.hotspot.c1x;
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
22
1472
7641338cfc92 Small NPE fix. More detailed error in case of wrong bytecode in patching stub.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
23 import java.lang.management.*;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
24 import java.lang.reflect.Proxy;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
25 import java.net.*;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
26
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
27 import com.sun.c1x.*;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
28 import com.sun.c1x.target.amd64.*;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
29 import com.sun.cri.ci.*;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
30 import com.sun.cri.ri.*;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
31 import com.sun.cri.xir.*;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
32 import com.sun.hotspot.c1x.logging.*;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
33 import com.sun.hotspot.c1x.server.CompilationServer.ReplacingInputStream;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
34 import com.sun.hotspot.c1x.server.CompilationServer.ReplacingOutputStream;
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
35
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
36 /**
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
37 * Singleton class holding the instance of the C1XCompiler.
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
38 *
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
39 * @author Thomas Wuerthinger, Lukas Stadler
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
40 */
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
41 public final class Compiler {
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
42
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
43 private static Compiler theInstance;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
44
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
45 public static Compiler getInstance() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
46 if (theInstance == null) {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
47 theInstance = new Compiler();
1438
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
48 Runtime.getRuntime().addShutdownHook(new ShutdownThread());
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
49 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
50 return theInstance;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
51 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
52
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
53 private static VMEntries vmEntries;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
54
1438
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
55
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
56 public static class ShutdownThread extends Thread {
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
57 @Override
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
58 public void run() {
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
59 VMExitsNative.compileMethods = false;
1465
2c754f3a2722 Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1458
diff changeset
60 if (C1XOptions.PrintMetrics) {
2c754f3a2722 Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1458
diff changeset
61 C1XMetrics.print();
2c754f3a2722 Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1458
diff changeset
62 }
1438
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
63 if (C1XOptions.PrintTimers) {
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
64 C1XTimers.print();
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
65 }
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
66 }
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
67 }
a7a0ef3c6858 Added timing printout on VM shutdown.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
68
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
69 public static VMExits initializeServer(VMEntries entries) {
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
70 if (Logger.ENABLED) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
71 vmEntries = LoggingProxy.getProxy(VMEntries.class, entries);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
72 vmExits = LoggingProxy.getProxy(VMExits.class, new VMExitsNative());
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
73 } else {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
74 vmEntries = entries;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
75 vmExits = new VMExitsNative();
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
76 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
77 return vmExits;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
78 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
79
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
80 private static VMEntries initializeClient(VMExits exits) {
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
81 vmEntries = new VMEntriesNative();
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
82 vmExits = exits;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
83 return vmEntries;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
84 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
85
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
86 public static VMEntries getVMEntries() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
87 if (vmEntries == null) {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
88 try {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
89 vmEntries = new VMEntriesNative();
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
90 if (CountingProxy.ENABLED) {
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
91 vmEntries = CountingProxy.getProxy(VMEntries.class, vmEntries);
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
92 }
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
93 if (Logger.ENABLED) {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
94 vmEntries = LoggingProxy.getProxy(VMEntries.class, vmEntries);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
95 }
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
96 } catch (Throwable t) {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
97 t.printStackTrace();
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
98 }
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
99 }
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
100 return vmEntries;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
101 }
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
102
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
103 private static VMExits vmExits;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
104
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
105 public static VMExits getVMExits() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
106 if (vmExits == null) {
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
107 String remote = System.getProperty("c1x.remote");
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
108 assert theInstance == null;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
109 assert vmEntries == null;
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
110 try {
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
111 if (remote != null) {
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
112 System.out.println("C1X compiler started in client/server mode, connection to server " + remote);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
113 Socket socket = new Socket(remote, 1199);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
114 ReplacingOutputStream output = new ReplacingOutputStream(socket.getOutputStream());
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
115 ReplacingInputStream input = new ReplacingInputStream(socket.getInputStream());
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
116
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
117 InvocationSocket invocation = new InvocationSocket(output, input);
1437
9e5e83ca2259 Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
118 VMExits exits = (VMExits) Proxy.newProxyInstance(VMExits.class.getClassLoader(), new Class<?>[] {VMExits.class}, invocation);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
119 VMEntries entries = Compiler.initializeClient(exits);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
120 invocation.setDelegate(entries);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
121 } else {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
122 vmExits = new VMExitsNative();
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
123 if (CountingProxy.ENABLED) {
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
124 vmExits = CountingProxy.getProxy(VMExits.class, vmExits);
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
125 }
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
126 if (Logger.ENABLED) {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
127 vmExits = LoggingProxy.getProxy(VMExits.class, vmExits);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
128 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
129 }
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
130 } catch (Throwable t) {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
131 t.printStackTrace();
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
132 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
133 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
134 return vmExits;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
135 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
136
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
137 private final CiCompiler compiler;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
138 private final HotSpotVMConfig config;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
139 private final HotSpotRuntime runtime;
1455
43a93774d24f Syncing changes with C1X.
Doug Simon <doug.simon@oracle.com>
parents: 1444
diff changeset
140 private final HotSpotRegisterConfig registerConfig;
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
141 private final CiTarget target;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
142 private final RiXirGenerator generator;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
143
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
144 private Compiler() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
145 config = getVMEntries().getConfiguration();
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
146 config.check();
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
147
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
148 runtime = new HotSpotRuntime(config);
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
149 final int wordSize = 8;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
150 final int stackFrameAlignment = 16;
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
151 registerConfig = runtime.globalStubRegConfig;
1455
43a93774d24f Syncing changes with C1X.
Doug Simon <doug.simon@oracle.com>
parents: 1444
diff changeset
152 target = new HotSpotTarget(new AMD64(), true, wordSize, wordSize, wordSize, stackFrameAlignment, config.vmPageSize, wordSize, wordSize, config.codeEntryAlignment, true);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
153
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
154 if (Logger.ENABLED) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
155 generator = LoggingProxy.getProxy(RiXirGenerator.class, new HotSpotXirGenerator(config, target, registerConfig));
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
156 } else {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
157 generator = new HotSpotXirGenerator(config, target, registerConfig);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
158 }
1439
d0c8d3a2a7e8 Modified domake script to use (and require) JRE7 environment variable for find the base of a JRE 7 installation. This script no also ensures that $JRE7/lib/amd64/jvm.cfg has the right value for '-client'.
Doug Simon <doug.simon@oracle.com>
parents: 1438
diff changeset
159 compiler = new C1XCompiler(runtime, target, generator, registerConfig);
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
160
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
161 // these options are important - c1x4hotspot will not generate correct code without them
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
162 C1XOptions.GenSpecialDivChecks = true;
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
163 C1XOptions.NullCheckUniquePc = true;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
164 C1XOptions.invokeinterfaceTemplatePos = true;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
165 C1XOptions.StackShadowPages = config.stackShadowPages;
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
166 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
167
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
168 public CiCompiler getCompiler() {
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
169 return compiler;
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
170 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
171
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
172 public HotSpotVMConfig getConfig() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
173 return config;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
174 }
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
175
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
176 public HotSpotRuntime getRuntime() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
177 return runtime;
1420
44efca8a02d6 reformatting similar to other maxine projects (tabs, etc.)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
178 }
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
179
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
180 public RiRegisterConfig getRegisterConfig() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
181 return registerConfig;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
182 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
183
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
184 public CiTarget getTarget() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
185 return target;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
186 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
187
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
188 public RiXirGenerator getGenerator() {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
189 return generator;
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
190 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1420
diff changeset
191
1416
1b41af477605 Added HotSpotVM project Java source files.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
192 }