[WASM] Initial infrastructure
- New module ":compiler:backend.wasm"
- Initial compiler infra (driver, phaser, context)
- Subset of Wasm AST
- Skeleton of IR -> Wasm AST
- Wasm AST -> WAT transformer
- Testing infra
- SpiderMonkey jsshell tool
This commit is contained in:
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
|
||||
private fun sortDependencies(dependencies: Collection<IrModuleFragment>): Collection<IrModuleFragment> {
|
||||
fun sortDependencies(dependencies: Collection<IrModuleFragment>): Collection<IrModuleFragment> {
|
||||
val mapping = dependencies.map { it.descriptor to it }.toMap()
|
||||
|
||||
return DFS.topologicalOrder(dependencies) { m ->
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ object JsAnnotations {
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun IrConstructorCall.getSingleConstStringArgument() =
|
||||
fun IrConstructorCall.getSingleConstStringArgument() =
|
||||
(getValueArgument(0) as IrConst<String>).value
|
||||
|
||||
fun IrAnnotationContainer.getJsModule(): String? =
|
||||
|
||||
@@ -23,7 +23,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
|
||||
class NameTable<T>(
|
||||
val parent: NameTable<T>? = null,
|
||||
private val reserved: MutableSet<String> = mutableSetOf()
|
||||
private val reserved: MutableSet<String> = mutableSetOf(),
|
||||
val sanitizer: (String) -> String = ::sanitizeName
|
||||
) {
|
||||
var finished = false
|
||||
val names = mutableMapOf<T, String>()
|
||||
@@ -41,9 +42,10 @@ class NameTable<T>(
|
||||
reserved.add(name)
|
||||
}
|
||||
|
||||
fun declareFreshName(declaration: T, suggestedName: String) {
|
||||
val freshName = findFreshName(sanitizeName(suggestedName))
|
||||
fun declareFreshName(declaration: T, suggestedName: String): String {
|
||||
val freshName = findFreshName(sanitizer(suggestedName))
|
||||
declareStableName(declaration, freshName)
|
||||
return freshName
|
||||
}
|
||||
|
||||
private fun findFreshName(suggestedName: String): String {
|
||||
|
||||
Reference in New Issue
Block a user