Mercurial > hg > graal-compiler
diff agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | d6cd0d55d0b5 |
children | 1d1603768966 |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java Thu Jan 27 13:42:28 2011 -0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java Thu Jan 27 16:11:27 2011 -0800 @@ -89,6 +89,37 @@ readVMLongConstants(); } + public Type lookupType(String cTypeName, boolean throwException) { + Type fieldType = super.lookupType(cTypeName, false); + if (fieldType == null && cTypeName.startsWith("const ")) { + fieldType = (BasicType)lookupType(cTypeName.substring(6), false); + } + if (fieldType == null && cTypeName.endsWith(" const")) { + fieldType = (BasicType)lookupType(cTypeName.substring(0, cTypeName.length() - 6), false); + } + if (fieldType == null) { + if (cTypeName.startsWith("GrowableArray<") && cTypeName.endsWith(">*")) { + String ttype = cTypeName.substring("GrowableArray<".length(), + cTypeName.length() - 2); + Type templateType = lookupType(ttype, false); + if (templateType == null && typeNameIsPointerType(ttype)) { + templateType = recursiveCreateBasicPointerType(ttype); + } + if (templateType == null) { + lookupOrFail(ttype); + } + fieldType = recursiveCreateBasicPointerType(cTypeName); + } + } + if (fieldType == null && typeNameIsPointerType(cTypeName)) { + fieldType = recursiveCreateBasicPointerType(cTypeName); + } + if (fieldType == null && throwException) { + super.lookupType(cTypeName, true); + } + return fieldType; + } + private void readVMTypes() { // Get the variables we need in order to traverse the VMTypeEntry[] long typeEntryTypeNameOffset; @@ -250,7 +281,7 @@ BasicType containingType = lookupOrFail(typeName); // The field's Type must already be in the database -- no exceptions - BasicType fieldType = lookupOrFail(typeString); + BasicType fieldType = (BasicType)lookupType(typeString); // Create field by type createField(containingType, fieldName, fieldType, @@ -442,10 +473,17 @@ workarounds due to incomplete information in the VMStructs database. */ private BasicPointerType recursiveCreateBasicPointerType(String typeName) { + BasicPointerType result = (BasicPointerType)super.lookupType(typeName, false); + if (result != null) { + return result; + } String targetTypeName = typeName.substring(0, typeName.lastIndexOf('*')).trim(); Type targetType = null; if (typeNameIsPointerType(targetTypeName)) { - targetType = recursiveCreateBasicPointerType(targetTypeName); + targetType = lookupType(targetTypeName, false); + if (targetType == null) { + targetType = recursiveCreateBasicPointerType(targetTypeName); + } } else { targetType = lookupType(targetTypeName, false); if (targetType == null) { @@ -466,6 +504,20 @@ BasicType basicTargetType = createBasicType(targetTypeName, false, true, true); basicTargetType.setSize(1); targetType = basicTargetType; + } else if (targetTypeName.startsWith("GrowableArray<")) { + BasicType basicTargetType = createBasicType(targetTypeName, false, false, false); + + // transfer fields from GenericGrowableArray to template instance + BasicType generic = lookupOrFail("GenericGrowableArray"); + basicTargetType.setSize(generic.getSize()); + Iterator fields = generic.getFields(); + while (fields.hasNext()) { + Field f = (Field)fields.next(); + basicTargetType.addField(internalCreateField(basicTargetType, f.getName(), + f.getType(), f.isStatic(), + f.getOffset(), null)); + } + targetType = basicTargetType; } else { if (DEBUG) { System.err.println("WARNING: missing target type \"" + targetTypeName + "\" for pointer type \"" + typeName + "\""); @@ -474,7 +526,10 @@ } } } - return new BasicPointerType(this, typeName, targetType); + result = new BasicPointerType(this, typeName, targetType); + result.setSize(UNINITIALIZED_SIZE); + addType(result); + return result; } private boolean typeNameIsPointerType(String typeName) {