bytecode: enhance symbol table with both slab and symbol name

This commit is contained in:
2023-11-21 23:27:21 -08:00
parent 6211ad4ff1
commit 76290a401a
9 changed files with 20 additions and 12 deletions

View File

@ -28,7 +28,7 @@ class CompilableSymbol(val compilableSlab: CompilableSlab, val scopeSymbol: Scop
}
val id: String
get() = "${compilableSlab.slab.location.commonFriendlyName} ${scopeSymbol.symbol.id}"
get() = "${compilableSlab.slab.location.commonLocationIdentity} ${scopeSymbol.symbol.id}"
override fun toString(): String = "${compilableSlab.slab.location.commonFriendlyName} ${scopeSymbol.symbol.id}"
override fun toString(): String = "${compilableSlab.slab.location.commonLocationIdentity} ${scopeSymbol.symbol.id}"
}

View File

@ -11,7 +11,12 @@ class CompiledWorldLayout(val compiler: Compiler) : StubResolutionContext {
val start = allStubOps.size
val result = symbol.compiledStubOps
val stubOps = result.ops
symbolTable[symbol] = SymbolInfo(symbol.id, start.toUInt(), stubOps.size.toUInt())
symbolTable[symbol] = SymbolInfo(
slab = symbol.compilableSlab.slab.location.commonLocationIdentity,
symbol = symbol.id,
offset = start.toUInt(),
size = stubOps.size.toUInt()
)
allStubOps.addAll(stubOps)
allStubAnnotations.addAll(result.annotations)
}

View File

@ -19,7 +19,7 @@ class Compiler {
fun resolve(scopeSymbol: ScopeSymbol): CompilableSymbol = resolveOrNull(scopeSymbol) ?:
throw RuntimeException(
"Unable to resolve scope symbol: " +
"${scopeSymbol.slabScope.slab.location.commonFriendlyName} ${scopeSymbol.symbol.id}")
"${scopeSymbol.slabScope.slab.location.commonLocationIdentity} ${scopeSymbol.symbol.id}")
fun contributeCompiledSymbols(
into: MutableSet<CompilableSymbol>,