use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetStaticLongField.
/**
* SetStaticLongField: set a static field of type long
* @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 SetStaticLongField(JNIEnvironment env, int classJREF, int fieldID, long fieldValue) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticLongField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setLongValueUnchecked(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 GetCharField.
/**
* GetCharField: read an instance field of type character
* @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 character field, or 0 if the fieldID is incorrect
*/
private static int GetCharField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetCharField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return field.getCharValueUnchecked(obj);
} 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 GetByteField.
/**
* GetByteField: read an instance field of type byte
* @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 byte field, or 0 if the fieldID is incorrect
*/
private static int GetByteField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetByteField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return field.getByteValueUnchecked(obj);
} 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 FromReflectedField.
/**
* FromReflectedField
* @param env A JREF index for the JNI environment object
* @param fieldJREF a JREF index for a java.lang.reflect.Field methodID
* @return the jfieldID corresponding to fieldJREF
*/
private static int FromReflectedField(JNIEnvironment env, int fieldJREF) {
if (traceJNI)
VM.sysWriteln("JNI called: FromReflectedField");
RuntimeEntrypoints.checkJNICountDownToGC();
Field fieldObj = (Field) env.getJNIRef(fieldJREF);
RVMField f = java.lang.reflect.JikesRVMSupport.getFieldOf(fieldObj);
if (traceJNI)
VM.sysWriteln("got field " + f);
return f.getId();
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetStaticObjectField.
/**
* SetStaticObjectField: set a static field of type Object
* @param env A JREF index for the JNI environment object
* @param classJREF A JREF index for the {@link RVMClass} object
* @param fieldID The id for the {@link RVMField} that describes this
* field
* @param objectJREF A JREF index of the value to assign
*/
private static void SetStaticObjectField(JNIEnvironment env, int classJREF, int fieldID, int objectJREF) {
if (traceJNI)
VM.sysWriteln("JNI called: SetStaticObjectField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
Object ref = env.getJNIRef(objectJREF);
field.setObjectValueUnchecked(null, ref);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
}
}
Aggregations