Search in sources :

Example 41 with Field

use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.

the class JniEnv method FromReflectedField.

/**
 * <h3>jfieldID FromReflectedField(JNIEnv *env, jobject field);</h3>
 * <p>
 * Converts a java.lang.reflect.Field to a field ID.
 */
@JniImpl
@Handle(Field.class)
public long FromReflectedField(@JavaType(java.lang.reflect.Field.class) StaticObject field) {
    assert InterpreterToVM.instanceOf(field, getMeta().java_lang_reflect_Field);
    Field guestField = Field.getReflectiveFieldRoot(field, getMeta());
    guestField.getDeclaringKlass().initialize();
    return fieldIds.handlify(guestField);
}
Also used : Field(com.oracle.truffle.espresso.impl.Field)

Example 42 with Field

use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.

the class JniEnv method SetStaticDoubleField.

@JniImpl
public void SetStaticDoubleField(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, double val) {
    Field field = fieldIds.getObject(fieldId);
    assert field.isStatic();
    field.set(field.getDeclaringKlass().tryInitializeAndGetStatics(), val);
}
Also used : Field(com.oracle.truffle.espresso.impl.Field)

Example 43 with Field

use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.

the class JniEnv method SetStaticBooleanField.

@JniImpl
public void SetStaticBooleanField(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, boolean val) {
    Field field = fieldIds.getObject(fieldId);
    assert field.isStatic();
    field.set(field.getDeclaringKlass().tryInitializeAndGetStatics(), val);
}
Also used : Field(com.oracle.truffle.espresso.impl.Field)

Example 44 with Field

use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.

the class JniEnv method SetStaticObjectField.

// endregion Get*Field
// region SetStatic*Field
@JniImpl
public void SetStaticObjectField(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, @JavaType(Object.class) StaticObject val) {
    Field field = fieldIds.getObject(fieldId);
    assert field.isStatic();
    field.set(field.getDeclaringKlass().tryInitializeAndGetStatics(), val);
}
Also used : Field(com.oracle.truffle.espresso.impl.Field)

Example 45 with Field

use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.

the class JniEnv method SetStaticByteField.

@JniImpl
public void SetStaticByteField(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused, @Handle(Field.class) long fieldId, byte val) {
    Field field = fieldIds.getObject(fieldId);
    assert field.isStatic();
    field.set(field.getDeclaringKlass().tryInitializeAndGetStatics(), val);
}
Also used : Field(com.oracle.truffle.espresso.impl.Field)

Aggregations

Field (com.oracle.truffle.espresso.impl.Field)60 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)14 ObjectKlass (com.oracle.truffle.espresso.impl.ObjectKlass)8 Klass (com.oracle.truffle.espresso.impl.Klass)7 Method (com.oracle.truffle.espresso.impl.Method)5 StaticObject (com.oracle.truffle.espresso.runtime.StaticObject)5 JavaType (com.oracle.truffle.espresso.substitutions.JavaType)5 ExportMessage (com.oracle.truffle.api.library.ExportMessage)4 ArrayKlass (com.oracle.truffle.espresso.impl.ArrayKlass)4 Meta (com.oracle.truffle.espresso.meta.Meta)4 ArrayList (java.util.ArrayList)4 Name (com.oracle.truffle.espresso.descriptors.Symbol.Name)3 ParserField (com.oracle.truffle.espresso.impl.ParserField)3 REF_getField (com.oracle.truffle.espresso.classfile.Constants.REF_getField)2 REF_putField (com.oracle.truffle.espresso.classfile.Constants.REF_putField)2 Type (com.oracle.truffle.espresso.descriptors.Symbol.Type)2 NativeType (com.oracle.truffle.espresso.ffi.NativeType)2 ParserKlass (com.oracle.truffle.espresso.impl.ParserKlass)2 ParserMethod (com.oracle.truffle.espresso.impl.ParserMethod)2 RedefineAddedField (com.oracle.truffle.espresso.impl.RedefineAddedField)2