use of com.oracle.truffle.espresso.meta.Meta in project graal by oracle.
the class MapInterop method readHashValue.
@ExportMessage
public static Object readHashValue(StaticObject receiver, Object key, @Cached.Exclusive @Cached InvokeEspressoNode invoke, @Cached.Shared("contains") @Cached InvokeEspressoNode contains) throws UnsupportedMessageException, UnknownKeyException {
if (!isHashEntryReadable(receiver, key, contains)) {
throw UnsupportedMessageException.create();
}
Meta meta = receiver.getKlass().getMeta();
Method get = getInteropKlass(receiver).itableLookup(meta.java_util_Map, meta.java_util_Map_get.getITableIndex());
try {
return invoke.execute(get, receiver, new Object[] { key });
} catch (UnsupportedTypeException e) {
throw UnknownKeyException.create(key);
} catch (ArityException e) {
throw EspressoError.shouldNotReachHere(e);
}
}
use of com.oracle.truffle.espresso.meta.Meta in project graal by oracle.
the class MapInterop method getHashSize.
@ExportMessage
public static long getHashSize(StaticObject receiver, @Cached.Exclusive @Cached InvokeEspressoNode invoke) throws UnsupportedMessageException {
if (!hasHashEntries(receiver)) {
throw UnsupportedMessageException.create();
}
Meta meta = receiver.getKlass().getMeta();
Method size = getInteropKlass(receiver).itableLookup(meta.java_util_Map, meta.java_util_Map_size.getITableIndex());
try {
return (int) invoke.execute(size, receiver, EMPTY_ARRAY);
} catch (UnsupportedTypeException | ArityException e) {
throw EspressoError.shouldNotReachHere(e);
}
}
Aggregations