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

com.oracle.truffle.sl.builtins.SLNewObjectBuiltinFactory Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package com.oracle.truffle.sl.builtins;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.UnsafeAccessedField;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrumentation.AllocationReporter;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.EncapsulatingNodeReference;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.sl.nodes.SLExpressionNode;
import com.oracle.truffle.sl.nodes.SLTypes;
import com.oracle.truffle.sl.runtime.SLNull;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;
import java.util.List;
import java.util.Objects;

@GeneratedBy(SLNewObjectBuiltin.class)
@SuppressWarnings({"javadoc", "unused"})
public final class SLNewObjectBuiltinFactory implements NodeFactory {

    private static final SLNewObjectBuiltinFactory INSTANCE = new SLNewObjectBuiltinFactory();
    private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);

    private SLNewObjectBuiltinFactory() {
    }

    @Override
    public Class getNodeClass() {
        return SLNewObjectBuiltin.class;
    }

    @Override
    public List> getExecutionSignature() {
        return List.of(SLExpressionNode.class);
    }

    @Override
    public List>> getNodeSignatures() {
        return List.of(List.of(SLExpressionNode[].class));
    }

    @Override
    public SLNewObjectBuiltin createNode(Object... arguments) {
        if (arguments.length == 1 && (arguments[0] == null || arguments[0] instanceof SLExpressionNode[])) {
            return create((SLExpressionNode[]) arguments[0]);
        } else {
            throw new IllegalArgumentException("Invalid create signature.");
        }
    }

    public static NodeFactory getInstance() {
        return INSTANCE;
    }

    @NeverDefault
    public static SLNewObjectBuiltin create(SLExpressionNode[] arguments) {
        return new SLNewObjectBuiltinNodeGen(arguments);
    }

    /**
     * Debug Info: 
     *   Specialization {@link SLNewObjectBuiltin#newObject(SLNull, AllocationReporter)}
     *     Activation probability: 0.48333
     *     With/without class size: 11/4 bytes
     *   Specialization {@link SLNewObjectBuiltin#newObject(Object, InteropLibrary)}
     *     Activation probability: 0.33333
     *     With/without class size: 12/4 bytes
     *   Specialization {@link SLNewObjectBuiltin#newObject(Object, InteropLibrary)}
     *     Activation probability: 0.18333
     *     With/without class size: 6/0 bytes
     * 
*/ @GeneratedBy(SLNewObjectBuiltin.class) @SuppressWarnings("javadoc") public static final class SLNewObjectBuiltinNodeGen extends SLNewObjectBuiltin { static final ReferenceField NEW_OBJECT1_CACHE_UPDATER = ReferenceField.create(MethodHandles.lookup(), "newObject1_cache", NewObject1Data.class); @Child private SLExpressionNode arguments0_; /** * State Info:
         *   0: SpecializationActive {@link SLNewObjectBuiltin#newObject(SLNull, AllocationReporter)}
         *   1: SpecializationActive {@link SLNewObjectBuiltin#newObject(Object, InteropLibrary)}
         *   2: SpecializationActive {@link SLNewObjectBuiltin#newObject(Object, InteropLibrary)}
         * 
*/ @CompilationFinal private int state_0_; /** * Source Info:
         *   Specialization: {@link SLNewObjectBuiltin#newObject(SLNull, AllocationReporter)}
         *   Parameter: {@link AllocationReporter} reporter
*/ @CompilationFinal private AllocationReporter newObject0_reporter_; @UnsafeAccessedField @Child private NewObject1Data newObject1_cache; private SLNewObjectBuiltinNodeGen(SLExpressionNode[] arguments) { this.arguments0_ = arguments != null && 0 < arguments.length ? arguments[0] : null; } @ExplodeLoop @Override protected Object execute(VirtualFrame frameValue) { int state_0 = this.state_0_; Object arguments0Value_ = this.arguments0_.executeGeneric(frameValue); if (state_0 != 0 /* is SpecializationActive[SLNewObjectBuiltin.newObject(SLNull, AllocationReporter)] || SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] || SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */) { if ((state_0 & 0b1) != 0 /* is SpecializationActive[SLNewObjectBuiltin.newObject(SLNull, AllocationReporter)] */ && SLTypes.isSLNull(arguments0Value_)) { SLNull arguments0Value__ = SLTypes.asSLNull(arguments0Value_); { AllocationReporter reporter__ = this.newObject0_reporter_; if (reporter__ != null) { return newObject(arguments0Value__, reporter__); } } } if ((state_0 & 0b110) != 0 /* is SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] || SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */) { if ((state_0 & 0b10) != 0 /* is SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */) { NewObject1Data s1_ = this.newObject1_cache; while (s1_ != null) { if ((s1_.values_.accepts(arguments0Value_)) && (!(s1_.values_.isNull(arguments0Value_)))) { return newObject(arguments0Value_, s1_.values_); } s1_ = s1_.next_; } } if ((state_0 & 0b100) != 0 /* is SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */) { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(this); try { { InteropLibrary values__ = (INTEROP_LIBRARY_.getUncached()); if ((!(values__.isNull(arguments0Value_)))) { return this.newObject2Boundary(state_0, arguments0Value_); } } } finally { encapsulating_.set(prev_); } } } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arguments0Value_); } @SuppressWarnings("static-method") @TruffleBoundary private Object newObject2Boundary(int state_0, Object arguments0Value_) { { InteropLibrary values__ = (INTEROP_LIBRARY_.getUncached()); return newObject(arguments0Value_, values__); } } @SuppressWarnings("unused") private Object executeAndSpecialize(Object arguments0Value) { int state_0 = this.state_0_; if (SLTypes.isSLNull(arguments0Value)) { SLNull arguments0Value_ = SLTypes.asSLNull(arguments0Value); AllocationReporter reporter__ = (lookup()); Objects.requireNonNull(reporter__, "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value."); VarHandle.storeStoreFence(); this.newObject0_reporter_ = reporter__; state_0 = state_0 | 0b1 /* add SpecializationActive[SLNewObjectBuiltin.newObject(SLNull, AllocationReporter)] */; this.state_0_ = state_0; return newObject(arguments0Value_, reporter__); } if (((state_0 & 0b100)) == 0 /* is-not SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */) { while (true) { int count1_ = 0; NewObject1Data s1_ = NEW_OBJECT1_CACHE_UPDATER.getVolatile(this); NewObject1Data s1_original = s1_; while (s1_ != null) { if ((s1_.values_.accepts(arguments0Value)) && (!(s1_.values_.isNull(arguments0Value)))) { break; } count1_++; s1_ = s1_.next_; } if (s1_ == null) { { InteropLibrary values__ = this.insert((INTEROP_LIBRARY_.create(arguments0Value))); // assert (s1_.values_.accepts(arguments0Value)); if ((!(values__.isNull(arguments0Value))) && count1_ < (3)) { s1_ = this.insert(new NewObject1Data(s1_original)); Objects.requireNonNull(s1_.insert(values__), "A specialization cache returned a default value. The cache initializer must never return a default value for this cache. Use @Cached(neverDefault=false) to allow default values for this cached value or make sure the cache initializer never returns the default value."); s1_.values_ = values__; if (!NEW_OBJECT1_CACHE_UPDATER.compareAndSet(this, s1_original, s1_)) { continue; } state_0 = state_0 | 0b10 /* add SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */; this.state_0_ = state_0; } } } if (s1_ != null) { return newObject(arguments0Value, s1_.values_); } break; } } { InteropLibrary values__ = null; { EncapsulatingNodeReference encapsulating_ = EncapsulatingNodeReference.getCurrent(); Node prev_ = encapsulating_.set(this); try { { values__ = (INTEROP_LIBRARY_.getUncached()); if ((!(values__.isNull(arguments0Value)))) { this.newObject1_cache = null; state_0 = state_0 & 0xfffffffd /* remove SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */; state_0 = state_0 | 0b100 /* add SpecializationActive[SLNewObjectBuiltin.newObject(Object, InteropLibrary)] */; this.state_0_ = state_0; return newObject(arguments0Value, values__); } } } finally { encapsulating_.set(prev_); } } } throw new UnsupportedSpecializationException(this, new Node[] {this.arguments0_}, arguments0Value); } @GeneratedBy(SLNewObjectBuiltin.class) @DenyReplace private static final class NewObject1Data extends Node implements SpecializationDataNode { @Child NewObject1Data next_; /** * Source Info:
             *   Specialization: {@link SLNewObjectBuiltin#newObject(Object, InteropLibrary)}
             *   Parameter: {@link InteropLibrary} values
*/ @Child InteropLibrary values_; NewObject1Data(NewObject1Data next_) { this.next_ = next_; } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy