Search in sources :

Example 56 with JavaType

use of com.oracle.truffle.espresso.substitutions.JavaType in project graal by oracle.

the class JniEnv method NewObjectArray.

@JniImpl
@JavaType(Object[].class)
public StaticObject NewObjectArray(int length, @JavaType(Class.class) StaticObject elementClass, @JavaType(Object.class) StaticObject initialElement) {
    assert !elementClass.getMirrorKlass().isPrimitive();
    StaticObject arr = elementClass.getMirrorKlass().allocateReferenceArray(length);
    if (length > 0) {
        // Single store check
        getInterpreterToVM().setArrayObject(initialElement, 0, arr);
        Arrays.fill(arr.unwrap(), initialElement);
    }
    return arr;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) JavaType(com.oracle.truffle.espresso.substitutions.JavaType)

Example 57 with JavaType

use of com.oracle.truffle.espresso.substitutions.JavaType in project graal by oracle.

the class Management method GetPeakMemoryPoolUsage.

@ManagementImpl
@JavaType(Object.class)
public StaticObject GetPeakMemoryPoolUsage(@JavaType(Object.class) StaticObject pool) {
    if (StaticObject.isNull(pool)) {
        return StaticObject.NULL;
    }
    Method init = getMeta().java_lang_management_MemoryUsage.lookupDeclaredMethod(Symbol.Name._init_, getSignatures().makeRaw(Symbol.Type._void, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long));
    StaticObject instance = getMeta().java_lang_management_MemoryUsage.allocateInstance();
    init.invokeDirect(instance, 0L, 0L, 0L, 0L);
    return instance;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) Method(com.oracle.truffle.espresso.impl.Method) JavaType(com.oracle.truffle.espresso.substitutions.JavaType)

Example 58 with JavaType

use of com.oracle.truffle.espresso.substitutions.JavaType in project graal by oracle.

the class Management method GetMemoryPoolUsage.

@ManagementImpl
@JavaType(Object.class)
public StaticObject GetMemoryPoolUsage(@JavaType(Object.class) StaticObject pool) {
    if (StaticObject.isNull(pool)) {
        return StaticObject.NULL;
    }
    Method init = getMeta().java_lang_management_MemoryUsage.lookupDeclaredMethod(Symbol.Name._init_, getSignatures().makeRaw(Symbol.Type._void, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long));
    StaticObject instance = getMeta().java_lang_management_MemoryUsage.allocateInstance();
    init.invokeDirect(instance, 0L, 0L, 0L, 0L);
    return instance;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) Method(com.oracle.truffle.espresso.impl.Method) JavaType(com.oracle.truffle.espresso.substitutions.JavaType)

Aggregations

JavaType (com.oracle.truffle.espresso.substitutions.JavaType)58 StaticObject (com.oracle.truffle.espresso.runtime.StaticObject)44 ObjectKlass (com.oracle.truffle.espresso.impl.ObjectKlass)28 ArrayKlass (com.oracle.truffle.espresso.impl.ArrayKlass)24 Klass (com.oracle.truffle.espresso.impl.Klass)24 Meta (com.oracle.truffle.espresso.meta.Meta)20 Method (com.oracle.truffle.espresso.impl.Method)19 NoSafepoint (com.oracle.truffle.espresso.jni.NoSafepoint)15 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)13 Type (com.oracle.truffle.espresso.descriptors.Symbol.Type)8 NativeType (com.oracle.truffle.espresso.ffi.NativeType)8 Name (com.oracle.truffle.espresso.descriptors.Symbol.Name)5 Field (com.oracle.truffle.espresso.impl.Field)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)4 RuntimeConstantPool (com.oracle.truffle.espresso.classfile.RuntimeConstantPool)4 InnerClassesAttribute (com.oracle.truffle.espresso.classfile.attributes.InnerClassesAttribute)4 ArrayList (java.util.ArrayList)4 FrameInstance (com.oracle.truffle.api.frame.FrameInstance)3 EnclosingMethodAttribute (com.oracle.truffle.espresso.classfile.attributes.EnclosingMethodAttribute)3 MethodParametersAttribute (com.oracle.truffle.espresso.classfile.attributes.MethodParametersAttribute)3