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());
}
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;
}
}
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;
}
}
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");
}
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");
}
}
Aggregations