use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method GetLongField.
/**
* GetLongField: read an instance field of type long
* @param env A JREF index for the JNI environment object
* @param objJREF a JREF index for the target object
* @param fieldID the id for the RVMField that describes this field
* @return the value of the long field or 0 if the fieldID is incorrect
*/
private static long GetLongField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetLongField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return field.getLongValueUnchecked(obj);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0L;
}
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method GetFloatField.
/**
* GetFloatField: read an instance field of type float
* @param env A JREF index for the JNI environment object
* @param objJREF a JREF index for the target object
* @param fieldID the id for the RVMField that describes this field
* @return the value of the float field or 0 if the fieldID is incorrect
*/
private static float GetFloatField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetFloatField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return field.getFloatValueUnchecked(obj);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0f;
}
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetDoubleField.
/**
* SetDoubleField: set an instance field of type double
* @param env A JREF index for the JNI environment object
* @param objJREF a JREF index for the target object
* @param fieldID the id for the RVMField that describes this field
* @param value double value to assign
*/
private static void SetDoubleField(JNIEnvironment env, int objJREF, int fieldID, double value) {
if (traceJNI)
VM.sysWriteln("JNI called: SetDoubleField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setDoubleValueUnchecked(obj, value);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
}
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetStaticCharField.
/**
* SetStaticCharField: set a static field of type char
* @param env A JREF index for the JNI environment object
* @param classJREF a JREF index for the RVMClass object
* @param fieldID the id for the RVMField that describes this field
* @param fieldValue The value to assign
*/
private static void SetStaticCharField(JNIEnvironment env, int classJREF, int fieldID, char fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticCharField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setCharValueUnchecked(null, fieldValue);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
}
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetStaticByteField.
/**
* SetStaticByteField: set a static field of type byte
* @param env A JREF index for the JNI environment object
* @param classJREF a JREF index for the RVMClass object
* @param fieldID the id for the RVMField that describes this field
* @param fieldValue the value to assign
*/
private static void SetStaticByteField(JNIEnvironment env, int classJREF, int fieldID, byte fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticByteField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setByteValueUnchecked(null, fieldValue);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
}
}
Aggregations