[JS IR IC] Calculate symbol hashes on demand

Optimization: often we don't need all hashes for all available symbols.
 This patch allows the calculation of the symbol hash only on demand.

 This patch also allows cycles for the inline function dependency
 graph in the IC infrastructure. Note that the inline function cycles
 may crash the inliner, however it is not the IC infrastructure
 responsibility to check the cycles.
This commit is contained in:
Alexander Korepanov
2022-12-19 11:55:52 +01:00
committed by Space Team
parent bd295df7d0
commit c502cae437
12 changed files with 155 additions and 111 deletions
@@ -0,0 +1,6 @@
inline fun funA(flag: Boolean = true): Int {
if (flag) {
return funB()
}
return 2
}
@@ -0,0 +1,6 @@
inline fun funA(flag: Boolean = false): Int {
if (flag) {
return funB()
}
return 2
}
@@ -0,0 +1,7 @@
inline fun funB(): Int {
val f = ::funA
if (false) {
return f(false)
}
return 0
}
@@ -0,0 +1,7 @@
inline fun funB(): Int {
val f = ::funA
if (false) {
return f(false)
}
return 1
}
@@ -0,0 +1,15 @@
STEP 0:
modifications:
U : l1a.0.kt -> l1a.kt
U : l1b.0.kt -> l1b.kt
added file: l1a.kt, l1b.kt
STEP 1:
modifications:
U : l1b.1.kt -> l1b.kt
modified ir: l1b.kt
updated imports: l1a.kt
STEP 2:
modifications:
U : l1a.2.kt -> l1a.kt
modified ir: l1a.kt
updated imports: l1b.kt
@@ -0,0 +1,7 @@
fun box(stepId: Int): String {
val x = funA()
if (x != stepId) {
return "Fail: $x != $stepId"
}
return "OK"
}
@@ -0,0 +1,6 @@
STEP 0:
dependencies: lib1
added file: m.kt
STEP 1..2:
dependencies: lib1
updated imports: m.kt
@@ -0,0 +1,5 @@
MODULES: lib1, main
STEP 0..2:
libs: lib1, main
dirty js: lib1, main