com.oracle.truffle.sl.nodes.access.SLWritePropertyCacheNodeGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-sl Show documentation
Show all versions of truffle-sl Show documentation
Truffle SL is an example language implemented using the Truffle API.
// CheckStyle: start generated
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.oracle.truffle.sl.nodes.access;
import com.oracle.truffle.api.Assumption;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.internal.SpecializationNode;
import com.oracle.truffle.api.dsl.internal.SpecializedNode;
import com.oracle.truffle.api.dsl.internal.SuppressFBWarnings;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.nodes.InvalidAssumptionException;
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.Location;
import com.oracle.truffle.api.object.Shape;
@GeneratedBy(SLWritePropertyCacheNode.class)
@SuppressFBWarnings("SA_LOCAL_SELF_COMPARISON")
public final class SLWritePropertyCacheNodeGen extends SLWritePropertyCacheNode implements SpecializedNode {
@CompilationFinal private boolean excludeWriteExistingPropertyCached_;
@CompilationFinal private boolean excludeWriteNewPropertyCached_;
@CompilationFinal private boolean excludeUpdateShapeAndWrite_;
@Child private BaseNode_ specialization_;
private SLWritePropertyCacheNodeGen(String propertyName) {
super(propertyName);
this.specialization_ = UninitializedNode_.create(this);
}
@Override
public NodeCost getCost() {
return specialization_.getNodeCost();
}
@Override
public void executeObject(DynamicObject arg0Value, Object arg1Value) {
specialization_.executeVoid(arg0Value, arg1Value);
return;
}
@Override
public SpecializationNode getSpecializationNode() {
return specialization_;
}
@Override
public Node deepCopy() {
return SpecializationNode.updateRoot(super.deepCopy());
}
public static SLWritePropertyCacheNode create(String propertyName) {
return new SLWritePropertyCacheNodeGen(propertyName);
}
@GeneratedBy(SLWritePropertyCacheNode.class)
private abstract static class BaseNode_ extends SpecializationNode {
@CompilationFinal protected SLWritePropertyCacheNodeGen root;
BaseNode_(SLWritePropertyCacheNodeGen root, int index) {
super(index);
this.root = root;
}
@Override
protected final void setRoot(Node root) {
this.root = (SLWritePropertyCacheNodeGen) root;
}
@Override
protected final Node[] getSuppliedChildren() {
return new Node[] {null, null};
}
@Override
public final Object acceptAndExecute(Frame frameValue, Object arg0Value, Object arg1Value) {
this.executeVoid((DynamicObject) arg0Value, arg1Value);
return null;
}
public abstract void executeVoid(DynamicObject arg0Value, Object arg1Value);
@Override
protected final SpecializationNode createNext(Frame frameValue, Object arg0Value, Object arg1Value) {
if (arg0Value instanceof DynamicObject) {
DynamicObject arg0Value_ = (DynamicObject) arg0Value;
Location location1 = (root.lookupLocation(arg0Value_, arg1Value));
Shape shape1 = (arg0Value_.getShape());
if ((location1 != null) && (shape1.check(arg0Value_)) && (SLWritePropertyCacheNode.canSet(location1, arg0Value_, arg1Value))) {
if (!root.excludeWriteExistingPropertyCached_) {
Assumption assumption0_1 = (shape1.getValidAssumption());
if (isValid(assumption0_1)) {
SpecializationNode s = WriteExistingPropertyCachedNode_.create(root, location1, shape1, assumption0_1);
if (countSame(s) < (SLWritePropertyCacheNode.CACHE_LIMIT)) {
return s;
}
}
}
}
Location existingLocation2 = (root.lookupLocation(arg0Value_, arg1Value));
Shape oldShape2 = (arg0Value_.getShape());
Shape newShape2 = (root.defineProperty(oldShape2, arg1Value));
Location newLocation2 = (root.getLocation(newShape2));
if ((existingLocation2 == null) && (oldShape2.check(arg0Value_)) && (SLWritePropertyCacheNode.canSet(newLocation2, arg0Value_, arg1Value))) {
if (!root.excludeWriteNewPropertyCached_) {
Assumption assumption0_2 = (oldShape2.getValidAssumption());
Assumption assumption1_2 = (newShape2.getValidAssumption());
if (isValid(assumption0_2) && isValid(assumption1_2)) {
SpecializationNode s = WriteNewPropertyCachedNode_.create(root, existingLocation2, oldShape2, newShape2, newLocation2, assumption0_2, assumption1_2);
if (countSame(s) < (SLWritePropertyCacheNode.CACHE_LIMIT)) {
return s;
}
}
}
}
if ((SLWritePropertyCacheNode.updateShape(arg0Value_))) {
if (!root.excludeUpdateShapeAndWrite_) {
return UpdateShapeAndWriteNode_.create(root);
}
}
root.excludeWriteExistingPropertyCached_ = true;
root.excludeWriteNewPropertyCached_ = true;
root.excludeUpdateShapeAndWrite_ = true;
return WriteUncachedNode_.create(root);
}
return null;
}
protected final BaseNode_ getNext() {
return (BaseNode_) this.next;
}
}
@GeneratedBy(SLWritePropertyCacheNode.class)
private static final class UninitializedNode_ extends BaseNode_ {
UninitializedNode_(SLWritePropertyCacheNodeGen root) {
super(root, 2147483647);
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
uninitialized(null, arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root) {
return new UninitializedNode_(root);
}
}
@GeneratedBy(methodName = "writeExistingPropertyCached(DynamicObject, Object, Location, Shape)", value = SLWritePropertyCacheNode.class)
private static final class WriteExistingPropertyCachedNode_ extends BaseNode_ {
private final Location location;
private final Shape shape;
@CompilationFinal private final Assumption assumption0_;
WriteExistingPropertyCachedNode_(SLWritePropertyCacheNodeGen root, Location location, Shape shape, Assumption assumption0_) {
super(root, 1);
this.location = location;
this.shape = shape;
this.assumption0_ = assumption0_;
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value, Object arg1Value) {
if (newNode.getClass() == WriteUncachedNode_.class) {
removeSame("Contained by writeUncached(DynamicObject, Object)");
}
return super.merge(newNode, frameValue, arg0Value, arg1Value);
}
@Override
public boolean isIdentical(SpecializationNode other, Frame frameValue, Object arg0Value, Object arg1Value) {
if (arg0Value instanceof DynamicObject) {
DynamicObject arg0Value_ = (DynamicObject) arg0Value;
if ((this.shape.check(arg0Value_)) && (SLWritePropertyCacheNode.canSet(this.location, arg0Value_, arg1Value))) {
assert (this.location != null);
return true;
}
}
return false;
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
try {
check(this.assumption0_);
} catch (InvalidAssumptionException ae) {
removeThis("Assumption [assumption0] invalidated", null, arg0Value, arg1Value);
return;
}
if ((this.shape.check(arg0Value)) && (SLWritePropertyCacheNode.canSet(this.location, arg0Value, arg1Value))) {
assert (this.location != null);
root.writeExistingPropertyCached(arg0Value, arg1Value, this.location, this.shape);
return;
}
getNext().executeVoid(arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root, Location location, Shape shape, Assumption assumption0_) {
return new WriteExistingPropertyCachedNode_(root, location, shape, assumption0_);
}
}
@GeneratedBy(methodName = "writeNewPropertyCached(DynamicObject, Object, Location, Shape, Shape, Location)", value = SLWritePropertyCacheNode.class)
private static final class WriteNewPropertyCachedNode_ extends BaseNode_ {
private final Location existingLocation;
private final Shape oldShape;
private final Shape newShape;
private final Location newLocation;
@CompilationFinal private final Assumption assumption0_;
@CompilationFinal private final Assumption assumption1_;
WriteNewPropertyCachedNode_(SLWritePropertyCacheNodeGen root, Location existingLocation, Shape oldShape, Shape newShape, Location newLocation, Assumption assumption0_, Assumption assumption1_) {
super(root, 2);
this.existingLocation = existingLocation;
this.oldShape = oldShape;
this.newShape = newShape;
this.newLocation = newLocation;
this.assumption0_ = assumption0_;
this.assumption1_ = assumption1_;
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value, Object arg1Value) {
if (newNode.getClass() == WriteUncachedNode_.class) {
removeSame("Contained by writeUncached(DynamicObject, Object)");
}
return super.merge(newNode, frameValue, arg0Value, arg1Value);
}
@Override
public boolean isIdentical(SpecializationNode other, Frame frameValue, Object arg0Value, Object arg1Value) {
if (arg0Value instanceof DynamicObject) {
DynamicObject arg0Value_ = (DynamicObject) arg0Value;
if ((this.oldShape.check(arg0Value_)) && (SLWritePropertyCacheNode.canSet(this.newLocation, arg0Value_, arg1Value))) {
assert (this.existingLocation == null);
return true;
}
}
return false;
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
try {
check(this.assumption0_);
check(this.assumption1_);
} catch (InvalidAssumptionException ae) {
removeThis("Assumption [assumption0, assumption1] invalidated", null, arg0Value, arg1Value);
return;
}
if ((this.oldShape.check(arg0Value)) && (SLWritePropertyCacheNode.canSet(this.newLocation, arg0Value, arg1Value))) {
assert (this.existingLocation == null);
root.writeNewPropertyCached(arg0Value, arg1Value, this.existingLocation, this.oldShape, this.newShape, this.newLocation);
return;
}
getNext().executeVoid(arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root, Location existingLocation, Shape oldShape, Shape newShape, Location newLocation, Assumption assumption0_, Assumption assumption1_) {
return new WriteNewPropertyCachedNode_(root, existingLocation, oldShape, newShape, newLocation, assumption0_, assumption1_);
}
}
@GeneratedBy(methodName = "updateShapeAndWrite(DynamicObject, Object)", value = SLWritePropertyCacheNode.class)
private static final class UpdateShapeAndWriteNode_ extends BaseNode_ {
UpdateShapeAndWriteNode_(SLWritePropertyCacheNodeGen root) {
super(root, 3);
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value, Object arg1Value) {
if (newNode.getClass() == WriteUncachedNode_.class) {
removeSame("Contained by writeUncached(DynamicObject, Object)");
}
return super.merge(newNode, frameValue, arg0Value, arg1Value);
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
if ((SLWritePropertyCacheNode.updateShape(arg0Value))) {
root.updateShapeAndWrite(arg0Value, arg1Value);
return;
}
getNext().executeVoid(arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root) {
return new UpdateShapeAndWriteNode_(root);
}
}
@GeneratedBy(methodName = "writeUncached(DynamicObject, Object)", value = SLWritePropertyCacheNode.class)
private static final class WriteUncachedNode_ extends BaseNode_ {
WriteUncachedNode_(SLWritePropertyCacheNodeGen root) {
super(root, 4);
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
root.writeUncached(arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root) {
return new WriteUncachedNode_(root);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy