comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java @ 2296:34354e2e40a3

cleanups and client/server fixes: * explicit init of CompilerImpl * CompilationServer terminates without EOFException * moved C1XOptions initialization code into separate class (static initializer changed to static method) * added ConnectionObserver to CompilationServer
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 13 Apr 2011 14:40:13 +0200
parents e3c42b8de67e
children
comparison
equal deleted inserted replaced
2295:160aacf936ad 2296:34354e2e40a3
20 */ 20 */
21 21
22 package com.sun.hotspot.c1x; 22 package com.sun.hotspot.c1x;
23 23
24 import java.io.*; 24 import java.io.*;
25 import java.lang.reflect.*;
26 import java.util.*; 25 import java.util.*;
27 26
28 import com.sun.c1x.*;
29 import com.sun.c1x.debug.*; 27 import com.sun.c1x.debug.*;
30 import com.sun.cri.ci.*; 28 import com.sun.cri.ci.*;
31 import com.sun.cri.ri.*; 29 import com.sun.cri.ri.*;
32 import com.sun.hotspot.c1x.logging.*; 30 import com.sun.hotspot.c1x.logging.*;
33 import com.sun.hotspot.c1x.server.*; 31 import com.sun.hotspot.c1x.server.*;
64 typeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte); 62 typeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte);
65 typeShort = new HotSpotTypePrimitive(compiler, CiKind.Short); 63 typeShort = new HotSpotTypePrimitive(compiler, CiKind.Short);
66 typeInt = new HotSpotTypePrimitive(compiler, CiKind.Int); 64 typeInt = new HotSpotTypePrimitive(compiler, CiKind.Int);
67 typeLong = new HotSpotTypePrimitive(compiler, CiKind.Long); 65 typeLong = new HotSpotTypePrimitive(compiler, CiKind.Long);
68 typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void); 66 typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void);
69 }
70
71 /**
72 * Default option configuration for C1X.
73 */
74 static {
75 C1XOptions.setOptimizationLevel(3);
76 C1XOptions.OptInlineExcept = false;
77 C1XOptions.OptInlineSynchronized = false;
78 C1XOptions.DetailedAsserts = false;
79 C1XOptions.CommentedAssembly = false;
80 C1XOptions.MethodEndBreakpointGuards = 2;
81 }
82
83 @Override
84 public boolean setOption(String option) {
85 if (option.length() == 0) {
86 return false;
87 }
88
89 Object value = null;
90 String fieldName = null;
91 String valueString = null;
92
93 char first = option.charAt(0);
94 if (first == '+' || first == '-') {
95 fieldName = option.substring(1);
96 value = (first == '+');
97 } else {
98 int index = option.indexOf('=');
99 if (index == -1) {
100 return false;
101 }
102 fieldName = option.substring(0, index);
103 valueString = option.substring(index + 1);
104 }
105
106 Field f;
107 try {
108 f = C1XOptions.class.getField(fieldName);
109
110 if (value == null) {
111 if (f.getType() == Float.TYPE) {
112 value = Float.parseFloat(valueString);
113 } else if (f.getType() == Double.TYPE) {
114 value = Double.parseDouble(valueString);
115 } else if (f.getType() == Integer.TYPE) {
116 value = Integer.parseInt(valueString);
117 } else if (f.getType() == Boolean.TYPE) {
118 value = Boolean.parseBoolean(valueString);
119 } else if (f.getType() == String.class) {
120 value = valueString;
121 }
122 }
123 if (value != null) {
124 f.set(null, value);
125 Logger.info("Set option " + fieldName + " to " + value);
126 } else {
127 Logger.info("Wrong value \"" + valueString + "\" for option " + fieldName);
128 return false;
129 }
130 } catch (SecurityException e) {
131 Logger.info("Security exception when setting option " + option);
132 return false;
133 } catch (NoSuchFieldException e) {
134 Logger.info("Could not find option " + fieldName);
135 return false;
136 } catch (IllegalArgumentException e) {
137 Logger.info("Illegal value for option " + option);
138 return false;
139 } catch (IllegalAccessException e) {
140 Logger.info("Illegal access exception when setting option " + option);
141 return false;
142 }
143
144 return true;
145 } 67 }
146 68
147 private static Set<String> compiledMethods = new HashSet<String>(); 69 private static Set<String> compiledMethods = new HashSet<String>();
148 70
149 @Override 71 @Override