Class BaseWasmGenerationVisitor
java.lang.Object
org.teavm.backend.wasm.generate.common.methods.BaseWasmGenerationVisitor
- All Implemented Interfaces:
ExprVisitor, StatementVisitor
- Direct Known Subclasses:
WasmGCGenerationVisitor, WasmGenerationVisitor
public abstract class BaseWasmGenerationVisitor
extends Object
implements StatementVisitor, ExprVisitor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected final MethodReferenceprotected final ExpressionCacheprotected final WasmFunctionprotected WasmExpressionprotected List<WasmExpression> protected final TemporaryVariablePoolprotected final WasmTypeInference -
Constructor Summary
ConstructorsConstructorDescriptionBaseWasmGenerationVisitor(BaseWasmGenerationContext context, MethodReference currentMethod, WasmFunction function, int firstVariable, boolean async) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidprotected voidacceptWithType(Expr expr, ValueType type) protected abstract WasmExpressionallocateMultiArray(List<WasmExpression> target, ValueType arrayType, Supplier<List<WasmExpression>> dimensions, TextLocation location) protected abstract voidallocateObject(String className, TextLocation location, WasmLocal local, List<WasmExpression> target) protected voidcheckExceptionType(TryCatchStatement tryCatch, WasmLocal exceptionVar, List<WasmExpression> target, WasmBlock targetBlock) protected abstract WasmExpressionclassLiteral(ValueType type) protected WasmTypecondBlockType(WasmType thenType, WasmType elseType, ConditionalExpr conditional) protected WasmExpressionforceType(WasmExpression expression, ValueType type) voidgenerate(Statement statement, List<WasmExpression> target) protected abstract WasmExpressionprotected abstract BaseWasmGenerationVisitor.CallSiteIdentifiergenerateCallSiteId(TextLocation location) protected abstract WasmExpressiongenerateClassInitializer(String className, TextLocation location) protected abstract WasmExpressiongenerateInstanceOf(WasmExpression expression, ValueType type) protected WasmExpressiongenerateInvocation(InvocationExpr expr, BaseWasmGenerationVisitor.CallSiteIdentifier callSiteId) protected abstract voidgenerateThrow(WasmExpression expression, TextLocation location, List<WasmExpression> target) protected abstract voidgenerateThrowAIOOBE(TextLocation location, List<WasmExpression> target) protected abstract voidgenerateThrowCCE(TextLocation location, List<WasmExpression> target) protected abstract voidgenerateThrowNPE(TextLocation location, List<WasmExpression> target) protected voidgenerateTry(List<TryCatchStatement> tryCatchStatements, List<Statement> protectedBody) protected abstract WasmExpressiongenerateVirtualCall(WasmLocal instance, MethodReference method, List<WasmExpression> arguments) protected abstract WasmExpressiongenIsNull(WasmExpression value) protected WasmExpressioninvocation(InvocationExpr expr, List<WasmExpression> resultConsumer, boolean willDrop) protected final booleanisAsync()protected booleanisAsyncSplit(MethodReference methodRef) protected abstract booleanprotected abstract booleanisManagedCall(MethodReference method) protected WasmLocallocalVar(int index) protected WasmExpressionmapFirstArgumentForCall(WasmExpression argument, WasmFunction function, MethodReference method) protected abstract WasmTypeprotected final WasmBlockTypemapTypeToBlock(ValueType type) voidmonitorEnter(WasmExpression obj, TextLocation location, List<WasmExpression> consumer) voidmonitorExit(WasmExpression obj, TextLocation location, List<WasmExpression> consumer) protected booleanprotected abstract booleanneedsClassInitializer(String className) protected WasmExpressionnullCheck(Expr value, TextLocation location) protected abstract WasmExpressionnullLiteral(Expr expr) protected abstract WasmExpressionnullLiteral(WasmType type) voidsetReturnBlock(WasmBlock returnBlock) protected abstract WasmExpressionstoreArrayItem(WasmExpression array, WasmExpression index, Expr value, ArrayType type) protected abstract voidstoreField(Expr qualified, FieldReference field, Expr value, TextLocation location) protected abstract WasmExpressionprotected WasmExpressionunwrapArray(WasmExpression array) voidvisit(AssignmentStatement statement) voidvisit(BinaryExpr expr) voidvisit(BlockStatement statement) voidvisit(BoundCheckExpr expr) voidvisit(BreakStatement statement) voidvoidvisit(ConditionalExpr expr) voidvisit(ConditionalStatement statement) voidvisit(ConstantExpr expr) voidvisit(ContinueStatement statement) voidvisit(GotoPartStatement statement) voidvisit(InitClassStatement statement) voidvisit(InstanceOfExpr expr) voidvisit(MonitorEnterStatement statement) voidvisit(MonitorExitStatement statement) voidvoidvisit(NewMultiArrayExpr expr) voidvisit(PrimitiveCastExpr expr) voidvisit(ReturnStatement statement) voidvisit(SequentialStatement statement) voidvisit(SwitchStatement statement) voidvisit(ThrowStatement statement) voidvisit(TryCatchStatement statement) voidvoidvisit(UnwrapArrayExpr expr) voidvisit(VariableExpr expr) voidvisit(WhileStatement statement)
-
Field Details
-
currentMethod
-
typeInference
-
function
-
tempVars
-
exprCache
-
result
-
resultConsumer
-
blockLevel
protected int blockLevel
-
-
Constructor Details
-
BaseWasmGenerationVisitor
public BaseWasmGenerationVisitor(BaseWasmGenerationContext context, MethodReference currentMethod, WasmFunction function, int firstVariable, boolean async)
-
-
Method Details
-
setReturnBlock
-
generate
-
accept
-
accept
-
visit
- Specified by:
visitin interfaceExprVisitor
-
visit
- Specified by:
visitin interfaceExprVisitor
-
isManaged
protected abstract boolean isManaged() -
isManagedCall
-
nullCheck
-
generateThrowNPE
-
generateArrayLength
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
storeField
protected abstract void storeField(Expr qualified, FieldReference field, Expr value, TextLocation location) -
storeArrayItem
protected abstract WasmExpression storeArrayItem(WasmExpression array, WasmExpression index, Expr value, ArrayType type) -
visit
- Specified by:
visitin interfaceExprVisitor
-
condBlockType
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceExprVisitor
-
nullLiteral
-
nullLiteral
-
stringLiteral
-
classLiteral
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceExprVisitor
-
localVar
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
invocation
protected WasmExpression invocation(InvocationExpr expr, List<WasmExpression> resultConsumer, boolean willDrop) -
generateCallSiteId
protected abstract BaseWasmGenerationVisitor.CallSiteIdentifier generateCallSiteId(TextLocation location) -
acceptWithType
-
accept
-
generateInvocation
protected WasmExpression generateInvocation(InvocationExpr expr, BaseWasmGenerationVisitor.CallSiteIdentifier callSiteId) -
mapFirstArgumentForCall
protected WasmExpression mapFirstArgumentForCall(WasmExpression argument, WasmFunction function, MethodReference method) -
generateVirtualCall
protected abstract WasmExpression generateVirtualCall(WasmLocal instance, MethodReference method, List<WasmExpression> arguments) -
needsCallSiteId
protected boolean needsCallSiteId() -
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceExprVisitor
-
allocateObject
protected abstract void allocateObject(String className, TextLocation location, WasmLocal local, List<WasmExpression> target) -
allocateMultiArray
protected abstract WasmExpression allocateMultiArray(List<WasmExpression> target, ValueType arrayType, Supplier<List<WasmExpression>> dimensions, TextLocation location) -
visit
- Specified by:
visitin interfaceExprVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
forceType
-
visit
- Specified by:
visitin interfaceExprVisitor
-
generateInstanceOf
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
generateThrow
protected abstract void generateThrow(WasmExpression expression, TextLocation location, List<WasmExpression> target) -
visit
- Specified by:
visitin interfaceExprVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
needsClassInitializer
-
generateClassInitializer
-
visit
- Specified by:
visitin interfaceExprVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
generateTry
protected void generateTry(List<TryCatchStatement> tryCatchStatements, List<Statement> protectedBody) -
checkExceptionType
protected void checkExceptionType(TryCatchStatement tryCatch, WasmLocal exceptionVar, List<WasmExpression> target, WasmBlock targetBlock) -
visit
- Specified by:
visitin interfaceStatementVisitor
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
monitorEnter
-
visit
- Specified by:
visitin interfaceStatementVisitor
-
monitorExit
-
visit
- Specified by:
visitin interfaceExprVisitor
-
generateThrowAIOOBE
-
generateThrowCCE
-
genIsNull
-
mapType
-
unwrapArray
-
mapTypeToBlock
-
visit
- Specified by:
visitin interfaceExprVisitor
-
isAsyncSplit
-
isAsync
protected final boolean isAsync()
-