Package io.airlift.bytecode.expression
Class BytecodeExpression
java.lang.Object
io.airlift.bytecode.expression.BytecodeExpression
- All Implemented Interfaces:
BytecodeNode
- Direct Known Subclasses:
ArithmeticBytecodeExpression,Variable
A BytecodeExpression is chain of Java like expressions that results in at most
a single value being pushed on the stack. The chain starts with a constant,
local variable, static field, static method or invoke dynamic followed
by zero or more invocations, field dereferences, array element fetches, or casts.
The expression can optionally be terminated by a set expression, and in this
case no value is pushed on the stack.
A BytecodeExpression is a BytecodeNode so it works with tools like tree dump.
This abstraction makes it easy to write generic byte code generators that can work with data that may come from a parameter, field or the result of a method invocation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> Taccept(BytecodeNode parent, BytecodeVisitor<T> visitor) final voidaccept(org.objectweb.asm.MethodVisitor visitor, MethodGenerationContext generationContext) final BytecodeExpressioncast(ParameterizedType type) final BytecodeExpressionprotected abstract Stringabstract BytecodeNodegetBytecode(MethodGenerationContext generationContext) final BytecodeExpressiongetElement(int index) final BytecodeExpressiongetElement(BytecodeExpression index) final BytecodeExpressiongetField(FieldDefinition field) final BytecodeExpressiongetField(ParameterizedType declaringClass, String name, ParameterizedType type) final BytecodeExpressionfinal BytecodeExpressionfinal BytecodeExpressionfinal ParameterizedTypegetType()instanceOf(Class<?> type) final BytecodeExpressioninvoke(MethodDefinition method, Iterable<? extends BytecodeExpression> parameters) final BytecodeExpressioninvoke(Method method, BytecodeExpression... parameters) final BytecodeExpressioninvoke(Method method, Iterable<? extends BytecodeExpression> parameters) final BytecodeExpressioninvoke(String methodName, ParameterizedType returnType, Iterable<? extends BytecodeExpression> parameters) final BytecodeExpressioninvoke(String methodName, ParameterizedType returnType, Iterable<ParameterizedType> parameterTypes, BytecodeExpression... parameters) final BytecodeExpressioninvoke(String methodName, ParameterizedType returnType, Iterable<ParameterizedType> parameterTypes, Iterable<? extends BytecodeExpression> parameters) final BytecodeExpressioninvoke(String methodName, Class<?> returnType, BytecodeExpression... parameters) final BytecodeExpressioninvoke(String methodName, Class<?> returnType, Iterable<? extends BytecodeExpression> parameters) final BytecodeExpressioninvoke(String methodName, Class<?> returnType, Iterable<? extends Class<?>> parameterTypes, BytecodeExpression... parameters) final BytecodeExpressionlength()final BytecodeExpressionpop()final BytecodeExpressionret()final BytecodeExpressionsetElement(int index, BytecodeExpression value) final BytecodeExpressionsetElement(BytecodeExpression index, BytecodeExpression value) final BytecodeExpressionsetField(FieldDefinition field, BytecodeExpression value) final BytecodeExpressionsetField(Field field, BytecodeExpression value) final BytecodeExpressionsetField(String name, BytecodeExpression value) final StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.airlift.bytecode.BytecodeNode
getChildNodes
-
Constructor Details
-
BytecodeExpression
-
-
Method Details
-
getType
-
getBytecode
-
formatOneLine
-
toString
-
getField
-
getField
-
getField
-
getField
-
getField
public final BytecodeExpression getField(ParameterizedType declaringClass, String name, ParameterizedType type) -
setField
-
setField
-
setField
-
cast
-
cast
-
invoke
-
invoke
public final BytecodeExpression invoke(MethodDefinition method, Iterable<? extends BytecodeExpression> parameters) -
invoke
public final BytecodeExpression invoke(Method method, Iterable<? extends BytecodeExpression> parameters) -
invoke
public final BytecodeExpression invoke(String methodName, Class<?> returnType, BytecodeExpression... parameters) -
invoke
public final BytecodeExpression invoke(String methodName, Class<?> returnType, Iterable<? extends BytecodeExpression> parameters) -
invoke
public final BytecodeExpression invoke(String methodName, ParameterizedType returnType, Iterable<? extends BytecodeExpression> parameters) -
invoke
public final BytecodeExpression invoke(String methodName, Class<?> returnType, Iterable<? extends Class<?>> parameterTypes, BytecodeExpression... parameters) -
invoke
public final BytecodeExpression invoke(String methodName, ParameterizedType returnType, Iterable<ParameterizedType> parameterTypes, BytecodeExpression... parameters) -
invoke
public final BytecodeExpression invoke(String methodName, ParameterizedType returnType, Iterable<ParameterizedType> parameterTypes, Iterable<? extends BytecodeExpression> parameters) -
getElement
-
getElement
-
setElement
-
setElement
-
length
-
ret
-
pop
-
accept
public final void accept(org.objectweb.asm.MethodVisitor visitor, MethodGenerationContext generationContext) - Specified by:
acceptin interfaceBytecodeNode
-
accept
- Specified by:
acceptin interfaceBytecodeNode
-
instanceOf
-