All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.backend.wasm.ir2wasm.WasmBaseCodegenContext.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/*
 * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.backend.wasm.ir2wasm

import org.jetbrains.kotlin.backend.wasm.WasmBackendContext
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.wasm.ir.*

interface WasmBaseCodegenContext {
    val backendContext: WasmBackendContext

    val scratchMemAddr: WasmSymbol

    fun referenceFunction(irFunction: IrFunctionSymbol): WasmSymbol
    fun referenceGlobalField(irField: IrFieldSymbol): WasmSymbol
    fun referenceGlobalVTable(irClass: IrClassSymbol): WasmSymbol
    fun referenceGlobalClassITable(irClass: IrClassSymbol): WasmSymbol
    fun referenceGcType(irClass: IrClassSymbol): WasmSymbol
    fun referenceVTableGcType(irClass: IrClassSymbol): WasmSymbol
    fun referenceClassITableGcType(irClass: IrClassSymbol): WasmSymbol
    fun defineClassITableGcType(irClass: IrClassSymbol, wasmType: WasmTypeDeclaration)
    fun isAlreadyDefinedClassITableGcType(irClass: IrClassSymbol): Boolean
    fun referenceClassITableInterfaceSlot(irClass: IrClassSymbol): WasmSymbol
    fun defineClassITableInterfaceSlot(irClass: IrClassSymbol, slot: Int)
    fun referenceFunctionType(irFunction: IrFunctionSymbol): WasmSymbol

    fun referenceClassId(irClass: IrClassSymbol): WasmSymbol
    fun referenceInterfaceId(irInterface: IrClassSymbol): WasmSymbol

    fun referenceStringLiteral(string: String): WasmSymbol

    fun transformType(irType: IrType): WasmType
    fun transformFieldType(irType: IrType): WasmType

    fun transformBoxedType(irType: IrType): WasmType
    fun transformValueParameterType(irValueParameter: IrValueParameter): WasmType
    fun transformResultType(irType: IrType): WasmType?
    fun transformBlockResultType(irType: IrType): WasmType?


    fun getStructFieldRef(field: IrField): WasmSymbol
    fun getClassMetadata(irClass: IrClassSymbol): ClassMetadata
    fun getInterfaceMetadata(irClass: IrClassSymbol): InterfaceMetadata
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy