This commit is contained in:
Araq
2025-12-16 22:43:01 +01:00
parent 88685fded1
commit d73043eae6
3 changed files with 20 additions and 3 deletions

View File

@@ -296,7 +296,8 @@ proc incl*(s: PSym; flags: set[TSymFlag]) {.inline.} =
s.flagsImpl.incl(flags)
proc incl*(s: PSym; flag: TLocFlag) {.inline.} =
assert s.state != Sealed
#assert s.state != Sealed
# locImpl is a backend field so do not protect it against mutations
if s.state == Partial: loadSym(s)
s.locImpl.flags.incl(flag)

View File

@@ -717,6 +717,16 @@ proc writeNifModule*(config: ConfigRef; thisModule: int32; n: PNode;
# do not write the (stmts .. ) wrapper:
for i in 3 ..< content.len-1:
dest.add content[i]
# ensure the hooks we announced end up in the NIF file regardless of
# whether they have been used:
for op in opsLog:
if op.module == thisModule.int:
let s = op.sym
if s.state != Sealed:
s.state = Sealed
writeSymDef w, dest, s
dest.addParRi()
writeFile(dest, d)

View File

@@ -68,11 +68,17 @@ proc findPendingModule(m: BModule, s: PSym): BModule =
if m.config.symbolFiles == v2Sf or optCompress in m.config.globalOptions:
let ms = s.itemId.module #getModule(s)
result = m.g.modules[ms]
elif m.config.cmd in {cmdNifC, cmdM}:
var ms = getModule(s)
if ms.position >= m.g.modules.len:
result = newModule(m.g, ms, m.config, idGeneratorFromModule(ms))
else:
result = m.g.modules[ms.position]
if result == nil:
result = newModule(m.g, ms, m.config, idGeneratorFromModule(ms))
else:
var ms = getModule(s)
result = m.g.modules[ms.position]
if result == nil:
result = newModule(m.g, ms, m.config, idGeneratorFromModule(ms))
proc initLoc(k: TLocKind, lode: PNode, s: TStorageLoc, flags: TLocFlags = {}): TLoc =
result = TLoc(k: k, storage: s, lode: lode,