Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java @ 1429:abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
* -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side
* provide more information about types to the compiler (type hierarchy, etc)
* provide exception handler tables to the compiler
* add exception handlers to the nmethod
* correct implementation of ExceptionObject
* exception handling/unwinding entry points
* modified versions of handle/unwind exception stubs using standard calling conventions
* exception throwing
* implicit null pointer exception, implicit div by 0 exception
* arraystore/classcast/arrayindex exceptions
* checkcast implementation
* newarray, anewarray, multinewarray implementation
* correct new instance initialization
* access to java class mirrors (for ldc)
* unresolved methods
* class resolving - class patching (asssembly prototype copying)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 31 Aug 2010 22:13:30 -0700 |
parents | 149b1d2316de |
children | 9e5e83ca2259 |
comparison
equal
deleted
inserted
replaced
1428:695451afc619 | 1429:abc670a709dc |
---|---|
19 | 19 |
20 import java.util.*; | 20 import java.util.*; |
21 | 21 |
22 import com.sun.cri.ci.*; | 22 import com.sun.cri.ci.*; |
23 import com.sun.cri.ci.CiTargetMethod.*; | 23 import com.sun.cri.ci.CiTargetMethod.*; |
24 import com.sun.hotspot.c1x.logging.*; | |
24 | 25 |
25 /** | 26 /** |
26 * CiTargetMethod augmented with HotSpot-specific information. | 27 * CiTargetMethod augmented with HotSpot-specific information. |
27 * | 28 * |
28 * @author Lukas Stadler | 29 * @author Lukas Stadler |
29 */ | 30 */ |
30 public class HotSpotTargetMethod implements CompilerObject { | 31 public class HotSpotTargetMethod implements CompilerObject { |
31 | 32 |
32 public final CiTargetMethod targetMethod; | 33 public final CiTargetMethod targetMethod; |
33 public final HotSpotMethod method; // used only for methods | 34 public final HotSpotMethodResolved method; // used only for methods |
34 public final String name; // used only for stubs | 35 public final String name; // used only for stubs |
35 | 36 |
36 public final Site[] sites; | 37 public final Site[] sites; |
38 public final ExceptionHandler[] exceptionHandlers; | |
37 | 39 |
38 private HotSpotTargetMethod(HotSpotMethod method, CiTargetMethod targetMethod) { | 40 private HotSpotTargetMethod(HotSpotMethodResolved method, CiTargetMethod targetMethod) { |
39 this.method = method; | 41 this.method = method; |
40 this.targetMethod = targetMethod; | 42 this.targetMethod = targetMethod; |
41 this.name = null; | 43 this.name = null; |
42 | 44 |
43 sites = getSortedSites(targetMethod); | 45 sites = getSortedSites(targetMethod); |
46 if (targetMethod.exceptionHandlers == null) { | |
47 exceptionHandlers = null; | |
48 } else { | |
49 exceptionHandlers = targetMethod.exceptionHandlers.toArray(new ExceptionHandler[targetMethod.exceptionHandlers.size()]); | |
50 } | |
44 } | 51 } |
45 | 52 |
46 private HotSpotTargetMethod(CiTargetMethod targetMethod, String name) { | 53 private HotSpotTargetMethod(CiTargetMethod targetMethod, String name) { |
47 this.method = null; | 54 this.method = null; |
48 this.targetMethod = targetMethod; | 55 this.targetMethod = targetMethod; |
49 this.name = name; | 56 this.name = name; |
50 | 57 |
51 sites = getSortedSites(targetMethod); | 58 sites = getSortedSites(targetMethod); |
59 assert targetMethod.exceptionHandlers == null || targetMethod.exceptionHandlers.size() == 0; | |
60 exceptionHandlers = null; | |
52 } | 61 } |
53 | 62 |
54 private Site[] getSortedSites(CiTargetMethod target) { | 63 private Site[] getSortedSites(CiTargetMethod target) { |
55 List<?>[] lists = new List<?>[] {target.directCalls, target.indirectCalls, target.safepoints, target.dataReferences, target.exceptionHandlers, target.marks}; | 64 List<?>[] lists = new List<?>[] { target.directCalls, target.indirectCalls, target.safepoints, target.dataReferences, target.marks}; |
56 int count = 0; | 65 int count = 0; |
57 for (List<?> list : lists) { | 66 for (List<?> list : lists) { |
58 count += list.size(); | 67 count += list.size(); |
59 } | 68 } |
60 Site[] result = new Site[count]; | 69 Site[] result = new Site[count]; |
71 return s1 instanceof Mark ? -1 : 1; | 80 return s1 instanceof Mark ? -1 : 1; |
72 } | 81 } |
73 return s1.pcOffset - s2.pcOffset; | 82 return s1.pcOffset - s2.pcOffset; |
74 } | 83 } |
75 }); | 84 }); |
76 for(Site site : result) | 85 if (Logger.ENABLED) |
77 System.out.println(site.pcOffset + ": " + site); | 86 for (Site site : result) |
87 Logger.log(site.pcOffset + ": " + site); | |
78 return result; | 88 return result; |
79 } | 89 } |
80 | 90 |
81 public static void installMethod(HotSpotMethod method, CiTargetMethod targetMethod) { | 91 public static void installMethod(HotSpotMethodResolved method, CiTargetMethod targetMethod) { |
82 Compiler.getVMEntries().installMethod(new HotSpotTargetMethod(method, targetMethod)); | 92 Compiler.getVMEntries().installMethod(new HotSpotTargetMethod(method, targetMethod)); |
83 } | 93 } |
84 | 94 |
85 public static Object installStub(CiTargetMethod targetMethod, String name) { | 95 public static Object installStub(CiTargetMethod targetMethod, String name) { |
86 return Compiler.getVMEntries().installStub(new HotSpotTargetMethod(targetMethod, name)); | 96 return Compiler.getVMEntries().installStub(new HotSpotTargetMethod(targetMethod, name)); |