Search in sources :

Example 26 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class Barriers method putfieldStoreBarrierHelper.

/**
 * Private helper method for primitive putfields
 *
 * @param asm the assembler to generate the code in
 * @param compiler the compiler instance to ensure correct parameter passing
 * @param offset the register holding the offset of the field
 * @param locationMetadata meta-data about the location
 * @param barrier the barrier method to call
 */
@Inline
private static void putfieldStoreBarrierHelper(Assembler asm, BaselineCompilerImpl compiler, GPR offset, int locationMetadata, NormalMethod barrier) {
    // on entry the java stack contains... |object|value|
    asm.emitPUSH_Reg(offset);
    asm.emitPUSH_Imm(locationMetadata);
    // Use the correct calling convention to pass parameters by register and the stack
    // (size of value varies by type of putfield)
    MethodReference method = barrier.getMemberRef().asMethodReference();
    compiler.genParameterRegisterLoad(method, false);
    genNullCheck(asm, T0);
    asm.generateJTOCcall(barrier.getOffset());
}
Also used : MethodReference(org.jikesrvm.classloader.MethodReference) Inline(org.vmmagic.pragma.Inline)

Example 27 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class VMCommonLibrarySupport method getInt.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1 })
static int getInt(Object object, RVMField field, Field jlrField, RVMClass accessingClass) throws IllegalAccessException, IllegalArgumentException {
    checkReadAccess(object, field, jlrField, accessingClass);
    TypeReference type = field.getType();
    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 0;
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 28 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class VMCommonLibrarySupport method getDouble.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1 })
static double getDouble(Object object, RVMField field, Field jlrField, RVMClass accessingClass) throws IllegalAccessException, IllegalArgumentException {
    checkReadAccess(object, field, jlrField, accessingClass);
    TypeReference type = field.getType();
    if (type.isDoubleType()) {
        return field.getDoubleValueUnchecked(object);
    } else if (type.isFloatType()) {
        return field.getFloatValueUnchecked(object);
    } else 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 0.0d;
    }
}
Also used : TypeReference(org.jikesrvm.classloader.TypeReference) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 29 with Inline

use of org.vmmagic.pragma.Inline 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 30 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class VMCommonLibrarySupport method set.

@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 2 })
static void set(Object object, Object value, RVMField field, Field jlrField, RVMClass accessingClass) throws IllegalAccessException, IllegalArgumentException {
    checkWriteAccess(object, field, jlrField, accessingClass);
    if (field.isReferenceType()) {
        if (value != null) {
            RVMType valueType = ObjectModel.getObjectType(value);
            RVMType fieldType = null;
            try {
                fieldType = field.getType().resolve();
            } catch (NoClassDefFoundError e) {
                throwNewIllegalArgumentException("field type mismatch");
            }
            if (fieldType != valueType && !RuntimeEntrypoints.isAssignableWith(fieldType, valueType)) {
                throwNewIllegalArgumentException("field type mismatch");
            }
        }
        field.setObjectValueUnchecked(object, value);
    } else if (value instanceof Character) {
        setCharInternal(object, (Character) value, field);
    } else if (value instanceof Double) {
        setDoubleInternal(object, (Double) value, field);
    } else if (value instanceof Float) {
        setFloatInternal(object, (Float) value, field);
    } else if (value instanceof Long) {
        setLongInternal(object, (Long) value, field);
    } else if (value instanceof Integer) {
        setIntInternal(object, (Integer) value, field);
    } else if (value instanceof Short) {
        setShortInternal(object, (Short) value, field);
    } else if (value instanceof Byte) {
        setByteInternal(object, (Byte) value, field);
    } else if (value instanceof Boolean) {
        setBooleanInternal(object, (Boolean) value, field);
    } else {
        throw new IllegalArgumentException("field type mismatch");
    }
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Aggregations

Inline (org.vmmagic.pragma.Inline)110 NoInline (org.vmmagic.pragma.NoInline)42 Entrypoint (org.vmmagic.pragma.Entrypoint)40 Offset (org.vmmagic.unboxed.Offset)38 ObjectReference (org.vmmagic.unboxed.ObjectReference)35 Address (org.vmmagic.unboxed.Address)15 Word (org.vmmagic.unboxed.Word)15 TypeReference (org.jikesrvm.classloader.TypeReference)12 Uninterruptible (org.vmmagic.pragma.Uninterruptible)6 RVMType (org.jikesrvm.classloader.RVMType)5 RVMClass (org.jikesrvm.classloader.RVMClass)4 Unpreemptible (org.vmmagic.pragma.Unpreemptible)4 RVMClassLoader (org.jikesrvm.classloader.RVMClassLoader)3 TIB (org.jikesrvm.objectmodel.TIB)3 Extent (org.vmmagic.unboxed.Extent)3 MethodReference (org.jikesrvm.classloader.MethodReference)2 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2 CollectorContext (org.mmtk.plan.CollectorContext)2 NoNullCheck (org.vmmagic.pragma.NoNullCheck)2