Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolved.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 | 98fffb304868 |
children | 949ade3f2ff3 |
comparison
equal
deleted
inserted
replaced
1428:695451afc619 | 1429:abc670a709dc |
---|---|
26 * @author Thomas Wuerthinger, Lukas Stadler | 26 * @author Thomas Wuerthinger, Lukas Stadler |
27 */ | 27 */ |
28 public class HotSpotTypeResolved implements HotSpotType { | 28 public class HotSpotTypeResolved implements HotSpotType { |
29 | 29 |
30 private final long vmId; | 30 private final long vmId; |
31 private final long javaMirrorVmId; | |
32 private final String name; | |
33 private final int accessFlags; | |
34 private final boolean hasFinalizer; | |
35 private final boolean hasSubclass; | |
36 private final boolean hasFinalizableSubclass; | |
37 private final boolean isInitialized; | |
38 private final boolean isArrayClass; | |
39 private final boolean isInstanceClass; | |
40 private final boolean isInterface; | |
41 private final int instanceSize; | |
31 | 42 |
32 private final String name; | 43 public HotSpotTypeResolved(long vmId, long javaMirrorVmId, String name, int accessFlags, boolean hasFinalizer, boolean hasSubclass, boolean hasFinalizableSubclass, boolean isInitialized, |
33 | 44 boolean isArrayClass, boolean isInstanceClass, boolean isInterface, int instanceSize) { |
34 // cached values | |
35 private Boolean isArrayClass; | |
36 private Boolean isInstanceClass; | |
37 private Boolean isInterface; | |
38 private long instanceSize; | |
39 | |
40 public HotSpotTypeResolved(long vmId, String name) { | |
41 this.vmId = vmId; | 45 this.vmId = vmId; |
46 this.javaMirrorVmId = javaMirrorVmId; | |
42 this.name = name; | 47 this.name = name; |
48 this.accessFlags = accessFlags; | |
49 this.hasFinalizer = hasFinalizer; | |
50 this.hasSubclass = hasSubclass; | |
51 this.hasFinalizableSubclass = hasFinalizableSubclass; | |
52 this.isInitialized = isInitialized; | |
53 this.isArrayClass = isArrayClass; | |
54 this.isInstanceClass = isInstanceClass; | |
55 this.isInterface = isInterface; | |
56 this.instanceSize = instanceSize; | |
43 } | 57 } |
44 | 58 |
45 @Override | 59 @Override |
46 public int accessFlags() { | 60 public int accessFlags() { |
47 // TODO Auto-generated method stub | 61 return accessFlags; |
48 return 0; | |
49 } | 62 } |
50 | 63 |
51 @Override | 64 @Override |
52 public RiType arrayOf() { | 65 public RiType arrayOf() { |
53 // TODO Auto-generated method stub | |
54 return null; | 66 return null; |
55 } | 67 } |
56 | 68 |
57 @Override | 69 @Override |
58 public RiType componentType() { | 70 public RiType componentType() { |
59 // TODO Auto-generated method stub | |
60 return null; | 71 return null; |
61 } | 72 } |
62 | 73 |
63 @Override | 74 @Override |
64 public RiType exactType() { | 75 public RiType exactType() { |
65 // TODO Auto-generated method stub | |
66 return null; | 76 return null; |
67 } | 77 } |
68 | 78 |
69 @Override | 79 @Override |
70 public CiConstant getEncoding(Representation r) { | 80 public CiConstant getEncoding(Representation r) { |
71 // TODO Auto-generated method stub | 81 switch (r) { |
72 return null; | 82 case JavaClass: |
83 return CiConstant.forObject((Long) javaMirrorVmId); | |
84 case ObjectHub: | |
85 return CiConstant.forObject(this); | |
86 case StaticFields: | |
87 return CiConstant.forObject(this); | |
88 case TypeInfo: | |
89 return CiConstant.forObject(this); | |
90 default: | |
91 return null; | |
92 } | |
73 } | 93 } |
74 | 94 |
75 @Override | 95 @Override |
76 public CiKind getRepresentationKind(Representation r) { | 96 public CiKind getRepresentationKind(Representation r) { |
77 return CiKind.Object; | 97 return CiKind.Object; |
78 } | 98 } |
79 | 99 |
80 @Override | 100 @Override |
81 public boolean hasFinalizableSubclass() { | 101 public boolean hasFinalizableSubclass() { |
82 // TODO Auto-generated method stub | 102 return hasFinalizableSubclass; |
83 return false; | |
84 } | 103 } |
85 | 104 |
86 @Override | 105 @Override |
87 public boolean hasFinalizer() { | 106 public boolean hasFinalizer() { |
88 // TODO Auto-generated method stub | 107 return hasFinalizer; |
89 return false; | |
90 } | 108 } |
91 | 109 |
92 @Override | 110 @Override |
93 public boolean hasSubclass() { | 111 public boolean hasSubclass() { |
94 // TODO Auto-generated method stub | 112 return hasSubclass; |
95 return false; | |
96 } | 113 } |
97 | 114 |
98 @Override | 115 @Override |
99 public boolean isArrayClass() { | 116 public boolean isArrayClass() { |
100 if (isArrayClass == null) | |
101 isArrayClass = Compiler.getVMEntries().RiType_isArrayClass(vmId); | |
102 return isArrayClass; | 117 return isArrayClass; |
103 } | 118 } |
104 | 119 |
105 @Override | 120 @Override |
106 public boolean isInitialized() { | 121 public boolean isInitialized() { |
107 // TODO Auto-generated method stub | 122 return isInitialized; |
108 return false; | |
109 } | 123 } |
110 | 124 |
111 @Override | 125 @Override |
112 public boolean isInstance(Object obj) { | 126 public boolean isInstance(Object obj) { |
113 // TODO Auto-generated method stub | 127 |
114 return false; | 128 return false; |
115 } | 129 } |
116 | 130 |
117 @Override | 131 @Override |
118 public boolean isInstanceClass() { | 132 public boolean isInstanceClass() { |
119 if (isInstanceClass == null) | |
120 isInstanceClass = Compiler.getVMEntries().RiType_isInstanceClass(vmId); | |
121 return isInstanceClass; | 133 return isInstanceClass; |
122 } | 134 } |
123 | 135 |
124 @Override | 136 @Override |
125 public boolean isInterface() { | 137 public boolean isInterface() { |
126 if (isInterface == null) | |
127 isInterface = Compiler.getVMEntries().RiType_isInterface(vmId); | |
128 return isInterface; | 138 return isInterface; |
129 } | 139 } |
130 | 140 |
131 @Override | 141 @Override |
132 public boolean isResolved() { | 142 public boolean isResolved() { |
133 return true; | 143 return true; |
134 } | 144 } |
135 | 145 |
136 @Override | 146 @Override |
137 public boolean isSubtypeOf(RiType other) { | 147 public boolean isSubtypeOf(RiType other) { |
138 // TODO Auto-generated method stub | 148 assert other instanceof HotSpotType; |
149 if (other instanceof HotSpotTypeResolved) | |
150 return Compiler.getVMEntries().RiType_isSubtypeOf(vmId, other); | |
151 // no resolved type is a subtype of an unresolved type | |
139 return false; | 152 return false; |
140 } | 153 } |
141 | 154 |
142 @Override | 155 @Override |
143 public Class<?> javaClass() { | 156 public Class<?> javaClass() { |
149 return CiKind.Object; | 162 return CiKind.Object; |
150 } | 163 } |
151 | 164 |
152 @Override | 165 @Override |
153 public String name() { | 166 public String name() { |
154 return name; | 167 return "L" + name + ";"; |
155 } | 168 } |
156 | 169 |
157 @Override | 170 @Override |
158 public RiMethod resolveMethodImpl(RiMethod method) { | 171 public RiMethod resolveMethodImpl(RiMethod method) { |
159 // TODO Auto-generated method stub | 172 assert method instanceof HotSpotMethod; |
160 return null; | 173 return Compiler.getVMEntries().RiType_resolveMethodImpl(vmId, method.name(), method.signature().asString()); |
161 } | 174 } |
162 | 175 |
163 @Override | 176 @Override |
164 public String toString() { | 177 public String toString() { |
165 return "HotSpotType<" + name + ">"; | 178 return "HotSpotType<" + name + ", resolved>"; |
166 } | 179 } |
167 | 180 |
168 public RiConstantPool constantPool() { | 181 public RiConstantPool constantPool() { |
169 return Compiler.getVMEntries().RiType_constantPool(vmId); | 182 return Compiler.getVMEntries().RiType_constantPool(vmId); |
170 } | 183 } |
171 | 184 |
172 public long getVmId() { | 185 public long getVmId() { |
173 return vmId; | 186 return vmId; |
174 } | 187 } |
175 | 188 |
176 public long instanceSize() { | 189 public int instanceSize() { |
177 if (instanceSize == 0) { | |
178 instanceSize = Compiler.getVMEntries().RiType_instanceSize(vmId); | |
179 } | |
180 return instanceSize; | 190 return instanceSize; |
181 } | 191 } |
182 | 192 |
183 } | 193 } |