org.jetbrains.kotlin.codegen
Class StackValue
java.lang.Object
org.jetbrains.kotlin.codegen.StackValue
- Direct Known Subclasses:
- StackValue.CallReceiver, StackValue.CollectionElementReceiver, StackValue.Constant, StackValue.Local, StackValue.OnStack, StackValue.Receiver, StackValue.StackValueWithSimpleReceiver
public abstract class StackValue
- extends java.lang.Object
Constructor Summary |
protected |
StackValue(org.jetbrains.org.objectweb.asm.Type type)
|
protected |
StackValue(org.jetbrains.org.objectweb.asm.Type type,
boolean canHaveSideEffects)
|
Method Summary |
static StackValue |
and(StackValue left,
StackValue right)
|
static StackValue |
arrayElement(org.jetbrains.org.objectweb.asm.Type type,
StackValue array,
StackValue index)
|
boolean |
canHaveSideEffects()
|
static StackValue |
changeReceiverForFieldAndSharedVar(StackValue.StackValueWithSimpleReceiver stackValue,
StackValue newReceiver)
|
static StackValue |
cmp(com.intellij.psi.tree.IElementType opToken,
org.jetbrains.org.objectweb.asm.Type type,
StackValue left,
StackValue right)
|
static void |
coerce(org.jetbrains.org.objectweb.asm.Type fromType,
org.jetbrains.org.objectweb.asm.Type toType,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
protected void |
coerceFrom(org.jetbrains.org.objectweb.asm.Type topOfStackType,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
protected void |
coerceTo(org.jetbrains.org.objectweb.asm.Type toType,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
static StackValue |
coercion(StackValue value,
org.jetbrains.org.objectweb.asm.Type castType)
|
static StackValue |
collectionElement(StackValue.CollectionElementReceiver collectionElementReceiver,
org.jetbrains.org.objectweb.asm.Type type,
ResolvedCall<FunctionDescriptor> getter,
ResolvedCall<FunctionDescriptor> setter,
ExpressionCodegen codegen)
|
static StackValue |
compareIntWithZero(StackValue argument,
int operation)
|
static StackValue |
compareWithNull(StackValue argument,
int operation)
|
static StackValue |
complexWriteReadReceiver(StackValue stackValue)
|
static StackValue |
constant(java.lang.Object value,
org.jetbrains.org.objectweb.asm.Type type)
|
static boolean |
couldSkipReceiverOnStaticCall(StackValue value)
|
void |
dup(org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean withReceiver)
|
static StackValue.Field |
enumEntry(ClassDescriptor descriptor,
JetTypeMapper typeMapper)
|
static StackValue |
expression(org.jetbrains.org.objectweb.asm.Type type,
KtExpression expression,
ExpressionCodegen generator)
|
static StackValue.Field |
field(StackValue.Field field,
StackValue newReceiver)
|
static StackValue.Field |
field(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.Type owner,
java.lang.String name,
boolean isStatic,
StackValue receiver)
|
static StackValue.Field |
field(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.Type owner,
java.lang.String name,
boolean isStatic,
StackValue receiver,
DeclarationDescriptor descriptor)
|
static StackValue.FieldForSharedVar |
fieldForSharedVar(StackValue.FieldForSharedVar field,
StackValue newReceiver)
|
static StackValue.FieldForSharedVar |
fieldForSharedVar(org.jetbrains.org.objectweb.asm.Type localType,
org.jetbrains.org.objectweb.asm.Type classType,
java.lang.String fieldName,
StackValue.Field refWrapper)
|
static StackValue |
functionCall(org.jetbrains.org.objectweb.asm.Type type,
kotlin.jvm.functions.Function1<org.jetbrains.org.objectweb.asm.commons.InstructionAdapter,kotlin.Unit> lambda)
|
boolean |
isNonStaticAccess(boolean isRead)
|
static StackValue.Local |
local(int index,
org.jetbrains.org.objectweb.asm.Type type)
|
void |
moveToTopOfStack(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
int depth)
This method is called to put the value on the top of the JVM stack if depth other values have been put on the
JVM stack after this value was generated. |
static StackValue |
none()
|
static StackValue |
not(StackValue stackValue)
|
static StackValue.Field |
oldSingleton(ClassDescriptor classDescriptor,
JetTypeMapper typeMapper)
|
static StackValue |
onStack(org.jetbrains.org.objectweb.asm.Type type)
|
static StackValue |
operation(org.jetbrains.org.objectweb.asm.Type type,
kotlin.jvm.functions.Function1<org.jetbrains.org.objectweb.asm.commons.InstructionAdapter,kotlin.Unit> lambda)
|
static StackValue |
or(StackValue left,
StackValue right)
|
static StackValue |
postIncrement(int index,
int increment)
|
static StackValue |
preIncrement(org.jetbrains.org.objectweb.asm.Type type,
StackValue stackValue,
int delta,
ResolvedCall resolvedCall,
ExpressionCodegen codegen)
|
static StackValue |
preIncrementForLocalVar(int index,
int increment)
|
static org.jetbrains.kotlin.codegen.StackValue.Property |
property(PropertyDescriptor descriptor,
org.jetbrains.org.objectweb.asm.Type backingFieldOwner,
org.jetbrains.org.objectweb.asm.Type type,
boolean isStaticBackingField,
java.lang.String fieldName,
CallableMethod getter,
CallableMethod setter,
GenerationState state,
StackValue receiver)
|
void |
put(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
void |
put(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean skipReceiver)
|
void |
putReceiver(org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean isRead)
|
abstract void |
putSelector(org.jetbrains.org.objectweb.asm.Type type,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
static void |
putUnitInstance(org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
static StackValue |
receiver(ResolvedCall<?> resolvedCall,
StackValue receiver,
ExpressionCodegen codegen,
Callable callableMethod)
|
static StackValue |
receiverWithoutReceiverArgument(StackValue receiverWithParameter)
|
static StackValue.Field |
receiverWithRefWrapper(org.jetbrains.org.objectweb.asm.Type localType,
org.jetbrains.org.objectweb.asm.Type classType,
java.lang.String fieldName,
StackValue receiver,
DeclarationDescriptor descriptor)
|
static org.jetbrains.org.objectweb.asm.Type |
refType(org.jetbrains.org.objectweb.asm.Type type)
|
static StackValue |
shared(int index,
org.jetbrains.org.objectweb.asm.Type type)
|
static org.jetbrains.org.objectweb.asm.Type |
sharedTypeForType(org.jetbrains.org.objectweb.asm.Type type)
|
static StackValue.Field |
singleton(ClassDescriptor classDescriptor,
JetTypeMapper typeMapper)
|
static StackValue.Field |
singletonViaInstance(ClassDescriptor classDescriptor,
JetTypeMapper typeMapper)
|
void |
store(StackValue value,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
void |
store(StackValue value,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean skipReceiver)
|
protected void |
storeSelector(org.jetbrains.org.objectweb.asm.Type topOfStackType,
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
|
static StackValue |
thisOrOuter(ExpressionCodegen codegen,
ClassDescriptor descriptor,
boolean isSuper,
boolean castReceiver)
|
static StackValue |
unit()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOCAL_0
public static final StackValue.Local LOCAL_0
type
@NotNull
public final org.jetbrains.org.objectweb.asm.Type type
StackValue
protected StackValue(@NotNull
org.jetbrains.org.objectweb.asm.Type type)
StackValue
protected StackValue(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
boolean canHaveSideEffects)
moveToTopOfStack
public void moveToTopOfStack(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
int depth)
- This method is called to put the value on the top of the JVM stack if
depth
other values have been put on the
JVM stack after this value was generated.
- Parameters:
type
- the type as which the value should be putv
- the visitor used to genClassOrObject the instructionsdepth
- the number of new values put onto the stack
put
public void put(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
put
public void put(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean skipReceiver)
putSelector
public abstract void putSelector(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
isNonStaticAccess
public boolean isNonStaticAccess(boolean isRead)
putReceiver
public void putReceiver(@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean isRead)
dup
public void dup(@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean withReceiver)
store
public void store(@NotNull
StackValue value,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
canHaveSideEffects
public boolean canHaveSideEffects()
store
public void store(@NotNull
StackValue value,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v,
boolean skipReceiver)
storeSelector
protected void storeSelector(@NotNull
org.jetbrains.org.objectweb.asm.Type topOfStackType,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
local
@NotNull
public static StackValue.Local local(int index,
@NotNull
org.jetbrains.org.objectweb.asm.Type type)
shared
@NotNull
public static StackValue shared(int index,
@NotNull
org.jetbrains.org.objectweb.asm.Type type)
onStack
@NotNull
public static StackValue onStack(@NotNull
org.jetbrains.org.objectweb.asm.Type type)
constant
@NotNull
public static StackValue constant(@Nullable
java.lang.Object value,
@NotNull
org.jetbrains.org.objectweb.asm.Type type)
cmp
@NotNull
public static StackValue cmp(@NotNull
com.intellij.psi.tree.IElementType opToken,
@NotNull
org.jetbrains.org.objectweb.asm.Type type,
StackValue left,
StackValue right)
not
@NotNull
public static StackValue not(@NotNull
StackValue stackValue)
or
public static StackValue or(@NotNull
StackValue left,
@NotNull
StackValue right)
and
public static StackValue and(@NotNull
StackValue left,
@NotNull
StackValue right)
compareIntWithZero
public static StackValue compareIntWithZero(@NotNull
StackValue argument,
int operation)
compareWithNull
public static StackValue compareWithNull(@NotNull
StackValue argument,
int operation)
arrayElement
@NotNull
public static StackValue arrayElement(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
StackValue array,
StackValue index)
collectionElement
@NotNull
public static StackValue collectionElement(StackValue.CollectionElementReceiver collectionElementReceiver,
org.jetbrains.org.objectweb.asm.Type type,
ResolvedCall<FunctionDescriptor> getter,
ResolvedCall<FunctionDescriptor> setter,
ExpressionCodegen codegen)
field
@NotNull
public static StackValue.Field field(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.Type owner,
@NotNull
java.lang.String name,
boolean isStatic,
@NotNull
StackValue receiver)
field
@NotNull
public static StackValue.Field field(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
org.jetbrains.org.objectweb.asm.Type owner,
@NotNull
java.lang.String name,
boolean isStatic,
@NotNull
StackValue receiver,
@Nullable
DeclarationDescriptor descriptor)
field
@NotNull
public static StackValue.Field field(@NotNull
StackValue.Field field,
@NotNull
StackValue newReceiver)
changeReceiverForFieldAndSharedVar
@NotNull
public static StackValue changeReceiverForFieldAndSharedVar(@NotNull
StackValue.StackValueWithSimpleReceiver stackValue,
@Nullable
StackValue newReceiver)
property
@NotNull
public static org.jetbrains.kotlin.codegen.StackValue.Property property(@NotNull
PropertyDescriptor descriptor,
@Nullable
org.jetbrains.org.objectweb.asm.Type backingFieldOwner,
@NotNull
org.jetbrains.org.objectweb.asm.Type type,
boolean isStaticBackingField,
@Nullable
java.lang.String fieldName,
@Nullable
CallableMethod getter,
@Nullable
CallableMethod setter,
GenerationState state,
@NotNull
StackValue receiver)
expression
@NotNull
public static StackValue expression(org.jetbrains.org.objectweb.asm.Type type,
KtExpression expression,
ExpressionCodegen generator)
coerceTo
protected void coerceTo(@NotNull
org.jetbrains.org.objectweb.asm.Type toType,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
coerceFrom
protected void coerceFrom(@NotNull
org.jetbrains.org.objectweb.asm.Type topOfStackType,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
coerce
public static void coerce(@NotNull
org.jetbrains.org.objectweb.asm.Type fromType,
@NotNull
org.jetbrains.org.objectweb.asm.Type toType,
@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
putUnitInstance
public static void putUnitInstance(@NotNull
org.jetbrains.org.objectweb.asm.commons.InstructionAdapter v)
unit
public static StackValue unit()
none
public static StackValue none()
receiverWithRefWrapper
public static StackValue.Field receiverWithRefWrapper(@NotNull
org.jetbrains.org.objectweb.asm.Type localType,
@NotNull
org.jetbrains.org.objectweb.asm.Type classType,
@NotNull
java.lang.String fieldName,
@NotNull
StackValue receiver,
@Nullable
DeclarationDescriptor descriptor)
fieldForSharedVar
public static StackValue.FieldForSharedVar fieldForSharedVar(@NotNull
org.jetbrains.org.objectweb.asm.Type localType,
@NotNull
org.jetbrains.org.objectweb.asm.Type classType,
@NotNull
java.lang.String fieldName,
@NotNull
StackValue.Field refWrapper)
fieldForSharedVar
@NotNull
public static StackValue.FieldForSharedVar fieldForSharedVar(@NotNull
StackValue.FieldForSharedVar field,
@NotNull
StackValue newReceiver)
coercion
public static StackValue coercion(@NotNull
StackValue value,
@NotNull
org.jetbrains.org.objectweb.asm.Type castType)
thisOrOuter
@NotNull
public static StackValue thisOrOuter(@NotNull
ExpressionCodegen codegen,
@NotNull
ClassDescriptor descriptor,
boolean isSuper,
boolean castReceiver)
postIncrement
public static StackValue postIncrement(int index,
int increment)
preIncrementForLocalVar
public static StackValue preIncrementForLocalVar(int index,
int increment)
preIncrement
public static StackValue preIncrement(@NotNull
org.jetbrains.org.objectweb.asm.Type type,
@NotNull
StackValue stackValue,
int delta,
ResolvedCall resolvedCall,
@NotNull
ExpressionCodegen codegen)
receiver
public static StackValue receiver(ResolvedCall<?> resolvedCall,
StackValue receiver,
ExpressionCodegen codegen,
@Nullable
Callable callableMethod)
receiverWithoutReceiverArgument
public static StackValue receiverWithoutReceiverArgument(StackValue receiverWithParameter)
enumEntry
@NotNull
public static StackValue.Field enumEntry(@NotNull
ClassDescriptor descriptor,
@NotNull
JetTypeMapper typeMapper)
singleton
@NotNull
public static StackValue.Field singleton(@NotNull
ClassDescriptor classDescriptor,
@NotNull
JetTypeMapper typeMapper)
singletonViaInstance
public static StackValue.Field singletonViaInstance(ClassDescriptor classDescriptor,
JetTypeMapper typeMapper)
oldSingleton
public static StackValue.Field oldSingleton(ClassDescriptor classDescriptor,
JetTypeMapper typeMapper)
operation
public static StackValue operation(org.jetbrains.org.objectweb.asm.Type type,
kotlin.jvm.functions.Function1<org.jetbrains.org.objectweb.asm.commons.InstructionAdapter,kotlin.Unit> lambda)
functionCall
public static StackValue functionCall(org.jetbrains.org.objectweb.asm.Type type,
kotlin.jvm.functions.Function1<org.jetbrains.org.objectweb.asm.commons.InstructionAdapter,kotlin.Unit> lambda)
couldSkipReceiverOnStaticCall
public static boolean couldSkipReceiverOnStaticCall(StackValue value)
sharedTypeForType
@NotNull
public static org.jetbrains.org.objectweb.asm.Type sharedTypeForType(@NotNull
org.jetbrains.org.objectweb.asm.Type type)
refType
public static org.jetbrains.org.objectweb.asm.Type refType(org.jetbrains.org.objectweb.asm.Type type)
complexWriteReadReceiver
public static StackValue complexWriteReadReceiver(StackValue stackValue)