use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method ToReflectedField.
/**
* ToReflectedField
* @param env A JREF index for the JNI environment object
* @param clsJREF The JREF index of the class from which fieldID was
* derived.
* @param fieldID a jfieldID
* @param isStatic argument that is not specified in Sun's JNI 1.2 spec,
* but IS present in the 1.4.2 JDK's implementation! Our
* implementation will just ignore it, in any case. This is a
* good example of why the same entity
* shouldn't get to write both the spec and the reference
* implementation.
* @return a JREF index for the java.lang.reflect.Field object associated
* with fieldID.
*/
private static int ToReflectedField(JNIEnvironment env, int clsJREF, int fieldID, boolean isStatic) {
if (traceJNI)
VM.sysWriteln("JNI called: ToReflectedField");
RuntimeEntrypoints.checkJNICountDownToGC();
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
return env.pushJNIRef(java.lang.reflect.JikesRVMSupport.createField(field));
}
use of org.jikesrvm.classloader.RVMField in project JikesRVM by JikesRVM.
the class JNIFunctions method SetCharField.
/**
* SetCharField: set an instance field of type char
* @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 char value to assign
*/
private static void SetCharField(JNIEnvironment env, int objJREF, int fieldID, char value) {
if (traceJNI)
VM.sysWriteln("JNI called: SetCharField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setCharValueUnchecked(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 GetObjectField.
/**
* GetObjectField: read a instance field of type Object
* @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 Object field, converted to a JREF index
* or 0 if the fieldID is incorrect
*/
private static int GetObjectField(JNIEnvironment env, int objJREF, int fieldID) {
if (traceJNI)
VM.sysWriteln("JNI called: GetObjectField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
Object objVal = field.getObjectUnchecked(obj);
return env.pushJNIRef(objVal);
} 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 SetByteField.
/**
* SetByteField: set 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
* @param value byte value to assign
*/
private static void SetByteField(JNIEnvironment env, int objJREF, int fieldID, byte value) {
if (traceJNI)
VM.sysWriteln("JNI called: SetByteField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setByteValueUnchecked(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 SetShortField.
/**
* SetShortField: set an instance field of type short
* @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 short value to assign
*/
private static void SetShortField(JNIEnvironment env, int objJREF, int fieldID, short value) {
if (traceJNI)
VM.sysWriteln("JNI called: SetShortField");
RuntimeEntrypoints.checkJNICountDownToGC();
try {
Object obj = env.getJNIRef(objJREF);
RVMField field = MemberReference.getFieldRef(fieldID).resolve();
field.setShortValueUnchecked(obj, value);
} catch (Throwable unexpected) {
if (traceJNI)
unexpected.printStackTrace(System.err);
env.recordException(unexpected);
}
}
Aggregations