Search in sources :

Example 91 with Method

use of com.oracle.truffle.espresso.impl.Method 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);
    }
}
Also used : Meta(com.oracle.truffle.espresso.meta.Meta) UnsupportedTypeException(com.oracle.truffle.api.interop.UnsupportedTypeException) Method(com.oracle.truffle.espresso.impl.Method) ArityException(com.oracle.truffle.api.interop.ArityException) ExportMessage(com.oracle.truffle.api.library.ExportMessage)

Aggregations

Method (com.oracle.truffle.espresso.impl.Method)91 StaticObject (com.oracle.truffle.espresso.runtime.StaticObject)57 Meta (com.oracle.truffle.espresso.meta.Meta)27 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)22 Klass (com.oracle.truffle.espresso.impl.Klass)19 JavaType (com.oracle.truffle.espresso.substitutions.JavaType)19 ObjectKlass (com.oracle.truffle.espresso.impl.ObjectKlass)16 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)14 ExportMessage (com.oracle.truffle.api.library.ExportMessage)12 ArrayKlass (com.oracle.truffle.espresso.impl.ArrayKlass)10 NoSafepoint (com.oracle.truffle.espresso.jni.NoSafepoint)9 FrameInstance (com.oracle.truffle.api.frame.FrameInstance)8 ArityException (com.oracle.truffle.api.interop.ArityException)8 UnsupportedTypeException (com.oracle.truffle.api.interop.UnsupportedTypeException)8 ArrayList (java.util.ArrayList)8 Name (com.oracle.truffle.espresso.descriptors.Symbol.Name)7 EspressoException (com.oracle.truffle.espresso.runtime.EspressoException)5 Field (com.oracle.truffle.espresso.impl.Field)4 MethodParametersAttribute (com.oracle.truffle.espresso.classfile.attributes.MethodParametersAttribute)3 Signature (com.oracle.truffle.espresso.descriptors.Symbol.Signature)3