Mercurial > hg > graal-compiler
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/VMExitsNative.java @ 1449:8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Thu, 11 Nov 2010 14:09:37 +0100 |
parents | a7b84a5e16c6 |
children | 1845386f5403 |
comparison
equal
deleted
inserted
replaced
1445:a7b84a5e16c6 | 1449:8cfe3537a0d3 |
---|---|
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.*; | 25 import java.lang.reflect.*; |
26 import java.util.*; | |
26 | 27 |
27 import com.sun.c1x.*; | 28 import com.sun.c1x.*; |
28 import com.sun.cri.ci.*; | 29 import com.sun.cri.ci.*; |
29 import com.sun.cri.ri.*; | 30 import com.sun.cri.ri.*; |
30 import com.sun.hotspot.c1x.logging.*; | 31 import com.sun.hotspot.c1x.logging.*; |
35 * @author Thomas Wuerthinger, Lukas Stadler | 36 * @author Thomas Wuerthinger, Lukas Stadler |
36 */ | 37 */ |
37 public class VMExitsNative implements VMExits { | 38 public class VMExitsNative implements VMExits { |
38 | 39 |
39 public static boolean compileMethods = true; | 40 public static boolean compileMethods = true; |
41 | |
42 /** | |
43 * Default option configuration for C1X. | |
44 */ | |
45 static { | |
46 C1XOptions.setOptimizationLevel(3); | |
47 C1XOptions.OptInlineExcept = false; | |
48 C1XOptions.OptInlineSynchronized = false; | |
49 C1XOptions.UseDeopt = false; | |
50 } | |
40 | 51 |
41 @Override | 52 @Override |
42 public boolean setOption(String option) { | 53 public boolean setOption(String option) { |
43 if (option.length() == 0) { | 54 if (option.length() == 0) { |
44 return false; | 55 return false; |
100 } | 111 } |
101 | 112 |
102 return true; | 113 return true; |
103 } | 114 } |
104 | 115 |
116 private static Set<String> compiledMethods = new HashSet<String>(); | |
117 | |
105 @Override | 118 @Override |
106 public void compileMethod(long methodVmId, String name, int entryBCI) throws Throwable { | 119 public void compileMethod(long methodVmId, String name, int entryBCI) throws Throwable { |
107 | 120 |
108 if (!compileMethods) { | 121 if (!compileMethods) { |
109 return; | 122 return; |
111 | 124 |
112 try { | 125 try { |
113 Compiler compiler = Compiler.getInstance(); | 126 Compiler compiler = Compiler.getInstance(); |
114 HotSpotMethodResolved riMethod = new HotSpotMethodResolved(methodVmId, name); | 127 HotSpotMethodResolved riMethod = new HotSpotMethodResolved(methodVmId, name); |
115 CiResult result = compiler.getCompiler().compileMethod(riMethod, -1, null); | 128 CiResult result = compiler.getCompiler().compileMethod(riMethod, -1, null); |
129 String qualifiedName = CiUtil.toJavaName(riMethod.holder()) + "::" + riMethod.name(); | |
130 compiledMethods.add(qualifiedName); | |
116 | 131 |
117 if (result.bailout() != null) { | 132 if (result.bailout() != null) { |
118 StringWriter out = new StringWriter(); | 133 StringWriter out = new StringWriter(); |
119 result.bailout().printStackTrace(new PrintWriter(out)); | 134 result.bailout().printStackTrace(new PrintWriter(out)); |
135 Throwable cause = result.bailout().getCause(); | |
120 Logger.info("Bailout:\n" + out.toString()); | 136 Logger.info("Bailout:\n" + out.toString()); |
137 if (cause != null) { | |
138 Logger.info("Trace for cause: "); | |
139 for (StackTraceElement e : cause.getStackTrace()) { | |
140 String current = e.getClassName() + "::" + e.getMethodName(); | |
141 String type = ""; | |
142 if (compiledMethods.contains(current)) { | |
143 type = "compiled"; | |
144 } | |
145 Logger.info(String.format("%-10s %3d %s", type, e.getLineNumber(), current)); | |
146 } | |
147 } | |
121 Compiler.getVMEntries().recordBailout(result.bailout().getMessage()); | 148 Compiler.getVMEntries().recordBailout(result.bailout().getMessage()); |
122 } else { | 149 } else { |
123 Logger.log("Compilation result: " + result.targetMethod()); | 150 Logger.log("Compilation result: " + result.targetMethod()); |
124 HotSpotTargetMethod.installMethod(riMethod, result.targetMethod()); | 151 HotSpotTargetMethod.installMethod(riMethod, result.targetMethod()); |
125 } | 152 } |