From ba9e23766bc174a03b6b90a106c5f752c19710cb Mon Sep 17 00:00:00 2001 From: araq Date: Fri, 12 Dec 2025 08:44:26 +0100 Subject: [PATCH] progress --- compiler/ccgtypes.nim | 2 +- compiler/cgen.nim | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index a2b5e32cb8..53511950da 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -124,7 +124,7 @@ proc fillLocalName(p: BProc; s: PSym) = elif s.kind != skResult: result.add "_" & rope(counter+1) p.sigConflicts.inc(key) - ensureMutable s + backendEnsureMutable s s.locImpl.snippet = result proc scopeMangledParam(p: BProc; param: PSym) = diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 7dd72ce171..cc54b515b6 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -651,7 +651,7 @@ proc localVarDecl(res: var Builder, p: BProc; n: PNode, let s = n.sym if s.loc.k == locNone: fillLocalName(p, s) - ensureMutable s + backendEnsureMutable s fillLoc(s.locImpl, locLocalVar, n, OnStack) if s.kind == skLet: incl(s, lfNoDeepCopy) @@ -713,7 +713,7 @@ proc assignGlobalVar(p: BProc, n: PNode; value: Rope) = let s = n.sym if s.loc.k == locNone: fillBackendName(p.module, s) - ensureMutable s + backendEnsureMutable s fillLoc(s.locImpl, locGlobalVar, n, OnHeap) if treatGlobalDifferentlyForHCR(p.module, s): incl(s, lfIndirect) @@ -722,7 +722,7 @@ proc assignGlobalVar(p: BProc, n: PNode; value: Rope) = if q != nil and not containsOrIncl(q.declaredThings, s.id): varInDynamicLib(q, s) else: - ensureMutable s + backendEnsureMutable s s.locImpl.snippet = mangleDynLibProc(s) if value != "": internalError(p.config, n.info, ".dynlib variables cannot have a value") @@ -763,13 +763,13 @@ proc assignGlobalVar(p: BProc, n: PNode; value: Rope) = genGlobalVarDecl(p.module.s[cfsVars], p, n, td, initializer = initializer) if p.withinLoop > 0 and value == "": # fixes tests/run/tzeroarray: - ensureMutable s + backendEnsureMutable s resetLoc(p, s.locImpl) proc callGlobalVarCppCtor(p: BProc; v: PSym; vn, value: PNode; didGenTemp: var bool) = let s = vn.sym fillBackendName(p.module, s) - ensureMutable s + backendEnsureMutable s fillLoc(s.locImpl, locGlobalVar, vn, OnHeap) let td = getTypeDesc(p.module, vn.sym.typ, dkVar) var val = genCppParamsForCtor(p, value, didGenTemp) @@ -959,7 +959,7 @@ proc symInDynamicLib(m: BModule, sym: PSym) = var extname = sym.loc.snippet if not isCall: loadDynamicLib(m, lib) var tmp = mangleDynLibProc(sym) - ensureMutable sym + backendEnsureMutable sym sym.locImpl.snippet = tmp # from now on we only need the internal name sym.typ.sym = nil # generate a new name inc(m.labels, 2) @@ -1004,7 +1004,7 @@ proc varInDynamicLib(m: BModule, sym: PSym) = loadDynamicLib(m, lib) incl(sym, lfIndirect) var tmp = mangleDynLibProc(sym) - ensureMutable sym + backendEnsureMutable sym sym.locImpl.snippet = tmp # from now on we only need the internal name inc(m.labels, 2) let t = ptrType(getTypeDesc(m, sym.typ, dkVar)) @@ -1018,7 +1018,7 @@ proc varInDynamicLib(m: BModule, sym: PSym) = m.s[cfsVars].addVar(name = sym.loc.snippet, typ = t) proc symInDynamicLibPartial(m: BModule, sym: PSym) = - ensureMutable sym + backendEnsureMutable sym sym.locImpl.snippet = mangleDynLibProc(sym) sym.typ.sym = nil # generate a new name @@ -1336,9 +1336,9 @@ proc genProcLvl3*(m: BModule, prc: PSym) = returnStmt = extract(returnBuilder) elif sfConstructor in prc.flags: resNode.sym.incl lfIndirect - ensureMutable resNode.sym + backendEnsureMutable resNode.sym fillLoc(resNode.sym.locImpl, locParam, resNode, "this", OnHeap) - ensureMutable prc + backendEnsureMutable prc prc.locImpl.snippet = getTypeDesc(m, resNode.sym.locImpl.t, dkVar) else: fillResult(p.config, resNode, prc.typ) @@ -1352,11 +1352,11 @@ proc genProcLvl3*(m: BModule, prc: PSym) = if sfNoInit in prc.flags: discard elif allPathsAsgnResult(p, procBody) == InitSkippable: discard else: - ensureMutable res + backendEnsureMutable res resetLoc(p, res.locImpl) if skipTypes(res.typ, abstractInst).kind == tyArray: #incl(res.loc.flags, lfIndirect) - ensureMutable res + backendEnsureMutable res res.locImpl.storage = OnUnknown for i in 1..