explicit ID generation for easier IC (#15559)

* refactoring: idents don't need inheritance
* refactoring: adding an IdGenerator (part 1)
* refactoring: adding an IdGenerator (part 2)
* refactoring: adding an IdGenerator (part 3)
* refactoring: adding an IdGenerator (part 4)
* refactoring: adding an IdGenerator (part 5)
* refactoring: adding an IdGenerator (part 5)
* IdGenerator must be a ref type; hello world works again
* make bootstrapping work again
* progress: add back the 'exactReplica' ideas
* added back the missing exactReplica hacks
* make tcompilerapi work again
* make important packages green
* attempt to fix the build for 32 bit machines (probably need a better solution here)
This commit is contained in:
Andreas Rumpf 2020-10-25 08:50:47 +01:00 • committed by GitHub
commit 226595515c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 853 additions and 903 deletions

View file

@ -27,9 +27,9 @@ proc listDirs(a: VmArgs, filter: set[PathComponent]) =
setResult(a, result)
proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
graph: ModuleGraph): PEvalContext =
graph: ModuleGraph; idgen: IdGenerator): PEvalContext =
# For Nimble we need to export 'setupVM'.
result = newCtx(module, cache, graph)
result = newCtx(module, cache, graph, idgen)
result.mode = emRepl
registerAdditionalOps(result)
let conf = graph.config
@ -198,6 +198,7 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
setResult(a, stdin.readAll())
proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
idgen: IdGenerator;
freshDefines=true; conf: ConfigRef) =
let oldSymbolFiles = conf.symbolFiles
conf.symbolFiles = disabledSf
@ -221,10 +222,11 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
var m = graph.makeModule(scriptName)
incl(m.flags, sfMainModule)
graph.vm = setupVM(m, cache, scriptName.string, graph)
var vm = setupVM(m, cache, scriptName.string, graph, idgen)
graph.vm = vm
graph.compileSystemModule()
discard graph.processModule(m, llStreamOpen(scriptName, fmRead))
discard graph.processModule(m, vm.idgen, llStreamOpen(scriptName, fmRead))
# watch out, "newruntime" can be set within NimScript itself and then we need
# to remember this: