Mercurial > hg > truffle
annotate c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/server/CompilationServer.java @ 2284:569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 07 Apr 2011 15:32:25 +0200 |
parents | 52bb06250d35 |
children | 762de4b26788 |
rev | line source |
---|---|
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.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:
1423
diff
changeset
|
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.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:
1423
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:
1423
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:
1423
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:
1423
diff
changeset
|
7 * more additional patents or pending patent applications in the U.S. and in other countries. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.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:
1423
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:
1423
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:
1423
diff
changeset
|
11 * supplements. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.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:
1423
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:
1423
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:
1423
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:
1423
diff
changeset
|
16 * U.S. and other countries. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.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:
1423
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:
1423
diff
changeset
|
19 * Company, Ltd. |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
20 */ |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
21 package com.sun.hotspot.c1x.server; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
22 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
23 import java.io.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
24 import java.lang.reflect.Proxy; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
25 import java.net.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
26 import java.rmi.registry.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
27 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
28 import javax.net.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
29 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
30 import com.sun.cri.ci.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
31 import com.sun.hotspot.c1x.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
32 import com.sun.hotspot.c1x.Compiler; |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
33 import com.sun.hotspot.c1x.InvocationSocket.DelegateCallback; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
34 import com.sun.hotspot.c1x.logging.*; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
35 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
36 /** |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
37 * Server side of the client/server compilation model. |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
38 * |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
39 * @author Lukas Stadler |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
40 */ |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
41 public class CompilationServer { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
42 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
43 private Registry registry; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
44 private ServerSocket serverSocket; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
45 private Socket socket; |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
46 |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
47 private ReplacingOutputStream output; |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
48 private ReplacingInputStream input; |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
49 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
50 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
51 public static void main(String[] args) throws Exception { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
52 new CompilationServer().run(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
53 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
54 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
55 public static class Container implements Serializable { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
56 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
57 public final Class<?> clazz; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
58 public final Object[] values; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
59 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
60 public Container(Class<?> clazz, Object... values) { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
61 this.clazz = clazz; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
62 this.values = values; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
63 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
64 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
65 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
66 /** |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
67 * Replaces certain cir objects that cannot easily be made Serializable. |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
68 */ |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
69 public static class ReplacingOutputStream extends ObjectOutputStream { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
70 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
71 public ReplacingOutputStream(OutputStream out) throws IOException { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
72 super(out); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
73 enableReplaceObject(true); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
74 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
75 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
76 @Override |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
77 protected Object replaceObject(Object obj) throws IOException { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
78 Class<? extends Object> clazz = obj.getClass(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
79 if (clazz == CiConstant.class) { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
80 CiConstant o = (CiConstant) obj; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
81 return new Container(clazz, o.kind, o.boxedValue()); |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
82 } else if (obj == CiValue.IllegalValue) { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
83 return new Container(CiValue.class); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
84 } else if (obj instanceof Compiler) { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
85 return new Container(Compiler.class); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
86 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
87 return obj; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
88 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
89 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
90 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
91 /** |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
92 * Replaces certain cir objects that cannot easily be made Serializable. |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
93 */ |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
94 public static class ReplacingInputStream extends ObjectInputStream { |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
95 private Compiler compiler; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
96 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
97 public ReplacingInputStream(InputStream in) throws IOException { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
98 super(in); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
99 enableResolveObject(true); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
100 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
101 |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
102 public void setCompiler(Compiler compiler) { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
103 this.compiler = compiler; |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
104 } |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
105 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
106 @Override |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
107 protected Object resolveObject(Object obj) throws IOException { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
108 if (obj instanceof Container) { |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1423
diff
changeset
|
109 Container c = (Container) obj; |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1423
diff
changeset
|
110 if (c.clazz == CiConstant.class) { |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
111 return CiConstant.forBoxed((CiKind) c.values[0], c.values[1]); |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
112 } else if (c.clazz == CiValue.class) { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
113 return CiValue.IllegalValue; |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
114 } else if (c.clazz == Compiler.class) { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
115 assert compiler != null; |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
116 return compiler; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
117 } |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
118 throw new RuntimeException("unexpected container class: " + c.clazz); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
119 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
120 return obj; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
121 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
122 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
123 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
124 private void run() throws IOException, ClassNotFoundException { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
125 serverSocket = ServerSocketFactory.getDefault().createServerSocket(1199); |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
126 do { |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
127 try { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
128 Logger.log("Compilation server ready, waiting for client to connect..."); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
129 socket = serverSocket.accept(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
130 Logger.log("Connected to " + socket.getRemoteSocketAddress()); |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
131 |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
132 output = new ReplacingOutputStream(new BufferedOutputStream(socket.getOutputStream())); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
133 // required, because creating an ObjectOutputStream writes a header, but doesn't flush the stream |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
134 output.flush(); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
135 input = new ReplacingInputStream(new BufferedInputStream(socket.getInputStream())); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
136 |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
137 final InvocationSocket invocation = new InvocationSocket(output, input); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
138 invocation.setDelegateCallback( new DelegateCallback() { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
139 public Object getDelegate() { |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
140 VMEntries entries = (VMEntries) Proxy.newProxyInstance(VMEntries.class.getClassLoader(), new Class<?>[] {VMEntries.class}, invocation); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
141 Compiler compiler = Compiler.initializeServer(entries); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
142 input.setCompiler(compiler); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
143 return compiler.getVMExits(); |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
144 } |
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
145 }); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
146 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
147 invocation.waitForResult(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
148 } catch (IOException e) { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
149 e.printStackTrace(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
150 socket.close(); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
151 } |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
1469
diff
changeset
|
152 } while (false); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
153 } |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1423
diff
changeset
|
154 } |