use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method GetStaticObjectField.
/**
* GetStaticObjectField: read a static field of type Object
* @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
* @return the value of the Object field, converted to a JREF index
* or 0 if the fieldID is incorrect
*/
private static int GetStaticObjectField(JNIEnvironment env, int classJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetStaticObjectField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
Object value = field.getObjectUnchecked(null);
return env.pushJNIRef(value);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0;
}
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetStaticBooleanField.
/**
* SetStaticBooleanField: set a static field of type boolean
* @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 SetStaticBooleanField(JNIEnvironment env, int classJREF, int fieldID, boolean fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticBooleanField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setBooleanValueUnchecked(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 SetStaticFloatField.
/**
* SetStaticFloatField: set a static field of type float
* @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 SetStaticFloatField(JNIEnvironment env, int classJREF, int fieldID, float fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticFloatField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setFloatValueUnchecked(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 SetStaticShortField.
/**
* SetStaticShortField: set a static field of type short
* @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 SetStaticShortField(JNIEnvironment env, int classJREF, int fieldID, short fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticShortField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setShortValueUnchecked(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 GetBooleanField.
/**
* GetBooleanField: read an instance field of type boolean
* @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 boolean field, or 0 if the fieldID is incorrect
*/
private static int GetBooleanField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetBooleanField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return field.getBooleanValueUnchecked(obj) ? 1 : 0;
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
return 0;
}
}
Aggregations