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.
The newest version!
/*
* 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.
*/
// CheckStyle: start generated
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.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;
@GeneratedBy(SLWritePropertyCacheNode.class)
public final class SLWritePropertyCacheNodeGen extends SLWritePropertyCacheNode implements SpecializedNode {
@CompilationFinal private boolean excludeWriteCached_;
@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 {
protected final SLWritePropertyCacheNodeGen root;
BaseNode_(SLWritePropertyCacheNodeGen root, int index) {
super(index);
this.root = 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;
CachedWriteLocation location1 = (root.createCachedWrite(arg0Value_, arg1Value));
if ((location1.isValid(arg0Value_, arg1Value))) {
if (!root.excludeWriteCached_) {
Assumption[] assumption0_1 = (location1.getAssumptions());
if (isValid(assumption0_1)) {
SpecializationNode s = WriteCachedNode_.create(root, location1, assumption0_1);
if (countSame(s) < (3)) {
return s;
}
}
}
}
LRUCachedWriteLocation lru2 = (new LRUCachedWriteLocation(root.createCachedWrite(arg0Value_, arg1Value)));
root.excludeWriteCached_ = true;
return WriteGenericNode_.create(root, lru2);
}
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 = "writeCached(DynamicObject, Object, CachedWriteLocation)", value = SLWritePropertyCacheNode.class)
private static final class WriteCachedNode_ extends BaseNode_ {
private final CachedWriteLocation location;
@CompilationFinal private final Assumption[] assumption0_;
WriteCachedNode_(SLWritePropertyCacheNodeGen root, CachedWriteLocation location, Assumption[] assumption0_) {
super(root, 1);
this.location = location;
this.assumption0_ = assumption0_;
}
@Override
public SpecializationNode merge(SpecializationNode newNode, Frame frameValue, Object arg0Value, Object arg1Value) {
if (newNode.getClass() == WriteGenericNode_.class) {
removeSame("Contained by writeGeneric(DynamicObject, Object, LRUCachedWriteLocation)");
}
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.location.isValid(arg0Value_, arg1Value))) {
return true;
}
}
return false;
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
if ((this.location.isValid(arg0Value, arg1Value))) {
try {
check(this.assumption0_);
} catch (InvalidAssumptionException ae) {
removeThis("Assumption [assumption0] invalidated", null, arg0Value, arg1Value);
return;
}
root.writeCached(arg0Value, arg1Value, this.location);
return;
}
getNext().executeVoid(arg0Value, arg1Value);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root, CachedWriteLocation location, Assumption[] assumption0_) {
return new WriteCachedNode_(root, location, assumption0_);
}
}
@GeneratedBy(methodName = "writeGeneric(DynamicObject, Object, LRUCachedWriteLocation)", value = SLWritePropertyCacheNode.class)
private static final class WriteGenericNode_ extends BaseNode_ {
private final LRUCachedWriteLocation lru;
WriteGenericNode_(SLWritePropertyCacheNodeGen root, LRUCachedWriteLocation lru) {
super(root, 2);
this.lru = lru;
}
@Override
public void executeVoid(DynamicObject arg0Value, Object arg1Value) {
root.writeGeneric(arg0Value, arg1Value, this.lru);
return;
}
static BaseNode_ create(SLWritePropertyCacheNodeGen root, LRUCachedWriteLocation lru) {
return new WriteGenericNode_(root, lru);
}
}
}