de.grogra.xl.expr
public class Expression extends Node implements TypeId, ValueObserver, java.lang.Cloneable, ExpressionFactory
Expression is the base class for the internal representation
of compiled expression trees. These are used by the XL compiler as
an intermediate step in the creation of byte-code. However, they are
evaluatable on their own (though this is not as performant as byte-code).
Expression trees are used for both expressions and statements.Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType| Modifier and Type | Field and Description |
|---|---|
static Node.NType |
$TYPE |
java.lang.Object |
aval |
static Node.NType.Field |
aval$FIELD |
double |
dval |
static Node.NType.Field |
dval$FIELD |
int |
etype |
static Expression[] |
EXPR_0 |
static I18NBundle |
I18N |
long |
lval |
static Node.NType.Field |
lval$FIELD |
static int |
USED_BITS |
static int |
VALID |
static Node.NType.Field |
valid$FIELD |
ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MIME_TYPE, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELDA_VALUE, ABSTRACT_PRIMITIVE, BOOLEAN, BOOLEAN_MASK, BYTE, BYTE_MASK, CHAR, CHAR_MASK, D_VALUE, DOUBLE, DOUBLE_MASK, F_VALUE, FLOAT, FLOAT_MASK, FLOATING_POINT_MASK, I_VALUE, INT, INT_ASSIGNABLE, INT_MASK, INTEGRAL_MASK, L_VALUE, LONG, LONG_MASK, MAX_PRIMITIVE, MIN_PRIMITIVE, NUMERIC_MASK, NUMERIC_NONCHAR_MASK, OBJECT, OBJECT_MASK, PRIMITIVE_MASK, SHORT, SHORT_MASK, TYPE_COUNT, VOID, VOID_MASKDEFAULT_VALUE, EMPTY_MAP| Constructor and Description |
|---|
Expression() |
Expression(Type type) |
| Modifier and Type | Method and Description |
|---|---|
Expression |
add(Expression expr) |
boolean |
allowsIteration(int index) |
Expression |
cast(Type type) |
void |
checkExpressionCount(int count) |
protected void |
checkSetType(Type type) |
java.lang.Object |
clone() |
Expression |
compile(de.grogra.xl.compiler.scope.Scope scope,
Expression e) |
Expression |
compile(de.grogra.xl.compiler.scope.Scope scope,
Expression e1,
Expression e2) |
static Expression |
createConst(Type type,
java.lang.Object value) |
Expression |
createExpression(de.grogra.xl.compiler.scope.Scope scope,
antlr.collections.AST ast) |
static Expression |
createMaxConst(int typeId) |
static Expression |
createMinConst(int typeId) |
boolean |
discards(int index) |
java.lang.Object |
evaluateAsObject(VMXState t) |
void |
evaluateAsVoid(VMXState t) |
boolean |
evaluateBoolean() |
boolean |
evaluateBoolean(VMXState t) |
protected boolean |
evaluateBooleanImpl(VMXState t) |
byte |
evaluateByte() |
byte |
evaluateByte(VMXState t) |
protected byte |
evaluateByteImpl(VMXState t) |
char |
evaluateChar() |
char |
evaluateChar(VMXState t) |
protected char |
evaluateCharImpl(VMXState t) |
double |
evaluateDouble() |
double |
evaluateDouble(VMXState t) |
protected double |
evaluateDoubleImpl(VMXState t) |
float |
evaluateFloat() |
float |
evaluateFloat(VMXState t) |
protected float |
evaluateFloatImpl(VMXState t) |
int |
evaluateInt() |
int |
evaluateInt(VMXState t) |
protected int |
evaluateIntImpl(VMXState t) |
long |
evaluateLong() |
long |
evaluateLong(VMXState t) |
protected long |
evaluateLongImpl(VMXState t) |
java.lang.Object |
evaluateObject() |
java.lang.Object |
evaluateObject(VMXState t) |
protected java.lang.Object |
evaluateObjectImpl(VMXState t) |
AbruptCompletion.Return |
evaluateRet(VMXState t) |
short |
evaluateShort() |
short |
evaluateShort(VMXState t) |
protected short |
evaluateShortImpl(VMXState t) |
boolean |
evaluatesWithoutSideeffect() |
protected void |
evaluateVoidImpl(VMXState t) |
protected void |
fireValueChanged(Transaction t) |
Expression |
getExpression(int index) |
Expression |
getExpression(int index,
java.lang.Class cls) |
Expression |
getExpression(int index,
int typeId,
boolean checkTypes) |
int |
getExpressionCount() |
Expression |
getFirstExpression() |
Expression |
getLastExpression() |
Expression |
getLeastCommonAncestor(Expression other) |
Expression |
getNextExpression() |
protected Node.NType |
getNTypeImpl()
This method returns the
Node.NType which describes the managed
fields of the class of this node. |
Expression |
getObjectExpression(int index,
java.lang.Class type,
boolean checkTypes) |
Expression |
getObjectExpression(int index,
Type type,
boolean checkTypes) |
int |
getPromotedType(Expression expr1,
Expression expr2)
Determines the type id (see
TypeId) of the binarily promoted type
of the operands expr1 and expr2
(binary promotion is defined by the Java Language
Specification, it includes unboxing). |
int |
getSupportedTypes(int arg) |
Type |
getType() |
TypeLoader |
getTypeLoader() |
boolean |
hasType(java.lang.Class type) |
boolean |
hasType(Type type) |
Expression |
implicitConversion(de.grogra.xl.compiler.scope.Scope scope,
Type type) |
boolean |
isConditional() |
boolean |
isPrimitiveOrStringConstant() |
boolean |
isRequired(int index) |
void |
link(boolean checkTypes) |
void |
linkGraph(boolean checkTypes) |
boolean |
needsEmptyOperandStackForFinally() |
protected Node |
newInstance()
This method returns a new instance of the class of this
node.
|
int |
opcode(int[] opcodes) |
static int |
opcode(int typeId,
int[] opcodes) |
protected java.lang.String |
paramString()
Computes the class-specific part of the string returned by
Node.toString() which shall be enclosed in brackets. |
Expression |
promote(de.grogra.xl.compiler.scope.Scope scope,
int supportedTypes)
Converts this expression by unary promotion to
one of the types whose mask (see
TypeId)
is present in supportedTypes. |
void |
push(VMXState t) |
Expression |
receiveChildren(Expression source) |
Expression |
setNextSibling(Expression expr) |
Expression |
setType(Type type) |
Expression |
substitute(Expression prev) |
Expression |
toConst() |
protected Expression |
toConstImpl() |
java.lang.String |
toString() |
Expression |
unboxingConversion()
If this expression is a boxed value, return its unboxed expression.
|
void |
unlinkTree() |
void |
valueChanged(Expression expr,
int index,
Transaction t) |
void |
write(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard) |
void |
writeChildren(de.grogra.xl.compiler.BytecodeWriter writer) |
protected void |
writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard) |
int |
writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
org.objectweb.asm.Label falseLabel,
org.objectweb.asm.Label trueLabel) |
void |
writeFinally(de.grogra.xl.compiler.BytecodeWriter writer,
int label,
ControlTransfer cause) |
protected void |
writeImpl(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard) |
protected void |
writeOperator(de.grogra.xl.compiler.BytecodeWriter writer) |
addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, cloneGraph, dump, dumpTree, dup, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, findRefinementType, get, getAccessor, getAccessor, getAttributes, getAxisParent, getBoolean, getBranch, getBranchLength, getBranchNode, getBranchTail, getByte, getChar, getCommonAncestor, getCurrentGraphState, getDirectChildCount, getDouble, getEdgeAttributeAccessor, getEdgeAttributes, getEdgeBitsTo, getEdgeTo, getExtentIndex, getFirst, getFirstEdge, getFloat, getGraph, getId, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getObject, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getShort, getSource, getStamp, getSuccessor, getSymbol, getSymbolColor, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isEncoarseOf, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setLayer, setMark, setName, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, writeReplaceaddEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBitsequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBitMark, getObjectMark, setBitMark, setObjectMarkpublic static final Node.NType $TYPE
public java.lang.Object aval
public static final Node.NType.Field aval$FIELD
public double dval
public static final Node.NType.Field dval$FIELD
public int etype
public static final Expression[] EXPR_0
public static final I18NBundle I18N
public long lval
public static final Node.NType.Field lval$FIELD
public static final int USED_BITS
public static final int VALID
public static final Node.NType.Field valid$FIELD
public Expression()
public Expression(Type type)
public Expression add(Expression expr)
public boolean allowsIteration(int index)
public Expression cast(Type type)
public final void checkExpressionCount(int count)
protected void checkSetType(Type type)
public Expression compile(de.grogra.xl.compiler.scope.Scope scope, Expression e)
public Expression compile(de.grogra.xl.compiler.scope.Scope scope, Expression e1, Expression e2)
public static final Expression createConst(Type type, java.lang.Object value)
public Expression createExpression(de.grogra.xl.compiler.scope.Scope scope, antlr.collections.AST ast)
createExpression in interface ExpressionFactorypublic static final Expression createMaxConst(int typeId)
public static final Expression createMinConst(int typeId)
public boolean discards(int index)
public final java.lang.Object evaluateAsObject(VMXState t)
public final void evaluateAsVoid(VMXState t)
public final boolean evaluateBoolean()
public final boolean evaluateBoolean(VMXState t)
protected boolean evaluateBooleanImpl(VMXState t)
public final byte evaluateByte()
public final byte evaluateByte(VMXState t)
protected byte evaluateByteImpl(VMXState t)
public final char evaluateChar()
public final char evaluateChar(VMXState t)
protected char evaluateCharImpl(VMXState t)
public final double evaluateDouble()
public final double evaluateDouble(VMXState t)
protected double evaluateDoubleImpl(VMXState t)
public final float evaluateFloat()
public final float evaluateFloat(VMXState t)
protected float evaluateFloatImpl(VMXState t)
public final int evaluateInt()
public final int evaluateInt(VMXState t)
protected int evaluateIntImpl(VMXState t)
public final long evaluateLong()
public final long evaluateLong(VMXState t)
protected long evaluateLongImpl(VMXState t)
public final java.lang.Object evaluateObject()
public final java.lang.Object evaluateObject(VMXState t)
protected java.lang.Object evaluateObjectImpl(VMXState t)
public AbruptCompletion.Return evaluateRet(VMXState t)
public final short evaluateShort()
public final short evaluateShort(VMXState t)
protected short evaluateShortImpl(VMXState t)
public boolean evaluatesWithoutSideeffect()
protected void evaluateVoidImpl(VMXState t)
protected void fireValueChanged(Transaction t)
public Expression getExpression(int index)
public final Expression getExpression(int index, java.lang.Class cls)
public final Expression getExpression(int index, int typeId, boolean checkTypes)
public int getExpressionCount()
public Expression getFirstExpression()
public Expression getLastExpression()
public Expression getLeastCommonAncestor(Expression other)
public Expression getNextExpression()
protected Node.NType getNTypeImpl()
NodeNode.NType which describes the managed
fields of the class of this node. This method has to be implemented
in every concrete subclass.getNTypeImpl in class Nodepublic final Expression getObjectExpression(int index, java.lang.Class type, boolean checkTypes)
public final Expression getObjectExpression(int index, Type type, boolean checkTypes)
public int getPromotedType(Expression expr1, Expression expr2)
TypeId) of the binarily promoted type
of the operands expr1 and expr2
(binary promotion is defined by the Java Language
Specification, it includes unboxing).expr1 - first operandexpr2 - second operandpublic int getSupportedTypes(int arg)
public Type getType()
getType in interface ExpressionFactorypublic TypeLoader getTypeLoader()
public boolean hasType(java.lang.Class type)
public boolean hasType(Type type)
public Expression implicitConversion(de.grogra.xl.compiler.scope.Scope scope, Type type)
public boolean isConditional()
public boolean isPrimitiveOrStringConstant()
public boolean isRequired(int index)
public void link(boolean checkTypes)
public final void linkGraph(boolean checkTypes)
public boolean needsEmptyOperandStackForFinally()
protected Node newInstance()
NodenewInstance in class Nodepublic int opcode(int[] opcodes)
public static int opcode(int typeId,
int[] opcodes)
protected java.lang.String paramString()
NodeNode.toString() which shall be enclosed in brackets. This
should be used to show important properties of this node.paramString in class Nodepublic Expression promote(de.grogra.xl.compiler.scope.Scope scope, int supportedTypes)
TypeId)
is present in supportedTypes. The most specific
type is chosen, i.e. the type
which is a subtype of all other possible, supported types.scope - TODOsupportedTypes - union of allowed type masks for the promoted expressionIllegalOperandTypeException - if promotion cannot be performedpublic final void push(VMXState t)
public Expression receiveChildren(Expression source)
public Expression setNextSibling(Expression expr)
public Expression setType(Type type)
public Expression substitute(Expression prev)
public Expression toConst()
protected Expression toConstImpl()
public Expression unboxingConversion()
public final void unlinkTree()
public void valueChanged(Expression expr, int index, Transaction t)
valueChanged in interface ValueObserverpublic final void write(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard)
public void writeChildren(de.grogra.xl.compiler.BytecodeWriter writer)
protected void writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard)
public int writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
org.objectweb.asm.Label falseLabel,
org.objectweb.asm.Label trueLabel)
public void writeFinally(de.grogra.xl.compiler.BytecodeWriter writer,
int label,
ControlTransfer cause)
protected void writeImpl(de.grogra.xl.compiler.BytecodeWriter writer,
boolean discard)
protected void writeOperator(de.grogra.xl.compiler.BytecodeWriter writer)