Revert "[Wasm][Temporary] Stubs for typeOf and ::class constructs"

This reverts commit 8dc81b6c57.
This commit is contained in:
Igor Yakovlev
2021-11-08 13:49:46 +01:00
committed by TeamCityServer
parent 7d56ef1925
commit d9f2bd7963
13 changed files with 28 additions and 21 deletions
@@ -45,11 +45,6 @@ class WasmSymbols(
private val kotlinTestPackage: PackageViewDescriptor =
context.module.getPackage(FqName("kotlin.test"))
private val kotlinReflectPackage: PackageViewDescriptor =
context.module.getPackage(FqName("kotlin.reflect"))
val typeOf = getFunction("typeOf", kotlinReflectPackage)
override val throwNullPointerException = getInternalFunction("THROW_NPE")
override val throwISE = getInternalFunction("THROW_ISE")
override val throwTypeCastException = getInternalFunction("THROW_CCE")
@@ -64,17 +64,6 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
error("Unexpected element of type ${element::class}")
}
override fun visitClassReference(expression: IrClassReference) {
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
body.buildUnreachable()
}
override fun visitGetClass(expression: IrGetClass) {
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
body.buildUnreachable()
}
override fun visitThrow(expression: IrThrow) {
generateExpression(expression.value)
body.buildThrow(context.tagIdx)
@@ -345,11 +334,6 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
}
when (function.symbol) {
wasmSymbols.typeOf -> {
body.buildCall(context.referenceFunction(wasmSymbols.throwISE))
body.buildGetUnit()
}
wasmSymbols.wasmClassId -> {
val klass = call.getTypeArgument(0)!!.getClass()
?: error("No class given for wasmClassId intrinsic")
@@ -1,3 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: CLASS_REFERENCES
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.coroutines.*
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: WASM
// WITH_RUNTIME
fun nonGenericId(x: Any?) = x
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
fun box(): String {
lateinit var str: String
try {
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
fun runNoInline(f: () -> Unit) = f()
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
fun runNoInline(f: () -> Unit) = f()
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
fun box(): String {
@@ -1,4 +1,6 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
// FILE: lateinit.kt
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
lateinit var str: String
@@ -1,5 +1,8 @@
// WITH_RUNTIME
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: REFLECTION
import kotlin.UninitializedPropertyAccessException
lateinit var str: String
@@ -1,3 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not