Mercurial > hg > graal-compiler
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotSignature.java @ 1433:efba53f86c4f
various fixes and enhancements
* correct refmap->oopmap conversion (register numbering, stack slot numbering)
* fixes for inlining (correct scoping in exception handler lookup, NPE in scope conversion)
* support for "jump to runtime stub" (patching code needs to be aware of jmp instruction)
* provide more information about methods (to allow inlining: has_balanced_monitors, etc.)
* fixes to signature type lookup
* isSubTypeOf: correct handling of array classes
* RiType: componentType/arrayOf
* prologue: inline cache check, icmiss stub
* klass state check (resolved but not initialized) in newinstance
* card table write barriers
* c1x classes are optional (to allow running c1 without them)
* correct for stored frame pointer in calling conventions (methods with arguments on stack)
* getType(Class<?>) for some basic types, used for optimizations and folding
* RiMethod/RiType: throw exception instead of silent failure on unsupported operations
* RiType: resolved/unresolved array type support
* refactoring: new on-demand template generation mechanism
* optimizations: template specialization for no_null_check, given length, etc.
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 16 Sep 2010 19:42:20 -0700 |
parents | 760213a60e8b |
children | 9e5e83ca2259 |
comparison
equal
deleted
inserted
replaced
1432:b61a43cd1255 | 1433:efba53f86c4f |
---|---|
30 public class HotSpotSignature implements RiSignature, CompilerObject { | 30 public class HotSpotSignature implements RiSignature, CompilerObject { |
31 | 31 |
32 private final List<String> arguments = new ArrayList<String>(); | 32 private final List<String> arguments = new ArrayList<String>(); |
33 private final String returnType; | 33 private final String returnType; |
34 private final String originalString; | 34 private final String originalString; |
35 private RiType[] argumentTypes; | |
36 private RiType returnTypeCache; | |
35 | 37 |
36 public HotSpotSignature(String signature) { | 38 public HotSpotSignature(String signature) { |
37 assert signature.length() > 0; | 39 assert signature.length() > 0; |
38 this.originalString = signature; | 40 this.originalString = signature; |
39 | 41 |
56 | 58 |
57 private int parseSignature(String signature, int cur) { | 59 private int parseSignature(String signature, int cur) { |
58 char first; | 60 char first; |
59 do { | 61 do { |
60 first = signature.charAt(cur++); | 62 first = signature.charAt(cur++); |
61 } while(first == '['); | 63 } while (first == '['); |
62 | 64 |
63 switch (first) { | 65 switch (first) { |
64 case 'L': | 66 case 'L': |
65 while (signature.charAt(cur) != ';') | 67 while (signature.charAt(cur) != ';') |
66 cur++; | 68 cur++; |
103 return argSlots + (withReceiver ? 1 : 0); | 105 return argSlots + (withReceiver ? 1 : 0); |
104 } | 106 } |
105 | 107 |
106 @Override | 108 @Override |
107 public RiType argumentTypeAt(int index, RiType accessingClass) { | 109 public RiType argumentTypeAt(int index, RiType accessingClass) { |
108 long accessor = 0; | 110 if (argumentTypes == null) { |
109 if (accessingClass instanceof HotSpotTypeResolved) { | 111 argumentTypes = new RiType[arguments.size()]; |
110 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId(); | |
111 } | 112 } |
112 return Compiler.getVMEntries().RiSignature_lookupType(arguments.get(index), accessor); | 113 RiType type = argumentTypes[index]; |
114 if (type == null) { | |
115 long accessor = 0; | |
116 if (accessingClass instanceof HotSpotTypeResolved) { | |
117 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId(); | |
118 } | |
119 type = Compiler.getVMEntries().RiSignature_lookupType(arguments.get(index), accessor); | |
120 argumentTypes[index] = type; | |
121 } | |
122 return type; | |
113 } | 123 } |
114 | 124 |
115 @Override | 125 @Override |
116 public String asString() { | 126 public String asString() { |
117 return originalString; | 127 return originalString; |
122 return CiKind.fromTypeString(returnType); | 132 return CiKind.fromTypeString(returnType); |
123 } | 133 } |
124 | 134 |
125 @Override | 135 @Override |
126 public RiType returnType(RiType accessingClass) { | 136 public RiType returnType(RiType accessingClass) { |
127 long accessor = 0; | 137 if (returnTypeCache == null) { |
128 if (accessingClass instanceof HotSpotTypeResolved) { | 138 long accessor = 0; |
129 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId(); | 139 if (accessingClass instanceof HotSpotTypeResolved) { |
140 accessor = (Long) ((HotSpotTypeResolved) accessingClass).getVmId(); | |
141 } | |
142 returnTypeCache = Compiler.getVMEntries().RiSignature_lookupType(returnType, accessor); | |
130 } | 143 } |
131 return Compiler.getVMEntries().RiSignature_lookupType(returnType, accessor); | 144 return returnTypeCache; |
132 } | 145 } |
133 | 146 |
134 @Override | 147 @Override |
135 public String toString() { | 148 public String toString() { |
136 return "HotSpotSignature<" + originalString + ">"; | 149 return "HotSpotSignature<" + originalString + ">"; |