comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolved.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 949ade3f2ff3
children 72cfb36c6bb2
comparison
equal deleted inserted replaced
1432:b61a43cd1255 1433:efba53f86c4f
15 * 15 *
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. 16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
17 */ 17 */
18 package com.sun.hotspot.c1x; 18 package com.sun.hotspot.c1x;
19 19
20 import java.lang.reflect.*;
21
20 import com.sun.cri.ci.*; 22 import com.sun.cri.ci.*;
21 import com.sun.cri.ri.*; 23 import com.sun.cri.ri.*;
24 import com.sun.hotspot.c1x.logging.*;
22 25
23 /** 26 /**
24 * Implementation of RiType for resolved non-primitive HotSpot classes. 27 * Implementation of RiType for resolved non-primitive HotSpot classes.
25 * 28 *
26 * @author Thomas Wuerthinger, Lukas Stadler 29 * @author Thomas Wuerthinger, Lukas Stadler
37 private final boolean isInitialized; 40 private final boolean isInitialized;
38 private final boolean isArrayClass; 41 private final boolean isArrayClass;
39 private final boolean isInstanceClass; 42 private final boolean isInstanceClass;
40 private final boolean isInterface; 43 private final boolean isInterface;
41 private final int instanceSize; 44 private final int instanceSize;
45 private final RiType componentType;
42 46
43 public HotSpotTypeResolved(long vmId, long javaMirrorVmId, String name, int accessFlags, boolean hasFinalizer, boolean hasSubclass, boolean hasFinalizableSubclass, boolean isInitialized, 47 public HotSpotTypeResolved(long vmId, long javaMirrorVmId, String name, int accessFlags, boolean hasFinalizer, boolean hasSubclass, boolean hasFinalizableSubclass, boolean isInitialized,
44 boolean isArrayClass, boolean isInstanceClass, boolean isInterface, int instanceSize) { 48 boolean isArrayClass, boolean isInstanceClass, boolean isInterface, int instanceSize, RiType componentType) {
45 this.vmId = vmId; 49 this.vmId = vmId;
46 this.javaMirrorVmId = javaMirrorVmId; 50 this.javaMirrorVmId = javaMirrorVmId;
47 this.name = name; 51 this.name = name;
48 this.accessFlags = accessFlags; 52 this.accessFlags = accessFlags;
49 this.hasFinalizer = hasFinalizer; 53 this.hasFinalizer = hasFinalizer;
52 this.isInitialized = isInitialized; 56 this.isInitialized = isInitialized;
53 this.isArrayClass = isArrayClass; 57 this.isArrayClass = isArrayClass;
54 this.isInstanceClass = isInstanceClass; 58 this.isInstanceClass = isInstanceClass;
55 this.isInterface = isInterface; 59 this.isInterface = isInterface;
56 this.instanceSize = instanceSize; 60 this.instanceSize = instanceSize;
61 this.componentType = componentType;
57 } 62 }
58 63
59 @Override 64 @Override
60 public int accessFlags() { 65 public int accessFlags() {
61 return accessFlags; 66 return accessFlags;
62 } 67 }
63 68
64 @Override 69 @Override
65 public RiType arrayOf() { 70 public RiType arrayOf() {
71 Logger.log("arrayOf " + name);
66 return null; 72 return null;
73 //return Compiler.getVMEntries().RiType_arrayOf(vmId);
67 } 74 }
68 75
69 @Override 76 @Override
70 public RiType componentType() { 77 public RiType componentType() {
71 return null; 78 Logger.log("componentType " + name + " isarray: " + isArrayClass);
79 return Compiler.getVMEntries().RiType_componentType(vmId);
72 } 80 }
73 81
74 @Override 82 @Override
75 public RiType exactType() { 83 public RiType exactType() {
84 // TODO is this correct? what's this exactType good for?
85 if (Modifier.isFinal(accessFlags)) {
86 return this;
87 }
76 return null; 88 return null;
77 } 89 }
78 90
79 @Override 91 @Override
80 public CiConstant getEncoding(Representation r) { 92 public CiConstant getEncoding(Representation r) {
122 return isInitialized; 134 return isInitialized;
123 } 135 }
124 136
125 @Override 137 @Override
126 public boolean isInstance(Object obj) { 138 public boolean isInstance(Object obj) {
127 139 throw new UnsupportedOperationException();
128 return false;
129 } 140 }
130 141
131 @Override 142 @Override
132 public boolean isInstanceClass() { 143 public boolean isInstanceClass() {
133 return isInstanceClass; 144 return isInstanceClass;
143 return true; 154 return true;
144 } 155 }
145 156
146 @Override 157 @Override
147 public boolean isSubtypeOf(RiType other) { 158 public boolean isSubtypeOf(RiType other) {
148 assert other instanceof HotSpotType : "unexpected 'other' type: " + other; 159 assert other instanceof HotSpotType : "unexpected 'other' type: " + other;
149 if (other instanceof HotSpotTypeResolved) 160 if (other instanceof HotSpotTypeResolved)
150 return Compiler.getVMEntries().RiType_isSubtypeOf(vmId, other); 161 return Compiler.getVMEntries().RiType_isSubtypeOf(vmId, other);
151 // no resolved type is a subtype of an unresolved type 162 // no resolved type is a subtype of an unresolved type
152 return false; 163 return false;
153 } 164 }
166 public String name() { 177 public String name() {
167 return "L" + name + ";"; 178 return "L" + name + ";";
168 } 179 }
169 180
170 @Override 181 @Override
182 public String simpleName() {
183 return name;
184 }
185
186 @Override
171 public RiMethod resolveMethodImpl(RiMethod method) { 187 public RiMethod resolveMethodImpl(RiMethod method) {
172 assert method instanceof HotSpotMethod; 188 assert method instanceof HotSpotMethod;
173 return Compiler.getVMEntries().RiType_resolveMethodImpl(vmId, method.name(), method.signature().asString()); 189 return Compiler.getVMEntries().RiType_resolveMethodImpl(vmId, method.name(), method.signature().asString());
174 } 190 }
175 191