use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class JniEnv method ToReflectedField.
/**
* <h3>jobject ToReflectedField(JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
* </h3>
* <p>
* Converts a field ID derived from cls to a java.lang.reflect.Field object. isStatic must be
* set to JNI_TRUE if fieldID refers to a static field, and JNI_FALSE otherwise.
* <p>
* Throws OutOfMemoryError and returns 0 if fails.
*/
@JniImpl
@JavaType(java.lang.reflect.Field.class)
public StaticObject ToReflectedField(@JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, @SuppressWarnings("unused") boolean isStatic) {
Field field = fieldIds.getObject(fieldId);
assert field.getDeclaringKlass().isAssignableFrom(unused.getMirrorKlass());
StaticObject fields = getVM().JVM_GetClassDeclaredFields(field.getDeclaringKlass().mirror(), false);
for (StaticObject declField : fields.<StaticObject[]>unwrap()) {
assert InterpreterToVM.instanceOf(declField, getMeta().java_lang_reflect_Field);
Field f = (Field) getMeta().HIDDEN_FIELD_KEY.getHiddenObject(declField);
if (field == f) {
return declField;
}
}
throw EspressoError.shouldNotReachHere("Field not found ", field);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class JniEnv method SetCharField.
@JniImpl
public void SetCharField(@JavaType(Object.class) StaticObject obj, @Handle(Field.class) long fieldId, char val) {
Field field = fieldIds.getObject(fieldId);
field.set(obj, val);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class JniEnv method SetStaticIntField.
@JniImpl
public void SetStaticIntField(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, int val) {
Field field = fieldIds.getObject(fieldId);
assert field.isStatic();
field.set(field.getDeclaringKlass().tryInitializeAndGetStatics(), val);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class JniEnv method SetBooleanField.
@JniImpl
public void SetBooleanField(@JavaType(Object.class) StaticObject obj, @Handle(Field.class) long fieldId, boolean val) {
Field field = fieldIds.getObject(fieldId);
field.set(obj, val);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class JniEnv method SetIntField.
@JniImpl
public void SetIntField(@JavaType(Object.class) StaticObject obj, @Handle(Field.class) long fieldId, int val) {
Field field = fieldIds.getObject(fieldId);
field.set(obj, val);
}
Aggregations