Search in sources :

Example 11 with HotSpotResolvedObjectType

use of jdk.vm.ci.hotspot.HotSpotResolvedObjectType in project graal by oracle.

the class HotSpotGraalMBean method optionsFor.

public OptionValues optionsFor(OptionValues initialValues, ResolvedJavaMethod forMethod) {
    ensureRegistered(true);
    if (forMethod instanceof HotSpotResolvedJavaMethod) {
        HotSpotResolvedObjectType type = ((HotSpotResolvedJavaMethod) forMethod).getDeclaringClass();
        if (type instanceof HotSpotResolvedJavaType) {
            Class<?> clazz = ((HotSpotResolvedJavaType) type).mirror();
            Reference<ClassLoader> addNewRef = new WeakReference<>(clazz.getClassLoader());
            if (!loaders.contains(addNewRef)) {
                EconomicSet<Reference<ClassLoader>> newLoaders = EconomicSet.create(RefEquivalence.INSTANCE, loaders);
                newLoaders.add(addNewRef);
                this.loaders = newLoaders;
            }
        }
    }
    return currentMap(initialValues, forMethod);
}
Also used : HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) HotSpotResolvedObjectType(jdk.vm.ci.hotspot.HotSpotResolvedObjectType) HotSpotResolvedJavaType(jdk.vm.ci.hotspot.HotSpotResolvedJavaType) WeakReference(java.lang.ref.WeakReference) Reference(java.lang.ref.Reference) WeakReference(java.lang.ref.WeakReference)

Example 12 with HotSpotResolvedObjectType

use of jdk.vm.ci.hotspot.HotSpotResolvedObjectType in project graal by oracle.

the class KlassLayoutHelperNode method canonical.

private static ValueNode canonical(KlassLayoutHelperNode klassLayoutHelperNode, GraalHotSpotVMConfig config, ValueNode klass, Stamp stamp, ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess) {
    KlassLayoutHelperNode self = klassLayoutHelperNode;
    if (klass.isConstant()) {
        if (!klass.asConstant().isDefaultForKind()) {
            Constant constant = stamp.readConstant(constantReflection.getMemoryAccessProvider(), klass.asConstant(), config.klassLayoutHelperOffset);
            return ConstantNode.forConstant(stamp, constant, metaAccess);
        }
    }
    if (klass instanceof LoadHubNode) {
        LoadHubNode hub = (LoadHubNode) klass;
        Stamp hubStamp = hub.getValue().stamp(NodeView.DEFAULT);
        if (hubStamp instanceof ObjectStamp) {
            ObjectStamp ostamp = (ObjectStamp) hubStamp;
            HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) ostamp.type();
            if (type != null && type.isArray() && !type.getComponentType().isPrimitive()) {
                // The layout for all object arrays is the same.
                Constant constant = stamp.readConstant(constantReflection.getMemoryAccessProvider(), type.klass(), config.klassLayoutHelperOffset);
                return ConstantNode.forConstant(stamp, constant, metaAccess);
            }
        }
    }
    if (self == null) {
        self = new KlassLayoutHelperNode(config, klass);
    }
    return self;
}
Also used : LoadHubNode(org.graalvm.compiler.nodes.extended.LoadHubNode) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Constant(jdk.vm.ci.meta.Constant) HotSpotResolvedObjectType(jdk.vm.ci.hotspot.HotSpotResolvedObjectType)

Aggregations

HotSpotResolvedObjectType (jdk.vm.ci.hotspot.HotSpotResolvedObjectType)12 HotSpotResolvedJavaMethod (jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod)4 Stamp (org.graalvm.compiler.core.common.type.Stamp)4 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)4 HotSpotResolvedJavaField (jdk.vm.ci.hotspot.HotSpotResolvedJavaField)2 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)2 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)2 StubUtil.verifyObject (org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 Test (org.junit.Test)2 File (java.io.File)1 Reference (java.lang.ref.Reference)1 WeakReference (java.lang.ref.WeakReference)1 Method (java.lang.reflect.Method)1 URLClassLoader (java.net.URLClassLoader)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 JarFile (java.util.jar.JarFile)1