use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class Target_sun_misc_Unsafe method putBoolean.
@Substitution(hasReceiver = true)
public static void putBoolean(@SuppressWarnings("unused") @JavaType(Unsafe.class) StaticObject self, @JavaType(Object.class) StaticObject holder, long offset, boolean value, @Inject Meta meta) {
if (isNullOrArray(holder)) {
UnsafeAccess.getIfAllowed(meta).putBoolean(unwrapNullOrArray(holder), offset, value);
return;
}
// TODO(peterssen): Current workaround assumes it's a field access, encoding is offset <->
// field index.
Field f = getInstanceFieldFromIndex(holder, Math.toIntExact(offset) - SAFETY_FIELD_OFFSET);
assert f != null;
f.setBoolean(holder, value);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class Target_sun_misc_Unsafe method putChar.
@Substitution(hasReceiver = true)
public static void putChar(@SuppressWarnings("unused") @JavaType(Unsafe.class) StaticObject self, @JavaType(Object.class) StaticObject holder, long offset, char value, @Inject Meta meta) {
if (isNullOrArray(holder)) {
UnsafeAccess.getIfAllowed(meta).putChar(unwrapNullOrArray(holder), offset, value);
return;
}
// TODO(peterssen): Current workaround assumes it's a field access, encoding is offset <->
// field index.
Field f = getInstanceFieldFromIndex(holder, Math.toIntExact(offset) - SAFETY_FIELD_OFFSET);
assert f != null;
f.setChar(holder, value);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class Target_sun_misc_Unsafe method putShort.
@Substitution(hasReceiver = true)
public static void putShort(@SuppressWarnings("unused") @JavaType(Unsafe.class) StaticObject self, @JavaType(Object.class) StaticObject holder, long offset, short value, @Inject Meta meta) {
if (isNullOrArray(holder)) {
UnsafeAccess.getIfAllowed(meta).putShort(unwrapNullOrArray(holder), offset, value);
return;
}
// TODO(peterssen): Current workaround assumes it's a field access, encoding is offset <->
// field index.
Field f = getInstanceFieldFromIndex(holder, Math.toIntExact(offset) - SAFETY_FIELD_OFFSET);
assert f != null;
f.setShort(holder, value);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class Target_sun_misc_Unsafe method putBooleanVolatile.
@TruffleBoundary(allowInlining = true)
@Substitution(hasReceiver = true)
public static void putBooleanVolatile(@SuppressWarnings("unused") @JavaType(Unsafe.class) StaticObject self, @JavaType(Object.class) StaticObject holder, long offset, boolean value, @Inject Meta meta) {
if (isNullOrArray(holder)) {
UnsafeAccess.getIfAllowed(meta).putBooleanVolatile(unwrapNullOrArray(holder), offset, value);
return;
}
// TODO(peterssen): Current workaround assumes it's a field access, encoding is offset <->
// field index.
Field f = getInstanceFieldFromIndex(holder, Math.toIntExact(offset) - SAFETY_FIELD_OFFSET);
assert f != null;
assert f.getKind().isSubWord();
f.setBoolean(holder, value, true);
}
use of com.oracle.truffle.espresso.impl.Field in project graal by oracle.
the class Target_sun_misc_Unsafe method putInt.
@Substitution(hasReceiver = true)
public static void putInt(@SuppressWarnings("unused") @JavaType(Unsafe.class) StaticObject self, @JavaType(Object.class) StaticObject holder, long offset, int value, @Inject Meta meta) {
if (isNullOrArray(holder)) {
UnsafeAccess.getIfAllowed(meta).putInt(unwrapNullOrArray(holder), offset, value);
return;
}
// TODO(peterssen): Current workaround assumes it's a field access, encoding is offset <->
// field index.
Field f = getInstanceFieldFromIndex(holder, Math.toIntExact(offset) - SAFETY_FIELD_OFFSET);
assert f != null;
f.setInt(holder, value);
}
Aggregations