Search in sources :

Example 41 with TypeReference

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

the class VMCommonLibrarySupport method setCharInternal.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 2 })
private static void setCharInternal(Object object, char value, RVMField field) throws IllegalArgumentException {
    TypeReference type = field.getType();
    if (type.isCharType())
        field.setCharValueUnchecked(object, value);
    else if (type.isLongType())
        field.setLongValueUnchecked(object, value);
    else if (type.isIntType())
        field.setIntValueUnchecked(object, value);
    else if (type.isShortType())
        field.setShortValueUnchecked(object, (short) value);
    else if (type.isDoubleType())
        field.setDoubleValueUnchecked(object, value);
    else if (type.isFloatType())
        field.setFloatValueUnchecked(object, value);
    else
        throwNewIllegalArgumentException("field type mismatch");
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 42 with TypeReference

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

the class VMCommonLibrarySupport method getLong.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1 })
static long getLong(Object object, RVMField field, Field jlrField, RVMClass accessingClass) throws IllegalAccessException, IllegalArgumentException {
    checkReadAccess(object, field, jlrField, accessingClass);
    TypeReference type = field.getType();
    if (type.isLongType()) {
        return field.getLongValueUnchecked(object);
    } else if (type.isIntType()) {
        return field.getIntValueUnchecked(object);
    } else if (type.isShortType()) {
        return field.getShortValueUnchecked(object);
    } else if (type.isCharType()) {
        return field.getCharValueUnchecked(object);
    } else if (type.isByteType()) {
        return field.getByteValueUnchecked(object);
    } else {
        throwNewIllegalArgumentException("field type mismatch");
        return 0L;
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 43 with TypeReference

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

the class VMCommonLibrarySupport method getChar.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1 })
static char getChar(Object object, RVMField field, Field jlrField, RVMClass accessingClass) throws IllegalAccessException, IllegalArgumentException {
    checkReadAccess(object, field, jlrField, accessingClass);
    TypeReference type = field.getType();
    if (!type.isCharType())
        throwNewIllegalArgumentException("field type mismatch");
    return field.getCharValueUnchecked(object);
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 44 with TypeReference

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

the class GenerationContextTest method specializedParametersAreNotSanityChecked.

@Test
public void specializedParametersAreNotSanityChecked() throws Exception {
    Class<?>[] argumentTypes = { Object.class };
    TypeReference[] specializedArgumentTypes = {};
    NormalMethod nm = getNormalMethodForTest("emptyStaticMethodWithObjectParam", argumentTypes);
    CompiledMethod cm = new OptCompiledMethod(-1, nm);
    OptOptions opts = new OptOptions();
    InlineOracle io = new DefaultInlineOracle();
    GenerationContext gc = new GenerationContext(nm, specializedArgumentTypes, cm, opts, io);
    assertThatNumberOfParametersIs(gc, 0);
}
Also used : OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) InlineOracle(org.jikesrvm.compilers.opt.inlining.InlineOracle) NormalMethod(org.jikesrvm.classloader.NormalMethod) DefaultInlineOracle(org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle) OptOptions(org.jikesrvm.compilers.opt.OptOptions) TypeReference(org.jikesrvm.classloader.TypeReference) OptCompiledMethod(org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Test(org.junit.Test)

Example 45 with TypeReference

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

the class GenerationContextTest method makeLocalUsesLocalRegToDetermineRegisters.

@Test
public void makeLocalUsesLocalRegToDetermineRegisters() throws Exception {
    NormalMethod nm = TestingTools.getNormalMethod(MethodsForTests.class, "emptyInstanceMethodWithoutAnnotations");
    OptOptions opts = new OptOptions();
    GenerationContext gc = new GenerationContext(nm, null, null, opts, null);
    int localNumber = 0;
    TypeReference localType = nm.getDeclaringClass().getTypeRef();
    Register expectedRegister = gc.localReg(localNumber, localType);
    RegisterOperand regOp = gc.makeLocal(localNumber, localType);
    assertSame(expectedRegister, regOp.getRegister());
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Register(org.jikesrvm.compilers.opt.ir.Register) NormalMethod(org.jikesrvm.classloader.NormalMethod) OptOptions(org.jikesrvm.compilers.opt.OptOptions) TypeReference(org.jikesrvm.classloader.TypeReference) Test(org.junit.Test)

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