Search in sources :

Example 6 with StaticObject

use of com.oracle.truffle.espresso.runtime.StaticObject in project graal by oracle.

the class InvokeInterface method executeWithNullCheck.

@Specialization
Object executeWithNullCheck(Object[] args, @Cached NullCheck nullCheck, @Cached("create(resolutionSeed)") WithoutNullCheck invokeInterface) {
    StaticObject receiver = (StaticObject) args[0];
    nullCheck.execute(receiver);
    return invokeInterface.execute(args);
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) Specialization(com.oracle.truffle.api.dsl.Specialization)

Example 7 with StaticObject

use of com.oracle.truffle.espresso.runtime.StaticObject in project graal by oracle.

the class EspressoReferenceArrayStoreNode method arrayStore.

public void arrayStore(EspressoContext context, StaticObject value, int index, StaticObject array) {
    if (Integer.compareUnsigned(index, array.length()) >= 0) {
        enterOutOfBound();
        Meta meta = context.getMeta();
        throw meta.throwException(meta.java_lang_ArrayIndexOutOfBoundsException);
    }
    if (!StaticObject.isNull(value) && !instanceOfDynamic.execute(value.getKlass(), ((ArrayKlass) array.getKlass()).getComponentType())) {
        enterArrayStoreEx();
        Meta meta = context.getMeta();
        throw meta.throwException(meta.java_lang_ArrayStoreException);
    }
    (array.<StaticObject[]>unwrap())[index] = value;
}
Also used : Meta(com.oracle.truffle.espresso.meta.Meta) StaticObject(com.oracle.truffle.espresso.runtime.StaticObject)

Example 8 with StaticObject

use of com.oracle.truffle.espresso.runtime.StaticObject in project graal by oracle.

the class StringConversion method produceGuestString11.

private static StaticObject produceGuestString11(Meta meta, byte[] value, int hash, byte coder) {
    StaticObject guestString = meta.java_lang_String.allocateInstance();
    meta.java_lang_String_coder.set(guestString, coder);
    meta.java_lang_String_hash.set(guestString, hash);
    meta.java_lang_String_value.setObject(guestString, StaticObject.wrap(value, meta), true);
    return guestString;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject)

Example 9 with StaticObject

use of com.oracle.truffle.espresso.runtime.StaticObject in project graal by oracle.

the class MHInvokeGenericNode method create.

public static MHInvokeGenericNode create(Klass accessingKlass, Method method, Symbol<Symbol.Name> methodName, Symbol<Symbol.Signature> signature, Meta meta) {
    Klass callerKlass = accessingKlass == null ? meta.java_lang_Object : accessingKlass;
    StaticObject appendixBox = StaticObject.createArray(meta.java_lang_Object_array, new StaticObject[1]);
    // Ask java code to spin an invoker for us.
    StaticObject memberName = (StaticObject) meta.java_lang_invoke_MethodHandleNatives_linkMethod.invokeDirect(null, callerKlass.mirror(), (int) REF_invokeVirtual, method.getDeclaringKlass().mirror(), meta.toGuestString(methodName), meta.toGuestString(signature), appendixBox);
    StaticObject appendix = appendixBox.get(0);
    return new MHInvokeGenericNode(method, memberName, appendix);
}
Also used : Klass(com.oracle.truffle.espresso.impl.Klass) StaticObject(com.oracle.truffle.espresso.runtime.StaticObject)

Example 10 with StaticObject

use of com.oracle.truffle.espresso.runtime.StaticObject in project graal by oracle.

the class ArrayLengthQuickNode method execute.

@Override
public int execute(VirtualFrame frame) {
    StaticObject array = nullCheck(BytecodeNode.popObject(frame, top - 1));
    BytecodeNode.putInt(frame, top - 1, arrayLength.execute(array));
    return stackEffectOf_ARRAYLENGTH;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject)

Aggregations

StaticObject (com.oracle.truffle.espresso.runtime.StaticObject)199 Method (com.oracle.truffle.espresso.impl.Method)57 JavaType (com.oracle.truffle.espresso.substitutions.JavaType)44 Klass (com.oracle.truffle.espresso.impl.Klass)32 ObjectKlass (com.oracle.truffle.espresso.impl.ObjectKlass)32 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)30 Meta (com.oracle.truffle.espresso.meta.Meta)29 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)26 ArrayKlass (com.oracle.truffle.espresso.impl.ArrayKlass)23 NoSafepoint (com.oracle.truffle.espresso.jni.NoSafepoint)17 ArrayList (java.util.ArrayList)13 EspressoException (com.oracle.truffle.espresso.runtime.EspressoException)9 Symbol (com.oracle.truffle.espresso.descriptors.Symbol)8 FrameInstance (com.oracle.truffle.api.frame.FrameInstance)7 ExportMessage (com.oracle.truffle.api.library.ExportMessage)7 BytecodeNode (com.oracle.truffle.espresso.nodes.BytecodeNode)7 TruffleSafepoint (com.oracle.truffle.api.TruffleSafepoint)6 Name (com.oracle.truffle.espresso.descriptors.Symbol.Name)6 EspressoContext (com.oracle.truffle.espresso.runtime.EspressoContext)6 Type (com.oracle.truffle.espresso.descriptors.Symbol.Type)5