All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pkl.thirdparty.truffle.host.HostContextFactory Maven / Gradle / Ivy

Go to download

Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.

There is a newer version: 0.27.1
Show newest version
// CheckStyle: start generated
package org.pkl.thirdparty.truffle.host;

import org.pkl.thirdparty.truffle.api.CompilerDirectives;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.CompilationFinal;
import org.pkl.thirdparty.truffle.api.CompilerDirectives.TruffleBoundary;
import org.pkl.thirdparty.truffle.api.dsl.GeneratedBy;
import org.pkl.thirdparty.truffle.api.dsl.NeverDefault;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.InlineTarget;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.ReferenceField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.RequiredField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.StateField;
import org.pkl.thirdparty.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import org.pkl.thirdparty.truffle.api.nodes.DenyReplace;
import org.pkl.thirdparty.truffle.api.nodes.ExplodeLoop;
import org.pkl.thirdparty.truffle.api.nodes.Node;
import org.pkl.thirdparty.truffle.api.nodes.NodeCost;
import org.pkl.thirdparty.truffle.host.HostContext.ToGuestValueNode;
import java.lang.invoke.MethodHandles;

@GeneratedBy(HostContext.class)
@SuppressWarnings({"javadoc", "unused"})
final class HostContextFactory {

    /**
     * Debug Info: 
     *   Specialization {@link ToGuestValueNode#doNull}
     *     Activation probability: 0.48333
     *     With/without class size: 9/0 bytes
     *   Specialization {@link ToGuestValueNode#doCached}
     *     Activation probability: 0.33333
     *     With/without class size: 10/4 bytes
     *   Specialization {@link ToGuestValueNode#doUncached}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(ToGuestValueNode.class) @SuppressWarnings("javadoc") static final class ToGuestValueNodeGen extends ToGuestValueNode { static final ReferenceField CACHED_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "cached_cache", CachedData.class); private static final Uncached UNCACHED = new Uncached(); /** * State Info:
         *   0: SpecializationActive {@link ToGuestValueNode#doNull}
         *   1: SpecializationActive {@link ToGuestValueNode#doCached}
         *   2: SpecializationActive {@link ToGuestValueNode#doUncached}
         * 
*/ @CompilationFinal private int state_0_; @UnsafeAccessedField @CompilationFinal private CachedData cached_cache; private ToGuestValueNodeGen() { } @ExplodeLoop @Override Object execute(Node arg0Value, HostContext arg1Value, Object arg2Value) { int state_0 = this.state_0_; if (state_0 != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] || SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] || SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] */) { if ((arg2Value == null)) { return doNull(arg1Value, arg2Value); } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */ && (arg2Value != null)) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value.getClass() == s1_.cachedReceiver_)) { return doCached(arg1Value, arg2Value, s1_.cachedReceiver_); } s1_ = s1_.next_; } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */) { return doUncached(arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); } private Object executeAndSpecialize(Node arg0Value, HostContext arg1Value, Object arg2Value) { int state_0 = this.state_0_; if ((arg2Value == null)) { state_0 = state_0 | 0b1 /* add SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] */; this.state_0_ = state_0; return doNull(arg1Value, arg2Value); } if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */ && (arg2Value != null)) { while (true) { int count1_ = 0; CachedData s1_ = CACHED_CACHE_UPDATER.getVolatile(this); CachedData s1_original = s1_; while (s1_ != null) { if ((arg2Value.getClass() == s1_.cachedReceiver_)) { break; } count1_++; s1_ = s1_.next_; } if (s1_ == null) { { Class cachedReceiver__ = (arg2Value.getClass()); if ((arg2Value.getClass() == cachedReceiver__) && count1_ < (3)) { s1_ = new CachedData(s1_original); s1_.cachedReceiver_ = cachedReceiver__; if (!CACHED_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) { continue; } state_0 = state_0 | 0b10 /* add SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */; this.state_0_ = state_0; } } } if (s1_ != null) { return doCached(arg1Value, arg2Value, s1_.cachedReceiver_); } break; } } this.cached_cache = null; state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */; state_0 = state_0 | 0b100 /* add SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */; this.state_0_ = state_0; return doUncached(arg1Value, arg2Value); } @Override public NodeCost getCost() { int state_0 = this.state_0_; if (state_0 == 0) { return NodeCost.UNINITIALIZED; } else { if ((state_0 & (state_0 - 1)) == 0 /* is-single */) { CachedData s1_ = this.cached_cache; if ((s1_ == null || s1_.next_ == null)) { return NodeCost.MONOMORPHIC; } } } return NodeCost.POLYMORPHIC; } @NeverDefault public static ToGuestValueNode create() { return new ToGuestValueNodeGen(); } @NeverDefault public static ToGuestValueNode getUncached() { return ToGuestValueNodeGen.UNCACHED; } /** * Required Fields:
    *
  • {@link Inlined#state_0_} *
  • {@link Inlined#cached_cache} *
*/ @NeverDefault public static ToGuestValueNode inline(@RequiredField(bits = 3, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) { return new ToGuestValueNodeGen.Inlined(target); } @GeneratedBy(ToGuestValueNode.class) @DenyReplace private static final class Inlined extends ToGuestValueNode { /** * State Info:
             *   0: SpecializationActive {@link ToGuestValueNode#doNull}
             *   1: SpecializationActive {@link ToGuestValueNode#doCached}
             *   2: SpecializationActive {@link ToGuestValueNode#doUncached}
             * 
*/ private final StateField state_0_; private final ReferenceField cached_cache; @SuppressWarnings("unchecked") private Inlined(InlineTarget target) { assert target.getTargetClass().isAssignableFrom(ToGuestValueNode.class); this.state_0_ = target.getState(0, 3); this.cached_cache = target.getReference(1, CachedData.class); } @ExplodeLoop @Override Object execute(Node arg0Value, HostContext arg1Value, Object arg2Value) { int state_0 = this.state_0_.get(arg0Value); if (state_0 != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] || SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] || SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] */) { if ((arg2Value == null)) { return doNull(arg1Value, arg2Value); } } if ((state_0 & 0b10) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */ && (arg2Value != null)) { CachedData s1_ = this.cached_cache.get(arg0Value); while (s1_ != null) { if ((arg2Value.getClass() == s1_.cachedReceiver_)) { return doCached(arg1Value, arg2Value, s1_.cachedReceiver_); } s1_ = s1_.next_; } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */) { return doUncached(arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); } private Object executeAndSpecialize(Node arg0Value, HostContext arg1Value, Object arg2Value) { int state_0 = this.state_0_.get(arg0Value); if ((arg2Value == null)) { state_0 = state_0 | 0b1 /* add SpecializationActive[HostContext.ToGuestValueNode.doNull(HostContext, Object)] */; this.state_0_.set(arg0Value, state_0); return doNull(arg1Value, arg2Value); } if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */ && (arg2Value != null)) { while (true) { int count1_ = 0; CachedData s1_ = this.cached_cache.getVolatile(arg0Value); CachedData s1_original = s1_; while (s1_ != null) { if ((arg2Value.getClass() == s1_.cachedReceiver_)) { break; } count1_++; s1_ = s1_.next_; } if (s1_ == null) { { Class cachedReceiver__ = (arg2Value.getClass()); if ((arg2Value.getClass() == cachedReceiver__) && count1_ < (3)) { s1_ = new CachedData(s1_original); s1_.cachedReceiver_ = cachedReceiver__; if (!this.cached_cache.compareAndSet(arg0Value, s1_original, s1_)) { continue; } state_0 = state_0 | 0b10 /* add SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */; this.state_0_.set(arg0Value, state_0); } } } if (s1_ != null) { return doCached(arg1Value, arg2Value, s1_.cachedReceiver_); } break; } } this.cached_cache.set(arg0Value, null); state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[HostContext.ToGuestValueNode.doCached(HostContext, Object, Class<>)] */; state_0 = state_0 | 0b100 /* add SpecializationActive[HostContext.ToGuestValueNode.doUncached(HostContext, Object)] */; this.state_0_.set(arg0Value, state_0); return doUncached(arg1Value, arg2Value); } @Override public boolean isAdoptable() { return false; } } @GeneratedBy(ToGuestValueNode.class) @DenyReplace private static final class CachedData { @CompilationFinal final CachedData next_; /** * Source Info:
             *   Specialization: {@link ToGuestValueNode#doCached}
             *   Parameter: {@link Class} cachedReceiver
*/ @CompilationFinal Class cachedReceiver_; CachedData(CachedData next_) { this.next_ = next_; } } @GeneratedBy(ToGuestValueNode.class) @DenyReplace private static final class Uncached extends ToGuestValueNode { @TruffleBoundary @Override Object execute(Node arg0Value, HostContext arg1Value, Object arg2Value) { if ((arg2Value == null)) { return doNull(arg1Value, arg2Value); } return doUncached(arg1Value, arg2Value); } @Override public NodeCost getCost() { return NodeCost.MEGAMORPHIC; } @Override public boolean isAdoptable() { return false; } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy