Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolved.java Thu Aug 19 14:34:52 2010 -0700 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotTypeResolved.java Tue Aug 31 22:13:30 2010 -0700 @@ -28,48 +28,68 @@ public class HotSpotTypeResolved implements HotSpotType { private final long vmId; - + private final long javaMirrorVmId; private final String name; + private final int accessFlags; + private final boolean hasFinalizer; + private final boolean hasSubclass; + private final boolean hasFinalizableSubclass; + private final boolean isInitialized; + private final boolean isArrayClass; + private final boolean isInstanceClass; + private final boolean isInterface; + private final int instanceSize; - // cached values - private Boolean isArrayClass; - private Boolean isInstanceClass; - private Boolean isInterface; - private long instanceSize; - - public HotSpotTypeResolved(long vmId, String name) { + public HotSpotTypeResolved(long vmId, long javaMirrorVmId, String name, int accessFlags, boolean hasFinalizer, boolean hasSubclass, boolean hasFinalizableSubclass, boolean isInitialized, + boolean isArrayClass, boolean isInstanceClass, boolean isInterface, int instanceSize) { this.vmId = vmId; + this.javaMirrorVmId = javaMirrorVmId; this.name = name; + this.accessFlags = accessFlags; + this.hasFinalizer = hasFinalizer; + this.hasSubclass = hasSubclass; + this.hasFinalizableSubclass = hasFinalizableSubclass; + this.isInitialized = isInitialized; + this.isArrayClass = isArrayClass; + this.isInstanceClass = isInstanceClass; + this.isInterface = isInterface; + this.instanceSize = instanceSize; } @Override public int accessFlags() { - // TODO Auto-generated method stub - return 0; + return accessFlags; } @Override public RiType arrayOf() { - // TODO Auto-generated method stub return null; } @Override public RiType componentType() { - // TODO Auto-generated method stub return null; } @Override public RiType exactType() { - // TODO Auto-generated method stub return null; } @Override public CiConstant getEncoding(Representation r) { - // TODO Auto-generated method stub - return null; + switch (r) { + case JavaClass: + return CiConstant.forObject((Long) javaMirrorVmId); + case ObjectHub: + return CiConstant.forObject(this); + case StaticFields: + return CiConstant.forObject(this); + case TypeInfo: + return CiConstant.forObject(this); + default: + return null; + } } @Override @@ -79,52 +99,42 @@ @Override public boolean hasFinalizableSubclass() { - // TODO Auto-generated method stub - return false; + return hasFinalizableSubclass; } @Override public boolean hasFinalizer() { - // TODO Auto-generated method stub - return false; + return hasFinalizer; } @Override public boolean hasSubclass() { - // TODO Auto-generated method stub - return false; + return hasSubclass; } @Override public boolean isArrayClass() { - if (isArrayClass == null) - isArrayClass = Compiler.getVMEntries().RiType_isArrayClass(vmId); return isArrayClass; } @Override public boolean isInitialized() { - // TODO Auto-generated method stub - return false; + return isInitialized; } @Override public boolean isInstance(Object obj) { - // TODO Auto-generated method stub + return false; } @Override public boolean isInstanceClass() { - if (isInstanceClass == null) - isInstanceClass = Compiler.getVMEntries().RiType_isInstanceClass(vmId); return isInstanceClass; } @Override public boolean isInterface() { - if (isInterface == null) - isInterface = Compiler.getVMEntries().RiType_isInterface(vmId); return isInterface; } @@ -135,7 +145,10 @@ @Override public boolean isSubtypeOf(RiType other) { - // TODO Auto-generated method stub + assert other instanceof HotSpotType; + if (other instanceof HotSpotTypeResolved) + return Compiler.getVMEntries().RiType_isSubtypeOf(vmId, other); + // no resolved type is a subtype of an unresolved type return false; } @@ -151,18 +164,18 @@ @Override public String name() { - return name; + return "L" + name + ";"; } @Override public RiMethod resolveMethodImpl(RiMethod method) { - // TODO Auto-generated method stub - return null; + assert method instanceof HotSpotMethod; + return Compiler.getVMEntries().RiType_resolveMethodImpl(vmId, method.name(), method.signature().asString()); } @Override public String toString() { - return "HotSpotType<" + name + ">"; + return "HotSpotType<" + name + ", resolved>"; } public RiConstantPool constantPool() { @@ -173,10 +186,7 @@ return vmId; } - public long instanceSize() { - if (instanceSize == 0) { - instanceSize = Compiler.getVMEntries().RiType_instanceSize(vmId); - } + public int instanceSize() { return instanceSize; }