Search in sources :

Example 71 with StaticObject

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

the class JDKProxyRedefinitionPlugin method collectExtraClassesToReload.

@Override
@TruffleBoundary
public synchronized void collectExtraClassesToReload(List<RedefineInfo> redefineInfos, List<RedefineInfo> additional) {
    for (RedefineInfo redefineInfo : redefineInfos) {
        KlassRef klass = redefineInfo.getKlass();
        if (klass != null) {
            List<ProxyCache> list = cache.getOrDefault(klass, Collections.emptyList());
            for (ProxyCache proxyCache : list) {
                StaticObject result = (StaticObject) proxyGeneratorMethodCallNode.call(proxyCache.proxyName, proxyCache.interfaces, proxyCache.classModifier);
                byte[] proxyBytes = (byte[]) getContext().getMeta().toHostBoxed(result);
                additional.add(new RedefineInfo(proxyCache.klass, proxyBytes));
            }
        }
    }
}
Also used : RedefineInfo(com.oracle.truffle.espresso.jdwp.api.RedefineInfo) StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) KlassRef(com.oracle.truffle.espresso.jdwp.api.KlassRef) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 72 with StaticObject

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

the class ReferenceSupport method referenceRefersTo.

public static boolean referenceRefersTo(Reference<StaticObject> ref, StaticObject object) {
    assert !(ref instanceof PhantomReference);
    StaticObject value = ref.get();
    value = value == null ? StaticObject.NULL : value;
    return value == object;
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) PhantomReference(java.lang.ref.PhantomReference)

Example 73 with StaticObject

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

the class ClassRedefinition method getLoadedKlass.

private static Klass getLoadedKlass(Symbol<Symbol.Type> klassType, ObjectKlass oldKlass) throws RedefintionNotSupportedException {
    Klass klass;
    klass = oldKlass.getContext().getRegistries().findLoadedClass(klassType, oldKlass.getDefiningClassLoader());
    if (klass == null) {
        // new super interface must be loaded eagerly then
        StaticObject resourceGuestString = oldKlass.getMeta().toGuestString(Types.binaryName(klassType));
        try {
            StaticObject loadedClass = (StaticObject) oldKlass.getMeta().java_lang_ClassLoader_loadClass.invokeDirect(oldKlass.getDefiningClassLoader(), resourceGuestString);
            klass = loadedClass.getMirrorKlass();
        } catch (Throwable t) {
            throw new RedefintionNotSupportedException(ErrorCodes.ABSENT_INFORMATION);
        }
    }
    return klass;
}
Also used : Klass(com.oracle.truffle.espresso.impl.Klass) ObjectKlass(com.oracle.truffle.espresso.impl.ObjectKlass) ParserKlass(com.oracle.truffle.espresso.impl.ParserKlass) StaticObject(com.oracle.truffle.espresso.runtime.StaticObject)

Example 74 with StaticObject

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

the class JDKCacheRedefinitionPlugin method postClassRedefinition.

@Override
public void postClassRedefinition(ObjectKlass[] changedKlasses) {
    synchronized (threadGroupContexts) {
        for (ObjectKlass changedKlass : changedKlasses) {
            if (flushFromCachesMethod != null) {
                flushFromCachesMethod.invokeDirect(null, changedKlass.mirror());
            }
            Iterator<WeakReference<StaticObject>> iterator = threadGroupContexts.iterator();
            while (iterator.hasNext()) {
                WeakReference<StaticObject> ref = iterator.next();
                StaticObject context = ref.get();
                if (context != null) {
                    removeBeanInfoMethod.invokeDirect(context, changedKlass.mirror());
                } else {
                    // clean up list when context was reclaimed
                    iterator.remove();
                }
            }
        }
    }
}
Also used : StaticObject(com.oracle.truffle.espresso.runtime.StaticObject) WeakReference(java.lang.ref.WeakReference) ObjectKlass(com.oracle.truffle.espresso.impl.ObjectKlass)

Example 75 with StaticObject

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

the class CharArrayLoadQuickNode method execute.

@Override
public int execute(VirtualFrame frame) {
    int index = BytecodeNode.popInt(frame, top - 1);
    StaticObject array = nullCheck(BytecodeNode.popObject(frame, top - 2));
    BytecodeNode.putInt(frame, top - 2, charArrayLoad.execute(array, index));
    return stackEffectOf_CALOAD;
}
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