
com.oracle.truffle.object.DynamicObjectLibraryImplFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-api Show documentation
Show all versions of truffle-api Show documentation
Truffle is a multi-language framework for executing dynamic languages
that achieves high performance when combined with Graal.
// CheckStyle: start generated
package com.oracle.truffle.object;
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.UnsupportedSpecializationException;
import com.oracle.truffle.api.dsl.DSLSupport.SpecializationDataNode;
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.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.object.Shape;
import com.oracle.truffle.object.DynamicObjectLibraryImpl.MakeSharedNode;
import com.oracle.truffle.object.DynamicObjectLibraryImpl.ResetShapeNode;
import com.oracle.truffle.object.DynamicObjectLibraryImpl.SetDynamicTypeNode;
import com.oracle.truffle.object.DynamicObjectLibraryImpl.SetFlagsNode;
import java.lang.invoke.VarHandle;
import java.util.Objects;
@GeneratedBy(DynamicObjectLibraryImpl.class)
@SuppressWarnings("javadoc")
final class DynamicObjectLibraryImplFactory {
/**
* Debug Info:
* Specialization {@link SetFlagsNode#doCached}
* Activation probability: 0.65000
* With/without class size: 19/8 bytes
* Specialization {@link SetFlagsNode#doUncached}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(SetFlagsNode.class)
@SuppressWarnings("javadoc")
static final class SetFlagsNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static SetFlagsNode getUncached() {
return SetFlagsNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#cached_cache}
*
*/
@NeverDefault
public static SetFlagsNode inline(@RequiredField(bits = 2, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) {
return new SetFlagsNodeGen.Inlined(target);
}
@GeneratedBy(SetFlagsNode.class)
@DenyReplace
private static final class Inlined extends SetFlagsNode {
/**
* State Info:
* 0: SpecializationActive {@link SetFlagsNode#doCached}
* 1: SpecializationActive {@link SetFlagsNode#doUncached}
*
*/
private final StateField state_0_;
private final ReferenceField cached_cache;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(SetFlagsNode.class);
this.state_0_ = target.getState(0, 2);
this.cached_cache = target.getReference(1, CachedData.class);
}
@ExplodeLoop
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, int arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doCached(DynamicObject, Shape, int, int, Shape)] || SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doUncached(DynamicObject, Shape, int)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doCached(DynamicObject, Shape, int, int, Shape)] */) {
CachedData s0_ = this.cached_cache.get(arg0Value);
while (s0_ != null) {
if ((arg3Value == s0_.newFlags_)) {
return SetFlagsNode.doCached(arg1Value, arg2Value, arg3Value, s0_.newFlags_, s0_.newShape_);
}
s0_ = s0_.next_;
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doUncached(DynamicObject, Shape, int)] */) {
return SetFlagsNode.doUncached(arg1Value, arg2Value, arg3Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value);
}
private boolean executeAndSpecialize(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, int arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doUncached(DynamicObject, Shape, int)] */) {
while (true) {
int count0_ = 0;
CachedData s0_ = this.cached_cache.getVolatile(arg0Value);
CachedData s0_original = s0_;
while (s0_ != null) {
if ((arg3Value == s0_.newFlags_)) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
// assert (arg3Value == s0_.newFlags_);
if (count0_ < (3)) {
s0_ = new CachedData(s0_original);
s0_.newFlags_ = (arg3Value);
s0_.newShape_ = (SetFlagsNode.shapeSetFlags(arg2Value, s0_.newFlags_));
if (!this.cached_cache.compareAndSet(arg0Value, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doCached(DynamicObject, Shape, int, int, Shape)] */;
this.state_0_.set(arg0Value, state_0);
}
}
if (s0_ != null) {
return SetFlagsNode.doCached(arg1Value, arg2Value, arg3Value, s0_.newFlags_, s0_.newShape_);
}
break;
}
}
this.cached_cache.set(arg0Value, null);
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doCached(DynamicObject, Shape, int, int, Shape)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[DynamicObjectLibraryImpl.SetFlagsNode.doUncached(DynamicObject, Shape, int)] */;
this.state_0_.set(arg0Value, state_0);
return SetFlagsNode.doUncached(arg1Value, arg2Value, arg3Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(SetFlagsNode.class)
@DenyReplace
private static final class CachedData implements SpecializationDataNode {
@CompilationFinal final CachedData next_;
/**
* Source Info:
* Specialization: {@link SetFlagsNode#doCached}
* Parameter: int newFlags
*/
@CompilationFinal int newFlags_;
/**
* Source Info:
* Specialization: {@link SetFlagsNode#doCached}
* Parameter: {@link Shape} newShape
*/
@CompilationFinal Shape newShape_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
@GeneratedBy(SetFlagsNode.class)
@DenyReplace
private static final class Uncached extends SetFlagsNode {
@TruffleBoundary
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, int arg3Value) {
return SetFlagsNode.doUncached(arg1Value, arg2Value, arg3Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
/**
* Debug Info:
* Specialization {@link SetDynamicTypeNode#doCached}
* Activation probability: 0.65000
* With/without class size: 19/8 bytes
* Specialization {@link SetDynamicTypeNode#doUncached}
* Activation probability: 0.35000
* With/without class size: 8/0 bytes
*
*/
@GeneratedBy(SetDynamicTypeNode.class)
@SuppressWarnings("javadoc")
static final class SetDynamicTypeNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static SetDynamicTypeNode getUncached() {
return SetDynamicTypeNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#cached_cache}
*
*/
@NeverDefault
public static SetDynamicTypeNode inline(@RequiredField(bits = 2, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) {
return new SetDynamicTypeNodeGen.Inlined(target);
}
@GeneratedBy(SetDynamicTypeNode.class)
@DenyReplace
private static final class Inlined extends SetDynamicTypeNode {
/**
* State Info:
* 0: SpecializationActive {@link SetDynamicTypeNode#doCached}
* 1: SpecializationActive {@link SetDynamicTypeNode#doUncached}
*
*/
private final StateField state_0_;
private final ReferenceField cached_cache;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(SetDynamicTypeNode.class);
this.state_0_ = target.getState(0, 2);
this.cached_cache = target.getReference(1, CachedData.class);
}
@ExplodeLoop
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doCached(DynamicObject, Shape, Object, Object, Shape)] || SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doUncached(DynamicObject, Shape, Object)] */) {
if ((state_0 & 0b1) != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doCached(DynamicObject, Shape, Object, Object, Shape)] */) {
CachedData s0_ = this.cached_cache.get(arg0Value);
while (s0_ != null) {
if ((arg3Value == s0_.newObjectType_)) {
return SetDynamicTypeNode.doCached(arg1Value, arg2Value, arg3Value, s0_.newObjectType_, s0_.newShape_);
}
s0_ = s0_.next_;
}
}
if ((state_0 & 0b10) != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doUncached(DynamicObject, Shape, Object)] */) {
return SetDynamicTypeNode.doUncached(arg1Value, arg2Value, arg3Value);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value);
}
private boolean executeAndSpecialize(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Object arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (((state_0 & 0b10)) == 0 /* is-not SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doUncached(DynamicObject, Shape, Object)] */) {
while (true) {
int count0_ = 0;
CachedData s0_ = this.cached_cache.getVolatile(arg0Value);
CachedData s0_original = s0_;
while (s0_ != null) {
if ((arg3Value == s0_.newObjectType_)) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
// assert (arg3Value == s0_.newObjectType_);
if (count0_ < (3)) {
s0_ = new CachedData(s0_original);
s0_.newObjectType_ = (arg3Value);
s0_.newShape_ = (SetDynamicTypeNode.shapeSetDynamicType(arg2Value, s0_.newObjectType_));
if (!this.cached_cache.compareAndSet(arg0Value, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doCached(DynamicObject, Shape, Object, Object, Shape)] */;
this.state_0_.set(arg0Value, state_0);
}
}
if (s0_ != null) {
return SetDynamicTypeNode.doCached(arg1Value, arg2Value, arg3Value, s0_.newObjectType_, s0_.newShape_);
}
break;
}
}
this.cached_cache.set(arg0Value, null);
state_0 = state_0 & 0xfffffffe /* remove SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doCached(DynamicObject, Shape, Object, Object, Shape)] */;
state_0 = state_0 | 0b10 /* add SpecializationActive[DynamicObjectLibraryImpl.SetDynamicTypeNode.doUncached(DynamicObject, Shape, Object)] */;
this.state_0_.set(arg0Value, state_0);
return SetDynamicTypeNode.doUncached(arg1Value, arg2Value, arg3Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(SetDynamicTypeNode.class)
@DenyReplace
private static final class CachedData implements SpecializationDataNode {
@CompilationFinal final CachedData next_;
/**
* Source Info:
* Specialization: {@link SetDynamicTypeNode#doCached}
* Parameter: {@link Object} newObjectType
*/
@CompilationFinal Object newObjectType_;
/**
* Source Info:
* Specialization: {@link SetDynamicTypeNode#doCached}
* Parameter: {@link Shape} newShape
*/
@CompilationFinal Shape newShape_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
@GeneratedBy(SetDynamicTypeNode.class)
@DenyReplace
private static final class Uncached extends SetDynamicTypeNode {
@TruffleBoundary
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Object arg3Value) {
return SetDynamicTypeNode.doUncached(arg1Value, arg2Value, arg3Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
/**
* Debug Info:
* Specialization {@link MakeSharedNode#doCached}
* Activation probability: 1.00000
* With/without class size: 20/4 bytes
*
*/
@GeneratedBy(MakeSharedNode.class)
@SuppressWarnings("javadoc")
static final class MakeSharedNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static MakeSharedNode getUncached() {
return MakeSharedNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#newShape_}
*
*/
@NeverDefault
public static MakeSharedNode inline(@RequiredField(bits = 1, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) {
return new MakeSharedNodeGen.Inlined(target);
}
@GeneratedBy(MakeSharedNode.class)
@DenyReplace
private static final class Inlined extends MakeSharedNode {
/**
* State Info:
* 0: SpecializationActive {@link MakeSharedNode#doCached}
*
*/
private final StateField state_0_;
private final ReferenceField newShape_;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(MakeSharedNode.class);
this.state_0_ = target.getState(0, 1);
this.newShape_ = target.getReference(1, Shape.class);
}
@Override
void execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.MakeSharedNode.doCached(DynamicObject, Shape, Shape)] */) {
{
Shape newShape__ = this.newShape_.get(arg0Value);
if (newShape__ != null) {
MakeSharedNode.doCached(arg1Value, arg2Value, newShape__);
return;
}
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
executeAndSpecialize(arg0Value, arg1Value, arg2Value);
return;
}
private void executeAndSpecialize(Node arg0Value, DynamicObject arg1Value, Shape arg2Value) {
int state_0 = this.state_0_.get(arg0Value);
Shape newShape__ = (MakeSharedNode.makeSharedShape(arg2Value));
Objects.requireNonNull(newShape__, "Specialization 'doCached(DynamicObject, Shape, Shape)' cache 'newShape' returned a 'null' 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 'null'.");
VarHandle.storeStoreFence();
this.newShape_.set(arg0Value, newShape__);
state_0 = state_0 | 0b1 /* add SpecializationActive[DynamicObjectLibraryImpl.MakeSharedNode.doCached(DynamicObject, Shape, Shape)] */;
this.state_0_.set(arg0Value, state_0);
MakeSharedNode.doCached(arg1Value, arg2Value, newShape__);
return;
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(MakeSharedNode.class)
@DenyReplace
private static final class Uncached extends MakeSharedNode {
@TruffleBoundary
@Override
void execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value) {
MakeSharedNode.doCached(arg1Value, arg2Value, (MakeSharedNode.makeSharedShape(arg2Value)));
return;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
/**
* Debug Info:
* Specialization {@link ResetShapeNode#doCached}
* Activation probability: 1.00000
* With/without class size: 24/4 bytes
*
*/
@GeneratedBy(ResetShapeNode.class)
@SuppressWarnings("javadoc")
static final class ResetShapeNodeGen {
private static final Uncached UNCACHED = new Uncached();
@NeverDefault
public static ResetShapeNode getUncached() {
return ResetShapeNodeGen.UNCACHED;
}
/**
* Required Fields:
* - {@link Inlined#state_0_}
*
- {@link Inlined#cached_cache}
*
*/
@NeverDefault
public static ResetShapeNode inline(@RequiredField(bits = 1, value = StateField.class)@RequiredField(type = Object.class, value = ReferenceField.class) InlineTarget target) {
return new ResetShapeNodeGen.Inlined(target);
}
@GeneratedBy(ResetShapeNode.class)
@DenyReplace
private static final class Inlined extends ResetShapeNode {
/**
* State Info:
* 0: SpecializationActive {@link ResetShapeNode#doCached}
*
*/
private final StateField state_0_;
private final ReferenceField cached_cache;
@SuppressWarnings("unchecked")
private Inlined(InlineTarget target) {
assert target.getTargetClass().isAssignableFrom(ResetShapeNode.class);
this.state_0_ = target.getState(0, 1);
this.cached_cache = target.getReference(1, CachedData.class);
}
@ExplodeLoop
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Shape arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
if (state_0 != 0 /* is SpecializationActive[DynamicObjectLibraryImpl.ResetShapeNode.doCached(DynamicObject, Shape, Shape, Shape)] */) {
CachedData s0_ = this.cached_cache.get(arg0Value);
while (s0_ != null) {
if ((arg3Value == s0_.cachedOtherShape_)) {
return ResetShapeNode.doCached(arg1Value, arg2Value, arg3Value, s0_.cachedOtherShape_);
}
s0_ = s0_.next_;
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value, arg2Value, arg3Value);
}
private boolean executeAndSpecialize(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Shape arg3Value) {
int state_0 = this.state_0_.get(arg0Value);
while (true) {
int count0_ = 0;
CachedData s0_ = this.cached_cache.getVolatile(arg0Value);
CachedData s0_original = s0_;
while (s0_ != null) {
if ((arg3Value == s0_.cachedOtherShape_)) {
break;
}
count0_++;
s0_ = s0_.next_;
}
if (s0_ == null) {
{
Shape cachedOtherShape__ = (ResetShapeNode.verifyResetShape(arg2Value, arg3Value));
if ((arg3Value == cachedOtherShape__) && count0_ < (3)) {
s0_ = new CachedData(s0_original);
s0_.cachedOtherShape_ = cachedOtherShape__;
if (!this.cached_cache.compareAndSet(arg0Value, s0_original, s0_)) {
continue;
}
state_0 = state_0 | 0b1 /* add SpecializationActive[DynamicObjectLibraryImpl.ResetShapeNode.doCached(DynamicObject, Shape, Shape, Shape)] */;
this.state_0_.set(arg0Value, state_0);
}
}
}
if (s0_ != null) {
return ResetShapeNode.doCached(arg1Value, arg2Value, arg3Value, s0_.cachedOtherShape_);
}
break;
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null, null}, arg0Value, arg1Value, arg2Value, arg3Value);
}
@Override
public boolean isAdoptable() {
return false;
}
}
@GeneratedBy(ResetShapeNode.class)
@DenyReplace
private static final class CachedData implements SpecializationDataNode {
@CompilationFinal final CachedData next_;
/**
* Source Info:
* Specialization: {@link ResetShapeNode#doCached}
* Parameter: {@link Shape} cachedOtherShape
*/
@CompilationFinal Shape cachedOtherShape_;
CachedData(CachedData next_) {
this.next_ = next_;
}
}
@GeneratedBy(ResetShapeNode.class)
@DenyReplace
private static final class Uncached extends ResetShapeNode {
@TruffleBoundary
@Override
boolean execute(Node arg0Value, DynamicObject arg1Value, Shape arg2Value, Shape arg3Value) {
if ((arg3Value == (ResetShapeNode.verifyResetShape(arg2Value, arg3Value)))) {
return ResetShapeNode.doCached(arg1Value, arg2Value, arg3Value, (ResetShapeNode.verifyResetShape(arg2Value, arg3Value)));
}
throw new UnsupportedSpecializationException(this, new Node[] {null, null, null, null}, arg0Value, arg1Value, arg2Value, arg3Value);
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@Override
public boolean isAdoptable() {
return false;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy