From c1205b2f0aab9bcda6917795fefdc34db9a9e8d8 Mon Sep 17 00:00:00 2001 From: araq Date: Thu, 11 Dec 2025 14:33:53 +0100 Subject: [PATCH] IC backend: progress --- compiler/cgen.nim | 6 +++++- compiler/commands.nim | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 1b64a64daf..7fd7b0f8bd 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -61,6 +61,8 @@ proc hcrOn(p: BProc): bool = p.module.config.hcrOn proc addForwardedProc(m: BModule, prc: PSym) = m.g.forwardedProcs.add(prc) +proc newModule*(g: BModuleList; module: PSym; conf: ConfigRef): BModule + proc findPendingModule(m: BModule, s: PSym): BModule = # TODO fixme if m.config.symbolFiles == v2Sf or optCompress in m.config.globalOptions: @@ -69,6 +71,8 @@ proc findPendingModule(m: BModule, s: PSym): BModule = else: var ms = getModule(s) result = m.g.modules[ms.position] + if result == nil: + result = newModule(m.g, ms, m.config) proc initLoc(k: TLocKind, lode: PNode, s: TStorageLoc, flags: TLocFlags = {}): TLoc = result = TLoc(k: k, storage: s, lode: lode, @@ -2368,7 +2372,7 @@ proc rawNewModule(g: BModuleList; module: PSym, filename: AbsoluteFile): BModule proc rawNewModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule = result = rawNewModule(g, module, AbsoluteFile toFullPath(conf, module.position.FileIndex)) -proc newModule*(g: BModuleList; module: PSym; conf: ConfigRef): BModule = +proc newModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule = # we should create only one cgen module for each module sym result = rawNewModule(g, module, conf) if module.position >= g.modules.len: diff --git a/compiler/commands.nim b/compiler/commands.nim index f782c6dc3d..622e5536fe 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -514,7 +514,6 @@ proc setCmd*(conf: ConfigRef, cmd: Command) = of cmdCompileToNif: conf.backend = backendNif of cmdNifC: conf.backend = backendC # NIF to C compilation - conf.globalOptions.incl optCompress # enable NIF loading of cmdM: # cmdM requires optCompress for proper IC handling (include files, etc.) conf.globalOptions.incl optCompress