From: <dgr...@us...> - 2009-01-16 19:06:53
|
Revision: 15287 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15287&view=rev Author: dgrove-oss Date: 2009-01-16 19:06:41 +0000 (Fri, 16 Jan 2009) Log Message: ----------- RVM-746 WIP : Clone and minimally modify org.jikesrvm.classloader.Primitive to create org.jikesrvm.classloader.UnboxedType. This commit is fairly trivial and would not be useful in and of itself, since it doesn't actually change how we recognize UnboxedTypes and compile their magic methods. The goal in committing it is to make sure that there aren't any pieces of code outside of the classloader that still think Address et al are instances of Primitives (instead of UnboxedType). The next step is to actually change UnboxedType to be created from a java classfile that has the @Unboxed annotation and to build the method & fields of UnboxedType based on the information in the class file. Modified Paths: -------------- rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/DynamicTypeCheck.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/Primitive.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMArray.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMClass.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMType.java rvmroot/trunk/rvm/src/org/jikesrvm/classloader/TypeReference.java rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/TemplateCompilerFramework.java rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/FieldAnalysis.java rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/DynamicTypeCheckExpansion.java rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIFunctions.java rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java Added Paths: ----------- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/UnboxedType.java Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java =================================================================== --- rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -272,7 +272,7 @@ } public Type[] getGenericInterfaces() { - if (type.isPrimitiveType()) { + if (type.isPrimitiveType() || type.isUnboxedType()) { return new Type[0]; } else if (type.isArrayType()) { // arrays implement JavaLangSerializable & JavaLangCloneable @@ -292,7 +292,7 @@ public Type getGenericSuperclass() { if (type.isArrayType()) { return Object.class; - } else if (type.isPrimitiveType() || + } else if (type.isPrimitiveType() || type.isUnboxedType() || (type.isClassType() && type.asClass().isInterface()) || this == Object.class) { return null; Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/DynamicTypeCheck.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/DynamicTypeCheck.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/DynamicTypeCheck.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -282,10 +282,10 @@ if (RHSDimension < LHSDimension) return false; if (RHSDimension > LHSDimension) return true; return RHSType.asArray().getInnermostElementType().isClassType(); // !primitive - } else if (!LHSInnermostElementType.isPrimitiveType()) { + } else if (!(LHSInnermostElementType.isPrimitiveType() || LHSInnermostElementType.isUnboxedType())) { if (RHSDimension == LHSDimension) { RVMType RHSInnermostElementType = RHSType.asArray().getInnermostElementType(); - if (RHSInnermostElementType.isPrimitiveType()) return false; + if ((RHSInnermostElementType.isPrimitiveType() || RHSInnermostElementType.isUnboxedType())) return false; return instanceOfNonArray(LHSInnermostElementType.asClass(), RHSInnermostElementType.getTypeInformationBlock()); } else { // All array types implicitly implement java.lang.Cloneable and java.io.Serializable Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/Primitive.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/Primitive.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/Primitive.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -37,6 +37,7 @@ * @see RVMType * @see RVMClass * @see RVMArray + * @see UnboxedType */ @NonMoving public final class Primitive extends RVMType implements Constants, ClassLoaderConstants { @@ -153,23 +154,7 @@ classForType = Double.TYPE; break; default: - stackWords = 1; - name = tr.getName(); - if (tr == TypeReference.Address || - tr == TypeReference.Word || - tr == TypeReference.Offset || - tr == TypeReference.Extent) { - memoryBytes = BYTES_IN_ADDRESS; - } else if (tr == TypeReference.Code) { - memoryBytes = VM.BuildForIA32 ? BYTES_IN_BYTE : BYTES_IN_INT; - } else { - throw new Error("Unknown primitive type " + tr.getName()); - } - try { - classForType = Class.forName(name.classNameFromDescriptor()); - } catch (Exception e) { - throw new Error("Error getting java.lang.Class wrapper for type " + name.classNameFromDescriptor()); - } + throw new Error("Unknown primitive "+tr.getName().classFileNameFromDescriptor()); } return new Primitive(tr, classForType, name, stackWords, memoryBytes); } @@ -315,6 +300,16 @@ } /** + * @return whether or not this is an unboxed type + */ + @Override + @Pure + @Uninterruptible + public boolean isUnboxedType() { + return false; + } + + /** * Stack space requirement in words. */ @Override Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMArray.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMArray.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMArray.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -40,6 +40,7 @@ * @see RVMType * @see RVMClass * @see Primitive + * @see UnboxedType */ @NonMoving public final class RVMArray extends RVMType implements Constants, ClassLoaderConstants { @@ -415,6 +416,16 @@ } /** + * @return whether or not this is an unboxed type + */ + @Override + @Pure + @Uninterruptible + public boolean isUnboxedType() { + return false; + } + + /** * Constructor * @param typeRef * @param elementType @@ -492,7 +503,7 @@ allocatedTib.setType(this); allocatedTib.setSuperclassIds(superclassIds); allocatedTib.setDoesImplement(doesImplement); - if (!elementType.isPrimitiveType()) { + if (!(elementType.isPrimitiveType()||elementType.isUnboxedType())) { allocatedTib.setArrayElementTib(elementType.getTypeInformationBlock()); } typeInformationBlock = allocatedTib; Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMClass.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMClass.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMClass.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -43,6 +43,7 @@ * @see RVMType * @see RVMArray * @see Primitive + * @see UnboxedType */ @NonMoving public final class RVMClass extends RVMType implements Constants, ClassLoaderConstants { @@ -1930,6 +1931,16 @@ } /** + * @return whether or not this is an unboxed type + */ + @Override + @Pure + @Uninterruptible + public boolean isUnboxedType() { + return false; + } + + /** * Create a synthetic class that extends ReflectionBase and invokes the given method * @param methodToCall the method we wish to call reflectively * @return the synthetic class Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMType.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMType.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMType.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -105,17 +105,17 @@ public static final RVMClass JavaLangRefReferenceType; public static final RVMField JavaLangRefReferenceReferenceField; public static final RVMClass MagicType; - public static final Primitive WordType; + public static final UnboxedType WordType; public static final RVMArray WordArrayType; - public static final Primitive AddressType; + public static final UnboxedType AddressType; public static final RVMArray AddressArrayType; public static final RVMClass ObjectReferenceType; public static final RVMArray ObjectReferenceArrayType; - public static final Primitive OffsetType; + public static final UnboxedType OffsetType; public static final RVMArray OffsetArrayType; - public static final Primitive ExtentType; + public static final UnboxedType ExtentType; public static final RVMArray ExtentArrayType; - public static final Primitive CodeType; + public static final UnboxedType CodeType; public static final RVMArray CodeArrayType; public static final RVMClass TIBType; public static final RVMClass ITableType; @@ -137,11 +137,11 @@ DoubleType = TypeReference.Double.resolve().asPrimitive(); CharType = TypeReference.Char.resolve().asPrimitive(); // Jikes RVM primitives - AddressType = TypeReference.Address.resolve().asPrimitive(); - WordType = TypeReference.Word.resolve().asPrimitive(); - OffsetType = TypeReference.Offset.resolve().asPrimitive(); - ExtentType = TypeReference.Extent.resolve().asPrimitive(); - CodeType = TypeReference.Code.resolve().asPrimitive(); + AddressType = TypeReference.Address.resolve().asUnboxedType(); + WordType = TypeReference.Word.resolve().asUnboxedType(); + OffsetType = TypeReference.Offset.resolve().asUnboxedType(); + ExtentType = TypeReference.Extent.resolve().asUnboxedType(); + CodeType = TypeReference.Code.resolve().asUnboxedType(); ObjectReferenceType = TypeReference.ObjectReference.resolve().asClass(); // Jikes RVM classes MagicType = TypeReference.Magic.resolve().asClass(); @@ -399,6 +399,13 @@ return (Primitive) this; } + /** + * @return this cast to a UnboxedType + */ + @Uninterruptible + public final UnboxedType asUnboxedType() { + return (UnboxedType) this; + } // Convenience methods. // /** @return is this type void? */ @@ -704,6 +711,12 @@ public abstract boolean isPrimitiveType(); /** + * @return whether or not this is an unboxed type + */ + @Uninterruptible + public abstract boolean isUnboxedType(); + + /** * @return whether or not this is a reference (ie non-primitive) type. */ @Uninterruptible Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/TypeReference.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/TypeReference.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/TypeReference.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -809,7 +809,11 @@ } } } else { - setType(Primitive.createPrimitive(this)); + if (isUnboxedType()) { + setType(UnboxedType.createUnboxedType(this)); + } else { + setType(Primitive.createPrimitive(this)); + } } return type; } Added: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/UnboxedType.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/UnboxedType.java (rev 0) +++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/UnboxedType.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -0,0 +1,373 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.jikesrvm.classloader; + +import org.jikesrvm.Constants; +import org.jikesrvm.VM; +import org.jikesrvm.objectmodel.TIB; +import org.vmmagic.pragma.NonMoving; +import org.vmmagic.pragma.Pure; +import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.unboxed.Offset; + +/** + * Description of an Unboxed Magic type. + * + * Currently, unboxed types are restricted to be values that can fit in a single machines word. + * + * @see RVMType + * @see RVMClass + * @see RVMArray + * @see Primitive + */ +@NonMoving +public final class UnboxedType extends RVMType implements Constants, ClassLoaderConstants { + /** + * The pretty (external) name for this Unboxed type. + */ + private final Atom name; + + /** + * How many slots in the Java Expression Stack does it take + * to hold a value of this primitive type? + */ + private final int stackWords; + + /** + * How many bytes in memory does it take to hold a value of this + * primitive type? + */ + private final int memoryBytes; + + /** + * Name - something like "int". + */ + @Override + @Pure + public String toString() { + return name.toString(); + } + + /** + * Constructor + * @param tr The canonical type reference for this primitive + * @param classForType The java.lang.Class representation + * @param name The name for this primitive + * @param stackWords The stack slots used by this primitive + * @param memoryBytes The bytes in memory used by this primitive + */ + private UnboxedType(TypeReference tr, Class<?> classForType, Atom name, int stackWords, int memoryBytes) { + super(tr, // type reference + classForType, // j.l.Class representation + -1, // dimensionality + null // runtime visible annotations + ); + this.name = name; + this.stackWords = stackWords; + this.memoryBytes = memoryBytes; + this.depth = 0; + } + + /** + * Create an instance of a {@link UnboxedType} + * @param tr The canonical type reference for this primitive + */ + static UnboxedType createUnboxedType(TypeReference tr) { + Atom name; + int stackWords = 1; + int memoryBytes; + Class<?> classForType; + + name = tr.getName(); + if (tr == TypeReference.Address || + tr == TypeReference.Word || + tr == TypeReference.Offset || + tr == TypeReference.Extent) { + memoryBytes = BYTES_IN_ADDRESS; + } else if (tr == TypeReference.Code) { + memoryBytes = VM.BuildForIA32 ? BYTES_IN_BYTE : BYTES_IN_INT; + } else { + throw new Error("Unknown unboxed type " + tr.getName()); + } + try { + classForType = Class.forName(name.classNameFromDescriptor()); + } catch (Exception e) { + throw new Error("Error getting java.lang.Class wrapper for type " + name.classNameFromDescriptor()); + } + + return new UnboxedType(tr, classForType, name, stackWords, memoryBytes); + } + + /** + * get number of superclasses to Object + * @return 0 + */ + @Override + @Pure + @Uninterruptible + public int getTypeDepth() { + return 0; + } + + /** + * Reference Count GC: Is a reference of this type contained in + * another object inherently acyclic (without cycles) ? + * @return true + */ + @Override + @Pure + @Uninterruptible + public boolean isAcyclicReference() { + return true; + } + + /** + * Number of [ in descriptor for arrays; -1 for primitives; 0 for + * classes + * @return -1; + */ + @Override + @Pure + @Uninterruptible + public int getDimensionality() { + return -1; + } + + /** + * Resolution status. + * @return true + */ + @Override + @Uninterruptible + public boolean isResolved() { + return true; + } + + /** + * Instantiation status. + * @return true + */ + @Override + @Pure + @Uninterruptible + public boolean isInstantiated() { + return true; + } + + /** + * Initialization status. + * @return true + */ + @Override + @Pure + @Uninterruptible + public boolean isInitialized() { + return true; + } + + /** + * Only intended to be used by the BootImageWriter + */ + @Override + public void markAsBootImageClass() {} + + /** + * Is this class part of the virtual machine's boot image? + */ + @Override + @Pure + @Uninterruptible + public boolean isInBootImage() { + return true; + } + + /** + * Get the offset in instances of this type assigned to the thin + * lock word. Offset.max() if instances of this type do not have thin lock + * words. + * @return Offset.max(); + */ + @Override + @Pure + @Uninterruptible + public Offset getThinLockOffset() { + if (VM.VerifyAssertions) VM._assert(NOT_REACHED); + return Offset.max(); + } + + /** + * Whether or not this is an instance of RVMClass? + * @return false + */ + @Override + @Pure + @Uninterruptible + public boolean isClassType() { + return false; + } + + /** + * Whether or not this is an instance of RVMArray? + * @return false + */ + @Override + @Pure + @Uninterruptible + public boolean isArrayType() { + return false; + } + + /** + * Whether or not this is a primitive type + * @return true + */ + @Override + @Pure + @Uninterruptible + public boolean isPrimitiveType() { + return false; + } + + /** + * @return whether or not this is a reference (ie non-primitive) type. + */ + @Override + @Pure + @Uninterruptible + public boolean isReferenceType() { + return false; + } + + /** + * @return whether or not this is an unboxed type + */ + @Override + @Pure + @Uninterruptible + public boolean isUnboxedType() { + return true; + } + + /** + * Stack space requirement in words. + */ + @Override + @Pure + @Uninterruptible + public int getStackWords() { + return stackWords; + } + + /** + * Space required in memory in bytes. + */ + @Override + @Pure + @Uninterruptible + public int getMemoryBytes() { + return memoryBytes; + } + + /** + * Cause resolution to take place. + */ + @Override + @Pure + public void resolve() {} + + @Override + public void allBootImageTypesResolved() { } + + /** + * Cause instantiation to take place. + */ + @Override + @Pure + public void instantiate() {} + + /** + * Cause initialization to take place. + */ + @Override + @Pure + public void initialize() {} + + /** + * Does this type override java.lang.Object.finalize()? + */ + @Override + @Pure + @Uninterruptible + public boolean hasFinalizer() { + return false; + } + + /* + * Primitives are not first class objects - + * but the implementation of reflection is cleaner if + * we pretend that they are and provide dummy implementations of + * the following methods + */ + + /** + * Static fields of this class/array type. + * @return zero length array + */ + @Override + @Pure + public RVMField[] getStaticFields() { + return emptyVMField; + } + + /** + * Non-static fields of this class/array type + * (composed with supertypes, if any). + * @return zero length array + */ + @Override + @Pure + public RVMField[] getInstanceFields() { + return emptyVMField; + } + + /** + * Statically dispatched methods of this class/array type. + * @return zero length array + */ + @Override + @Pure + public RVMMethod[] getStaticMethods() { + return emptyVMMethod; + } + + /** + * Virtually dispatched methods of this class/array type + * (composed with supertypes, if any). + * @return zero length array + */ + @Override + @Pure + public RVMMethod[] getVirtualMethods() { + return emptyVMMethod; + } + + /** + * Runtime type information for this class/array type. + */ + @Override + @Uninterruptible + public TIB getTypeInformationBlock() { + if (VM.VerifyAssertions) VM._assert(NOT_REACHED); + return null; + } +} Property changes on: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/UnboxedType.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/TemplateCompilerFramework.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/TemplateCompilerFramework.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/baseline/TemplateCompilerFramework.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -1680,7 +1680,8 @@ } // else fall through to emit_checkcast } else if (type.isArrayType()) { RVMType elemType = type.asArray().getElementType(); - if (elemType.isPrimitiveType() || (elemType.isClassType() && elemType.asClass().isFinal())) { + if (elemType.isPrimitiveType() || elemType.isUnboxedType() || + (elemType.isClassType() && elemType.asClass().isFinal())) { emit_checkcast_final(type); break; } // else fall through to emit_checkcast @@ -1717,7 +1718,8 @@ } } else if (type.isArrayType()) { RVMType elemType = type.asArray().getElementType(); - if (elemType.isPrimitiveType() || (elemType.isClassType() && elemType.asClass().isFinal())) { + if (elemType.isPrimitiveType() || elemType.isUnboxedType() || + (elemType.isClassType() && elemType.asClass().isFinal())) { emit_instanceof_final(type); break; } Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/FieldAnalysis.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/FieldAnalysis.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/FieldAnalysis.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -72,7 +72,7 @@ private static boolean isCandidate(TypeReference tref) { RVMType t = tref.peekType(); if (t == null) return false; - if (t.isPrimitiveType()) { + if (t.isPrimitiveType() || t.isUnboxedType()) { return false; } if (t.isClassType() && t.asClass().isFinal()) { Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -756,7 +756,8 @@ RVMType typeOfIMElem = arrayTypeRef.getInnermostElementType().peekType(); if (typeOfIMElem != null) { RVMType typeOfVal = val.getType().peekType(); - if ((typeOfIMElem == typeOfVal) && (typeOfIMElem.isPrimitiveType() || typeOfIMElem.asClass().isFinal())) { + if ((typeOfIMElem == typeOfVal) && + (typeOfIMElem.isPrimitiveType() || typeOfIMElem.isUnboxedType() || typeOfIMElem.asClass().isFinal())) { // Writing something of a final type to an array of that // final type is safe Move.mutate(s, GUARD_MOVE, StoreCheck.getClearGuardResult(s), StoreCheck.getClearGuard(s)); @@ -799,7 +800,8 @@ RVMType typeOfIMElem = arrayTypeRef.getInnermostElementType().peekType(); if (typeOfIMElem != null) { RVMType typeOfVal = val.getType().peekType(); - if ((typeOfIMElem == typeOfVal) && (typeOfIMElem.isPrimitiveType() || typeOfIMElem.asClass().isFinal())) { + if ((typeOfIMElem == typeOfVal) && + (typeOfIMElem.isPrimitiveType() || typeOfIMElem.isUnboxedType() || typeOfIMElem.asClass().isFinal())) { // Writing something of a final type to an array of that // final type is safe Move.mutate(s, GUARD_MOVE, StoreCheck.getClearGuardResult(s), StoreCheck.getClearGuard(s)); Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/bc2ir/BC2IR.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -3826,7 +3826,7 @@ } while (elemType2.isArrayType()); RVMType et2 = elemType2.peekType(); if (et2 != null) { - if (et2.isPrimitiveType() || ((RVMClass) et2).isFinal()) { + if (et2.isPrimitiveType() || et2.isUnboxedType() || ((RVMClass) et2).isFinal()) { TypeReference myElemType = getRefTypeOf(elem); if (myElemType == elemType) { if (DBG_TYPE) { Modified: rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/DynamicTypeCheckExpansion.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/DynamicTypeCheckExpansion.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/compilers/opt/hir2lir/DynamicTypeCheckExpansion.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -745,7 +745,7 @@ RVMArray LHSArray = (RVMArray) LHStype.peekType(); if (LHSArray != null) { RVMType innermostElementType = LHSArray.getInnermostElementType(); - if (innermostElementType.isPrimitiveType() || + if (innermostElementType.isPrimitiveType() || innermostElementType.isUnboxedType() || (innermostElementType.asClass().isResolved() && innermostElementType.asClass().isFinal())) { // [^k of primitive or [^k of final class. Just like final classes, // a PTR compare of rhsTIB and the TIB of the class gives the answer. @@ -980,7 +980,7 @@ if (LHSArray != null) { Operand classTIB = getTIB(continueAt, ir, LHSArray); RVMType innermostElementType = LHSArray.getInnermostElementType(); - if (innermostElementType.isPrimitiveType() || + if (innermostElementType.isPrimitiveType() || innermostElementType.isUnboxedType() || (innermostElementType.asClass().isResolved() && innermostElementType.asClass().isFinal())) { // [^k of primitive or [^k of final class. Just like final classes, // a PTR compare of rhsTIB and the TIB of the class gives the answer. Modified: rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIFunctions.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIFunctions.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/jni/JNIFunctions.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -462,7 +462,7 @@ try { Class<?> javaCls = (Class<?>) env.getJNIRef(classJREF); RVMType type = java.lang.JikesRVMSupport.getTypeForClass(javaCls); - if (type.isArrayType() || type.isPrimitiveType()) { + if (type.isArrayType() || type.isPrimitiveType() || type.isUnboxedType()) { env.recordException(new InstantiationException()); return 0; } @@ -4105,7 +4105,8 @@ } RVMArray arrayType = Magic.getObjectType(sourceArray).asArray(); - if (arrayType.getElementType().isPrimitiveType()) { + RVMType elementType = arrayType.getElementType(); + if (elementType.isPrimitiveType() || elementType.isUnboxedType()) { return 0; } Modified: rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -606,8 +606,11 @@ @Interruptible private static int pickAllocatorForType(RVMType type) { int allocator = Plan.ALLOC_DEFAULT; - if (type.isArrayType() && type.asArray().getElementType().isPrimitiveType()) { - allocator = Plan.ALLOC_NON_REFERENCE; + if (type.isArrayType()) { + RVMType elementType = type.asArray().getElementType(); + if (elementType.isPrimitiveType() || elementType.isUnboxedType()){ + allocator = Plan.ALLOC_NON_REFERENCE; + } } if(type.isNonMoving()) { allocator = Plan.ALLOC_NON_MOVING; Modified: rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java =================================================================== --- rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java 2009-01-16 14:04:11 UTC (rev 15286) +++ rvmroot/trunk/tools/bootImageWriter/src/org/jikesrvm/tools/bootImageWriter/BootImageWriter.java 2009-01-16 19:06:41 UTC (rev 15287) @@ -3109,7 +3109,7 @@ for (int i = FIRST_TYPE_DICTIONARY_INDEX; i < RVMType.numTypes(); ++i) { RVMType type = RVMType.getType(i); if (type == null) continue; - if (type.isPrimitiveType()) + if (type.isPrimitiveType() || type.isUnboxedType()) continue; if (!type.isResolved()) continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |