Mercurial > hg > graal-jvmci-8
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTargetMethod.java @ 1427:149b1d2316de
basic invokeinterface and invokevirtual support
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Wed, 18 Aug 2010 16:47:06 -0700 |
parents | 760213a60e8b |
children | abc670a709dc |
comparison
equal
deleted
inserted
replaced
1426:ed6bd46ad55e | 1427:149b1d2316de |
---|---|
18 package com.sun.hotspot.c1x; | 18 package com.sun.hotspot.c1x; |
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.Site; | 23 import com.sun.cri.ci.CiTargetMethod.*; |
24 | 24 |
25 /** | 25 /** |
26 * CiTargetMethod augmented with HotSpot-specific information. | 26 * CiTargetMethod augmented with HotSpot-specific information. |
27 * | 27 * |
28 * @author Lukas Stadler | 28 * @author Lukas Stadler |
52 } | 52 } |
53 | 53 |
54 private Site[] getSortedSites(CiTargetMethod target) { | 54 private Site[] getSortedSites(CiTargetMethod target) { |
55 List<?>[] lists = new List<?>[] {target.directCalls, target.indirectCalls, target.safepoints, target.dataReferences, target.exceptionHandlers, target.marks}; | 55 List<?>[] lists = new List<?>[] {target.directCalls, target.indirectCalls, target.safepoints, target.dataReferences, target.exceptionHandlers, target.marks}; |
56 int count = 0; | 56 int count = 0; |
57 for (List<?> list: lists) { | 57 for (List<?> list : lists) { |
58 count += list.size(); | 58 count += list.size(); |
59 } | 59 } |
60 Site[] result = new Site[count]; | 60 Site[] result = new Site[count]; |
61 int pos = 0; | 61 int pos = 0; |
62 for (List<?> list: lists) { | 62 for (List<?> list : lists) { |
63 for (Object elem: list) { | 63 for (Object elem : list) { |
64 result[pos++] = (Site)elem; | 64 result[pos++] = (Site) elem; |
65 } | 65 } |
66 } | 66 } |
67 Arrays.sort(result, new Comparator<Site>() { | 67 Arrays.sort(result, new Comparator<Site>() { |
68 | |
68 public int compare(Site s1, Site s2) { | 69 public int compare(Site s1, Site s2) { |
70 if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) { | |
71 return s1 instanceof Mark ? -1 : 1; | |
72 } | |
69 return s1.pcOffset - s2.pcOffset; | 73 return s1.pcOffset - s2.pcOffset; |
70 } | 74 } |
71 }); | 75 }); |
76 for(Site site : result) | |
77 System.out.println(site.pcOffset + ": " + site); | |
72 return result; | 78 return result; |
73 } | 79 } |
74 | 80 |
75 public static void installMethod(HotSpotMethod method, CiTargetMethod targetMethod) { | 81 public static void installMethod(HotSpotMethod method, CiTargetMethod targetMethod) { |
76 Compiler.getVMEntries().installMethod(new HotSpotTargetMethod(method, targetMethod)); | 82 Compiler.getVMEntries().installMethod(new HotSpotTargetMethod(method, targetMethod)); |