Search in sources :

Example 6 with TypeReference

use of org.jikesrvm.classloader.TypeReference in project JikesRVM by JikesRVM.

the class NonFinalReferenceDensityComparator method compare.

@Override
public int compare(BootImageMap.Entry a, BootImageMap.Entry b) {
    TypeReference aRef = TypeReference.findOrCreate(a.getJdkObject().getClass());
    TypeReference bRef = TypeReference.findOrCreate(b.getJdkObject().getClass());
    if ((!aRef.isResolved() && !bRef.isResolved()) || (aRef == bRef)) {
        return identicalSizeComparator.compare(a, b);
    } else if (!aRef.isResolved()) {
        return 1;
    } else if (!bRef.isResolved()) {
        return -1;
    } else {
        double aSize = (double) getNumberOfNonFinalReferences(aRef.peekType(), a.getJdkObject()) / (double) getSize(aRef.peekType(), a.getJdkObject());
        double bSize = (double) getNumberOfNonFinalReferences(bRef.peekType(), b.getJdkObject()) / (double) getSize(bRef.peekType(), b.getJdkObject());
        int result = Double.compare(bSize, aSize);
        if (result == 0) {
            return identicalSizeComparator.compare(a, b);
        } else {
            return result;
        }
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference)

Example 7 with TypeReference

use of org.jikesrvm.classloader.TypeReference in project JikesRVM by JikesRVM.

the class NumberOfReferencesComparator method compare.

@Override
public int compare(BootImageMap.Entry a, BootImageMap.Entry b) {
    TypeReference aRef = TypeReference.findOrCreate(a.getJdkObject().getClass());
    TypeReference bRef = TypeReference.findOrCreate(b.getJdkObject().getClass());
    if ((!aRef.isResolved() && !bRef.isResolved()) || (aRef == bRef)) {
        return identicalSizeComparator.compare(a, b);
    } else if (!aRef.isResolved()) {
        return 1;
    } else if (!bRef.isResolved()) {
        return -1;
    } else {
        int aSize = getNumberOfReferences(aRef.peekType(), a.getJdkObject());
        int bSize = getNumberOfReferences(bRef.peekType(), b.getJdkObject());
        if (aSize == bSize) {
            return identicalSizeComparator.compare(a, b);
        } else {
            return bSize - aSize;
        }
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference)

Example 8 with TypeReference

use of org.jikesrvm.classloader.TypeReference in project JikesRVM by JikesRVM.

the class ObjectSizeComparator method compare.

@Override
public int compare(BootImageMap.Entry a, BootImageMap.Entry b) {
    TypeReference aRef = TypeReference.findOrCreate(a.getJdkObject().getClass());
    TypeReference bRef = TypeReference.findOrCreate(b.getJdkObject().getClass());
    if ((!aRef.isResolved() && !bRef.isResolved()) || (aRef == bRef)) {
        return identicalSizeComparator.compare(a, b);
    } else if (!aRef.isResolved()) {
        return -1;
    } else if (!bRef.isResolved()) {
        return 1;
    } else {
        int aSize = getSize(aRef.peekType(), a.getJdkObject());
        int bSize = getSize(bRef.peekType(), b.getJdkObject());
        if (aSize == bSize) {
            return identicalSizeComparator.compare(a, b);
        } else {
            return aSize - bSize;
        }
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference)

Example 9 with TypeReference

use of org.jikesrvm.classloader.TypeReference in project JikesRVM by JikesRVM.

the class TypeReferenceComparator method compare.

@Override
public int compare(BootImageMap.Entry a, BootImageMap.Entry b) {
    TypeReference aRef = TypeReference.findOrCreate(a.getJdkObject().getClass());
    TypeReference bRef = TypeReference.findOrCreate(b.getJdkObject().getClass());
    return aRef.getId() - bRef.getId();
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference)

Example 10 with TypeReference

use of org.jikesrvm.classloader.TypeReference in project JikesRVM by JikesRVM.

the class JNIHelpers method packageParameterFromVarArg.

/**
 * Repackage the arguments passed as a variable argument list into an array of Object,
 * used by the JNI functions CallStatic<type>MethodV
 * @param targetMethod   The target {@link RVMMethod}
 * @param argAddress an address into the C space for the array of jvalue unions;
 *                   each element is 2-word and holds the argument of the appropriate type
 * @return an Object array holding the arguments wrapped at Objects
 */
static Object[] packageParameterFromVarArg(MethodReference targetMethod, Address argAddress) {
    TypeReference[] argTypes = targetMethod.getParameterTypes();
    int argCount = argTypes.length;
    Object[] argObjectArray = new Object[argCount];
    Address vaListCopy = SysCall.sysCall.sysVaCopy(argAddress);
    JNIEnvironment env = RVMThread.getCurrentThread().getJNIEnv();
    for (int i = 0; i < argCount; i++) {
        // convert and wrap the argument according to the expected type
        if (argTypes[i].isReferenceType()) {
            argObjectArray[i] = env.getJNIRef(SysCall.sysCall.sysVaArgJobject(vaListCopy));
        } else if (argTypes[i].isIntType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJint(vaListCopy);
        } else if (argTypes[i].isLongType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJlong(vaListCopy);
        } else if (argTypes[i].isBooleanType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJboolean(vaListCopy);
        } else if (argTypes[i].isByteType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJbyte(vaListCopy);
        } else if (argTypes[i].isCharType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJchar(vaListCopy);
        } else if (argTypes[i].isShortType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJshort(vaListCopy);
        } else if (argTypes[i].isFloatType()) {
            argObjectArray[i] = SysCall.sysCall.sysVaArgJfloat(vaListCopy);
        } else {
            if (VM.VerifyAssertions)
                VM._assert(argTypes[i].isDoubleType());
            argObjectArray[i] = SysCall.sysCall.sysVaArgJdouble(vaListCopy);
        }
    }
    SysCall.sysCall.sysVaEnd(vaListCopy);
    return argObjectArray;
}
Also used : Address(org.vmmagic.unboxed.Address) JNIEnvironment(org.jikesrvm.jni.JNIEnvironment) TypeReference(org.jikesrvm.classloader.TypeReference)

Aggregations

TypeReference (org.jikesrvm.classloader.TypeReference)164 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)58 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)43 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)38 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)30 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)28 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)27 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)25 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)24 RVMClass (org.jikesrvm.classloader.RVMClass)23 RVMField (org.jikesrvm.classloader.RVMField)21 Register (org.jikesrvm.compilers.opt.ir.Register)21 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)21 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)21 Address (org.vmmagic.unboxed.Address)21 RVMType (org.jikesrvm.classloader.RVMType)18 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)18 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)18 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)18 RVMMethod (org.jikesrvm.classloader.RVMMethod)17