Class WasmStructuredControlflowCodeGenerator
java.lang.Object
de.mirkosertic.bytecoder.core.backend.wasm.WasmStructuredControlflowCodeGenerator
- All Implemented Interfaces:
StructuredControlflowCodeGenerator
public class WasmStructuredControlflowCodeGenerator
extends Object
implements StructuredControlflowCodeGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static class(package private) static class(package private) static class(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) intprivate final CompileUnitprivate final ExportableFunctionprivate final FunctionIndexprivate final Function<ResolvedMethod, FunctionType> (package private) intprivate final GeneratedMethodsRegistryprivate final Graph(package private) int(package private) static int(package private) intprivate final MethodToIDMapperprivate final Moduleprivate final Map<ResolvedClass, StructType> private final List<ResolvedClass> private final Map<ResolvedClass, StructType> (package private) intprivate final Map<AbstractVar, Local> private final VTableResolver -
Constructor Summary
ConstructorsConstructorDescriptionWasmStructuredControlflowCodeGenerator(CompileUnit compileUnit, Module module, Map<ResolvedClass, StructType> rtMappings, Map<ResolvedClass, StructType> objectTypeMappings, ExportableFunction exportableFunction, Function<org.objectweb.asm.Type, WasmType> typeConverter, Function<ResolvedMethod, FunctionType> functionTypeConverter, MethodToIDMapper methodToIDMapper, Graph graph, List<ResolvedClass> resolvedClasses, VTableResolver vTableResolver, GeneratedMethodsRegistry generatedMethodsRegistry, FunctionIndex functionIndex) -
Method Summary
Modifier and TypeMethodDescriptionprivate WasmValueconvertToType(Value incoming, org.objectweb.asm.Type targetType) createLambdaInstance(org.objectweb.asm.Type type, ExportableFunction implFunction, List<StructType.Field> closureFields, List<WasmValue> closureArguments) static WasmValuecreateNewInstanceOf(org.objectweb.asm.Type instanceType, Module module, CompileUnit compileUnit, Map<ResolvedClass, StructType> objectTypeMappings, Map<ResolvedClass, StructType> rtMappings, WasmValue externRef, FunctionIndex functionIndex) voidfinishBlock(Sequencer.Block node, boolean stackEmpty) voidvoidvoidvoidvoidvoidvoidvoidprivate WasmValuegenerateInvokeDynamicLambdaMetaFactoryInvocation(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) private WasmValuegenerateInvokeDynamicObjectMethodsEquals(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) private WasmValuegenerateInvokeDynamicObjectMethodsToString(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) private WasmValuegenerateInvokeDynamicStringMakeConcatWithConstants(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) voidvoidstartBlock(Sequencer.Block node) voidvoidstartCatchHandler(org.objectweb.asm.Type type) voidstartIfElseBlock(If node) voidstartIfWithTrueBlock(If node) voidvoidstartTableSwitch(TableSwitch node) voidvoidstartTryCatch(String label) private WasmValuetoInstanceOfCheck(WasmValue value, org.objectweb.asm.Type typeToCheck) private WasmValuetoType(org.objectweb.asm.Type type) private WasmValuetoWasmValue(AbstractVar value) private WasmValuetoWasmValue(Add value) private WasmValuetoWasmValue(And value) private WasmValuetoWasmValue(ArrayLength value) private WasmValuetoWasmValue(ArrayLoad value) private WasmValuetoWasmValue(Cast value) private WasmValuetoWasmValue(CaughtException value) private WasmValuetoWasmValue(CMP value) private WasmValuetoWasmValue(Div value) private WasmValuetoWasmValue(EnumValuesOf value) private WasmValuetoWasmValue(InstanceOf value) private WasmValueprivate WasmValuetoWasmValue(MethodArgument value) private WasmValueprivate WasmValuetoWasmValue(Mul value) private WasmValuetoWasmValue(Neg value) private WasmValuetoWasmValue(New value) private WasmValuetoWasmValue(NewArray value) private WasmValuetoWasmValue(NullReference value) private WasmValuetoWasmValue(NullTest value) private WasmValuetoWasmValue(NumericalTest value) private WasmValuetoWasmValue(ObjectString value) private WasmValuetoWasmValue(Or value) private WasmValuetoWasmValue(PrimitiveClassReference reference) private WasmValuetoWasmValue(PrimitiveDouble value) private WasmValuetoWasmValue(PrimitiveFloat value) private WasmValuetoWasmValue(PrimitiveInt value) private WasmValuetoWasmValue(PrimitiveLong value) private WasmValuetoWasmValue(PrimitiveShort value) private WasmValuetoWasmValue(ReadClassField value) private WasmValuetoWasmValue(ReadInstanceField value) private WasmValuetoWasmValue(ReferenceTest value) private WasmValuetoWasmValue(Reinterpret value) private WasmValuetoWasmValue(Rem value) private WasmValuetoWasmValue(RuntimeClass value) private WasmValuetoWasmValue(RuntimeClassOf value) private WasmValuetoWasmValue(SHL value) private WasmValuetoWasmValue(SHR value) private WasmValuetoWasmValue(Sub value) private WasmValuetoWasmValue(This value) private WasmValuetoWasmValue(TypeConversion value) private WasmValuetoWasmValue(TypeReference value) private WasmValuetoWasmValue(USHR value) private WasmValuetoWasmValue(Value value) private WasmValuetoWasmValue(XOr value) private WasmValueprivate WasmValueprivate WasmValueprivate WasmValuevoidwrite(ArrayStore node) voidwrite(ClassInitialization node) voidvoidwrite(FrameDebugInfo node) voidvoidwrite(LineNumberDebugInfo node) voidwrite(MethodInvocation invocation) voidwrite(MonitorEnter node) voidwrite(MonitorExit node) voidvoidwrite(ReturnValue node) voidwrite(SetClassField node) voidwrite(SetInstanceField node) voidvoidwriteBreakTo(String label) voidwriteContinueTo(String label) private voidwriteDirect(MethodInvocation node) private voidvoidprivate voidwriteStatic(MethodInvocation node) voidwriteSwitchCase(int index) voidprivate voidwriteVirtual(MethodInvocation node)
-
Field Details
-
compileUnit
-
module
-
objectTypeMappings
-
rtMappings
-
exportableFunction
-
typeConverter
-
functionTypeConverter
-
methodToIDMapper
-
varLocalMap
-
activeLevel
-
graph
-
resolvedClasses
-
vTableResolver
-
generatedMethodsRegistry
-
functionIndex
-
lambdaCounter
static int lambdaCounter -
generatedEquals
int generatedEquals -
ifcounter
int ifcounter -
catchcheckcount
int catchcheckcount -
tableSwitchCount
int tableSwitchCount -
lookupSwitchCount
int lookupSwitchCount -
checkcounter
int checkcounter
-
-
Constructor Details
-
WasmStructuredControlflowCodeGenerator
public WasmStructuredControlflowCodeGenerator(CompileUnit compileUnit, Module module, Map<ResolvedClass, StructType> rtMappings, Map<ResolvedClass, StructType> objectTypeMappings, ExportableFunction exportableFunction, Function<org.objectweb.asm.Type, WasmType> typeConverter, Function<ResolvedMethod, FunctionType> functionTypeConverter, MethodToIDMapper methodToIDMapper, Graph graph, List<ResolvedClass> resolvedClasses, VTableResolver vTableResolver, GeneratedMethodsRegistry generatedMethodsRegistry, FunctionIndex functionIndex)
-
-
Method Details
-
registerVariables
- Specified by:
registerVariablesin interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
writeDirect
-
writeVirtual
-
writeStatic
-
writeInterface
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
createNewInstanceOf
public static WasmValue createNewInstanceOf(org.objectweb.asm.Type instanceType, Module module, CompileUnit compileUnit, Map<ResolvedClass, StructType> objectTypeMappings, Map<ResolvedClass, StructType> rtMappings, WasmValue externRef, FunctionIndex functionIndex) -
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValueStatic
-
toWasmValueDirect
-
toWasmValueVirtual
-
toWasmValueInterface
-
createLambdaInstance
private WasmStructuredControlflowCodeGenerator.LambdaInstance createLambdaInstance(org.objectweb.asm.Type type, ExportableFunction implFunction, List<StructType.Field> closureFields, List<WasmValue> closureArguments) -
generateInvokeDynamicLambdaMetaFactoryInvocation
private WasmValue generateInvokeDynamicLambdaMetaFactoryInvocation(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) -
generateInvokeDynamicStringMakeConcatWithConstants
private WasmValue generateInvokeDynamicStringMakeConcatWithConstants(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) -
generateInvokeDynamicObjectMethodsToString
private WasmValue generateInvokeDynamicObjectMethodsToString(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) -
generateInvokeDynamicObjectMethodsEquals
private WasmValue generateInvokeDynamicObjectMethodsEquals(InvokeDynamicExpression node, ResolveCallsite resolveCallsite) -
toWasmValue
-
toType
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
convertToType
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toInstanceOfCheck
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
toWasmValue
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
startIfWithTrueBlock
- Specified by:
startIfWithTrueBlockin interfaceStructuredControlflowCodeGenerator
-
startIfElseBlock
- Specified by:
startIfElseBlockin interfaceStructuredControlflowCodeGenerator
-
finishIfBlock
public void finishIfBlock()- Specified by:
finishIfBlockin interfaceStructuredControlflowCodeGenerator
-
startBlock
- Specified by:
startBlockin interfaceStructuredControlflowCodeGenerator
-
finishBlock
- Specified by:
finishBlockin interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
write
- Specified by:
writein interfaceStructuredControlflowCodeGenerator
-
writeBreakTo
- Specified by:
writeBreakToin interfaceStructuredControlflowCodeGenerator
-
writeContinueTo
- Specified by:
writeContinueToin interfaceStructuredControlflowCodeGenerator
-
startTryCatch
- Specified by:
startTryCatchin interfaceStructuredControlflowCodeGenerator
-
startCatchBlock
public void startCatchBlock()- Specified by:
startCatchBlockin interfaceStructuredControlflowCodeGenerator
-
startCatchHandler
public void startCatchHandler(org.objectweb.asm.Type type) - Specified by:
startCatchHandlerin interfaceStructuredControlflowCodeGenerator
-
finishCatchHandler
public void finishCatchHandler()- Specified by:
finishCatchHandlerin interfaceStructuredControlflowCodeGenerator
-
writeRethrowException
public void writeRethrowException()- Specified by:
writeRethrowExceptionin interfaceStructuredControlflowCodeGenerator
-
finishTryCatch
public void finishTryCatch()- Specified by:
finishTryCatchin interfaceStructuredControlflowCodeGenerator
-
startTableSwitch
- Specified by:
startTableSwitchin interfaceStructuredControlflowCodeGenerator
-
finishTableSwitch
public void finishTableSwitch()- Specified by:
finishTableSwitchin interfaceStructuredControlflowCodeGenerator
-
startTableSwitchDefaultBlock
public void startTableSwitchDefaultBlock()- Specified by:
startTableSwitchDefaultBlockin interfaceStructuredControlflowCodeGenerator
-
finishTableSwitchDefaultBlock
public void finishTableSwitchDefaultBlock()- Specified by:
finishTableSwitchDefaultBlockin interfaceStructuredControlflowCodeGenerator
-
startLookupSwitch
- Specified by:
startLookupSwitchin interfaceStructuredControlflowCodeGenerator
-
finishLookupSwitch
public void finishLookupSwitch()- Specified by:
finishLookupSwitchin interfaceStructuredControlflowCodeGenerator
-
writeSwitchCase
public void writeSwitchCase(int index) - Specified by:
writeSwitchCasein interfaceStructuredControlflowCodeGenerator
-
writeSwitchDefaultCase
public void writeSwitchDefaultCase()- Specified by:
writeSwitchDefaultCasein interfaceStructuredControlflowCodeGenerator
-
finishSwitchDefault
public void finishSwitchDefault()- Specified by:
finishSwitchDefaultin interfaceStructuredControlflowCodeGenerator
-
finishSwitchCase
public void finishSwitchCase()- Specified by:
finishSwitchCasein interfaceStructuredControlflowCodeGenerator
-