Search in sources :

Example 6 with J9ArrayClassPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer in project openj9 by eclipse.

the class J9ClassHelper method getRawModifiers.

/**
 * Returns "raw" modifiers
 *
 * Derived from logic in J9VMJavaLangClassNativesCDLC.getModifiersImpl
 * @param j9class
 * @return
 * @throws CorruptDataException
 */
public static int getRawModifiers(J9ClassPointer j9class) throws CorruptDataException {
    if (J9ClassHelper.isArrayClass(j9class)) {
        J9ArrayClassPointer arrayClass = J9ArrayClassPointer.cast(j9class);
        U32 modifiers = arrayClass.leafComponentType().romClass().modifiers();
        // OR in the bogus Sun bits
        modifiers = modifiers.bitOr(J9JavaAccessFlags.J9AccAbstract);
        modifiers = modifiers.bitOr(J9JavaAccessFlags.J9AccFinal);
        return modifiers.intValue();
    } else {
        U32 modifiers = j9class.romClass().modifiers();
        if (j9class.romClass().outerClassName().notNull()) {
            modifiers = j9class.romClass().memberAccessFlags();
        }
        return modifiers.intValue();
    }
}
Also used : U32(com.ibm.j9ddr.vm29.types.U32) J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 7 with J9ArrayClassPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer in project openj9 by eclipse.

the class J9ClassHelper method getArrayName.

public static String getArrayName(J9ClassPointer clazz) throws CorruptDataException {
    J9ArrayClassPointer arrayClass = J9ArrayClassPointer.cast(clazz);
    StringBuilder name = new StringBuilder();
    int arity = 0;
    try {
        arity = arrayClass.arity().intValue();
    } catch (InvalidDataTypeException e) {
        throw new AddressedCorruptDataException(arrayClass.getAddress(), "Array arity larger than MAXINT");
    }
    if (arity > MAXIMUM_ARRAY_ARITY) {
        // Doubtful
        throw new AddressedCorruptDataException(arrayClass.getAddress(), "Very high arity " + arity + " from array class 0x" + Long.toHexString(arrayClass.getAddress()));
    }
    for (int i = 0; i < arity; i++) {
        name.append('[');
    }
    String elementClassName = J9ClassHelper.getName(arrayClass.leafComponentType());
    Character type = TYPE_MAP.get(elementClassName);
    if (type != null) {
        name.append(type);
    } else {
        name.append('L');
        name.append(elementClassName);
        name.append(";");
    }
    return name.toString();
}
Also used : J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer) AddressedCorruptDataException(com.ibm.j9ddr.AddressedCorruptDataException) InvalidDataTypeException(com.ibm.j9ddr.InvalidDataTypeException)

Aggregations

J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)4 U32 (com.ibm.j9ddr.vm29.types.U32)3 AddressedCorruptDataException (com.ibm.j9ddr.AddressedCorruptDataException)1 InvalidDataTypeException (com.ibm.j9ddr.InvalidDataTypeException)1 J9ROMArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMArrayClassPointer)1