com.oracle.truffle.js.nodes.array.ArrayBufferByteLengthNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package com.oracle.truffle.js.nodes.array;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.InlineSupport.InlineTarget;
import com.oracle.truffle.api.dsl.InlineSupport.ReferenceField;
import com.oracle.truffle.api.dsl.InlineSupport.RequiredField;
import com.oracle.truffle.api.dsl.InlineSupport.StateField;
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.Node;
import com.oracle.truffle.api.nodes.UnadoptableNode;
import com.oracle.truffle.js.runtime.JSConfig;
import com.oracle.truffle.js.runtime.JSContext;
import com.oracle.truffle.js.runtime.builtins.JSArrayBufferObject;
import com.oracle.truffle.js.runtime.builtins.JSArrayBufferObject.Direct;
import com.oracle.truffle.js.runtime.builtins.JSArrayBufferObject.Heap;
import com.oracle.truffle.js.runtime.builtins.JSArrayBufferObject.Interop;
import com.oracle.truffle.js.runtime.builtins.JSArrayBufferObject.Shared;
import java.lang.invoke.VarHandle;
import java.util.Objects;
/**
* Debug Info:
* Specialization {@link ArrayBufferByteLengthNode#heapArrayBuffer}
* Activation probability: 0.38500
* With/without class size: 8/0 bytes
* Specialization {@link ArrayBufferByteLengthNode#directArrayBuffer}
* Activation probability: 0.29500
* With/without class size: 7/0 bytes
* Specialization {@link ArrayBufferByteLengthNode#sharedArrayBuffer}
* Activation probability: 0.20500
* With/without class size: 6/0 bytes
* Specialization {@link ArrayBufferByteLengthNode#interopArrayBuffer}
* Activation probability: 0.11500
* With/without class size: 6/4 bytes
*
*/
@GeneratedBy(ArrayBufferByteLengthNode.class)
@SuppressWarnings("javadoc")
public final class ArrayBufferByteLengthNodeGen {
private static final LibraryFactory INTEROP_LIBRARY_ = LibraryFactory.resolve(InteropLibrary.class);
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#interopArrayBuffer_interop_}
*
*/
@NeverDefault
public static ArrayBufferByteLengthNode inline(@RequiredField(bits = 4, value = StateField.class)@RequiredField(type = Node.class, value = ReferenceField.class) InlineTarget target) {
return new ArrayBufferByteLengthNodeGen.Inlined(target);
}
@GeneratedBy(ArrayBufferByteLengthNode.class)
@DenyReplace
private static final class Inlined extends ArrayBufferByteLengthNode implements UnadoptableNode {
/**
* State Info:
* 0: SpecializationActive {@link ArrayBufferByteLengthNode#heapArrayBuffer}
* 1: SpecializationActive {@link ArrayBufferByteLengthNode#directArrayBuffer}
* 2: SpecializationActive {@link ArrayBufferByteLengthNode#sharedArrayBuffer}
* 3: SpecializationActive {@link ArrayBufferByteLengthNode#interopArrayBuffer}
*
*/
private final StateField state_0_;
private final ReferenceField interopArrayBuffer_interop_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(ArrayBufferByteLengthNode.class);
this.state_0_ = target.getState(0, 4);
this.interopArrayBuffer_interop_ = target.getReference(1, InteropLibrary.class);
}
@Override
public int execute(Node arg0Value, JSArrayBufferObject arg1Value, JSContext arg2Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[ArrayBufferByteLengthNode.heapArrayBuffer(Heap, JSContext)] || SpecializationActive[ArrayBufferByteLengthNode.directArrayBuffer(Direct, JSContext)] || SpecializationActive[ArrayBufferByteLengthNode.sharedArrayBuffer(Shared, JSContext)] || SpecializationActive[ArrayBufferByteLengthNode.interopArrayBuffer(Interop, JSContext, InteropLibrary)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[ArrayBufferByteLengthNode.heapArrayBuffer(Heap, JSContext)] */ && arg1Value instanceof Heap) {
Heap arg1Value_ = (Heap) arg1Value;
return ArrayBufferByteLengthNode.heapArrayBuffer(arg1Value_, arg2Value);
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[ArrayBufferByteLengthNode.directArrayBuffer(Direct, JSContext)] */ && arg1Value instanceof Direct) {
Direct arg1Value_ = (Direct) arg1Value;
return ArrayBufferByteLengthNode.directArrayBuffer(arg1Value_, arg2Value);
}
if ((state_0 & 0b100) != 0 /* is SpecializationActive[ArrayBufferByteLengthNode.sharedArrayBuffer(Shared, JSContext)] */ && arg1Value instanceof Shared) {
Shared arg1Value_ = (Shared) arg1Value;
return ArrayBufferByteLengthNode.sharedArrayBuffer(arg1Value_, arg2Value);
}
if ((state_0 & 0b1000) != 0 /* is SpecializationActive[ArrayBufferByteLengthNode.interopArrayBuffer(Interop, JSContext, InteropLibrary)] */ && arg1Value instanceof Interop) {
Interop arg1Value_ = (Interop) arg1Value;
{
InteropLibrary interop__ = this.interopArrayBuffer_interop_.get(arg0Value);
if (interop__ != null) {
return ArrayBufferByteLengthNode.interopArrayBuffer(arg1Value_, arg2Value, interop__);
}
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value);
}
private int executeAndSpecialize(Node arg0Value, JSArrayBufferObject arg1Value, JSContext arg2Value) {
int state_0 = this.state_0_.get(arg0Value);
if (arg1Value instanceof Heap) {
Heap arg1Value_ = (Heap) arg1Value;
state_0 = state_0 | 0b1 /* add SpecializationActive[ArrayBufferByteLengthNode.heapArrayBuffer(Heap, JSContext)] */;
this.state_0_.set(arg0Value, state_0);
return ArrayBufferByteLengthNode.heapArrayBuffer(arg1Value_, arg2Value);
}
if (arg1Value instanceof Direct) {
Direct arg1Value_ = (Direct) arg1Value;
state_0 = state_0 | 0b10 /* add SpecializationActive[ArrayBufferByteLengthNode.directArrayBuffer(Direct, JSContext)] */;
this.state_0_.set(arg0Value, state_0);
return ArrayBufferByteLengthNode.directArrayBuffer(arg1Value_, arg2Value);
}
if (arg1Value instanceof Shared) {
Shared arg1Value_ = (Shared) arg1Value;
state_0 = state_0 | 0b100 /* add SpecializationActive[ArrayBufferByteLengthNode.sharedArrayBuffer(Shared, JSContext)] */;
this.state_0_.set(arg0Value, state_0);
return ArrayBufferByteLengthNode.sharedArrayBuffer(arg1Value_, arg2Value);
}
if (arg1Value instanceof Interop) {
Interop arg1Value_ = (Interop) arg1Value;
InteropLibrary interop__ = arg0Value.insert((INTEROP_LIBRARY_.createDispatched(JSConfig.InteropLibraryLimit)));
Objects.requireNonNull(interop__, "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.interopArrayBuffer_interop_.set(arg0Value, interop__);
state_0 = state_0 | 0b1000 /* add SpecializationActive[ArrayBufferByteLengthNode.interopArrayBuffer(Interop, JSContext, InteropLibrary)] */;
this.state_0_.set(arg0Value, state_0);
return ArrayBufferByteLengthNode.interopArrayBuffer(arg1Value_, arg2Value, interop__);
}
throw new UnsupportedSpecializationException(this, null, arg0Value, arg1Value, arg2Value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy