remove name field for ARC (#20797)
* remove name field for ARC * mistake * improvement * better * typo * fixes a pre-existing bug
This commit is contained in:
parent
0ead94c4eb
commit
f11b7debf7
3 changed files with 19 additions and 14 deletions
|
|
@ -1349,15 +1349,6 @@ proc genDisplay(t: PType, depth: int): Rope =
|
||||||
result.add "}"
|
result.add "}"
|
||||||
|
|
||||||
proc genTypeInfoV2Impl(m: BModule; t, origType: PType, name: Rope; info: TLineInfo) =
|
proc genTypeInfoV2Impl(m: BModule; t, origType: PType, name: Rope; info: TLineInfo) =
|
||||||
var typeName: Rope
|
|
||||||
if isDefined(m.config, "nimTypeNames") and t.kind in {tyObject, tyDistinct}:
|
|
||||||
if incompleteType(t):
|
|
||||||
localError(m.config, info, "request for RTTI generation for incomplete object: " &
|
|
||||||
typeToString(t))
|
|
||||||
typeName = genTypeInfo2Name(m, t)
|
|
||||||
else:
|
|
||||||
typeName = rope("NIM_NIL")
|
|
||||||
|
|
||||||
cgsym(m, "TNimTypeV2")
|
cgsym(m, "TNimTypeV2")
|
||||||
m.s[cfsStrData].addf("N_LIB_PRIVATE TNimTypeV2 $1;$n", [name])
|
m.s[cfsStrData].addf("N_LIB_PRIVATE TNimTypeV2 $1;$n", [name])
|
||||||
|
|
||||||
|
|
@ -1373,14 +1364,26 @@ proc genTypeInfoV2Impl(m: BModule; t, origType: PType, name: Rope; info: TLineIn
|
||||||
|
|
||||||
let objDepth = if t.kind == tyObject: getObjDepth(t) else: -1
|
let objDepth = if t.kind == tyObject: getObjDepth(t) else: -1
|
||||||
|
|
||||||
addf(typeEntry, "; $1.name = $2;$n; $1.size = sizeof($3); $1.align = (NI16) NIM_ALIGNOF($3); $1.depth = $4; $1.flags = $5;",
|
|
||||||
[name, typeName, getTypeDesc(m, t), rope(objDepth), rope(flags)])
|
if t.kind in {tyObject, tyDistinct} and incompleteType(t):
|
||||||
|
localError(m.config, info, "request for RTTI generation for incomplete object: " &
|
||||||
|
typeToString(t))
|
||||||
|
|
||||||
|
if isDefined(m.config, "nimTypeNames"):
|
||||||
|
var typeName: Rope
|
||||||
|
if t.kind in {tyObject, tyDistinct}:
|
||||||
|
typeName = genTypeInfo2Name(m, t)
|
||||||
|
else:
|
||||||
|
typeName = rope("NIM_NIL")
|
||||||
|
addf(typeEntry, "; $1.name = $2", [name, typeName])
|
||||||
|
addf(typeEntry, "; $1.size = sizeof($2); $1.align = (NI16) NIM_ALIGNOF($2); $1.depth = $3; $1.flags = $4;",
|
||||||
|
[name, getTypeDesc(m, t), rope(objDepth), rope(flags)])
|
||||||
|
|
||||||
if objDepth >= 0:
|
if objDepth >= 0:
|
||||||
let objDisplay = genDisplay(t, objDepth)
|
let objDisplay = genDisplay(t, objDepth)
|
||||||
let objDisplayStore = getTempName(m)
|
let objDisplayStore = getTempName(m)
|
||||||
m.s[cfsVars].addf("static $1 $2[$3] = $4;$n", [getTypeDesc(m, getSysType(m.g.graph, unknownLineInfo, tyUInt32), skVar), objDisplayStore, rope(objDepth+1), objDisplay])
|
m.s[cfsVars].addf("static $1 $2[$3] = $4;$n", [getTypeDesc(m, getSysType(m.g.graph, unknownLineInfo, tyUInt32), skVar), objDisplayStore, rope(objDepth+1), objDisplay])
|
||||||
addf(typeEntry, "; $1.display = $2;$n", [name, rope(objDisplayStore)])
|
addf(typeEntry, "$1.display = $2;$n", [name, rope(objDisplayStore)])
|
||||||
|
|
||||||
m.s[cfsTypeInit3].add typeEntry
|
m.s[cfsTypeInit3].add typeEntry
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1595,7 +1595,8 @@ when not defined(js) and defined(nimV2):
|
||||||
align: int16
|
align: int16
|
||||||
depth: int16
|
depth: int16
|
||||||
display: ptr UncheckedArray[uint32] # classToken
|
display: ptr UncheckedArray[uint32] # classToken
|
||||||
name: cstring
|
when defined(nimTypeNames):
|
||||||
|
name: cstring
|
||||||
traceImpl: pointer
|
traceImpl: pointer
|
||||||
typeInfoV1: pointer # for backwards compat, usually nil
|
typeInfoV1: pointer # for backwards compat, usually nil
|
||||||
flags: int
|
flags: int
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,8 @@ proc breakCycles(s: Cell; desc: PNimTypeV2) =
|
||||||
else:
|
else:
|
||||||
# anyhow as a link that the produced destructor does not have to follow:
|
# anyhow as a link that the produced destructor does not have to follow:
|
||||||
u[] = nil
|
u[] = nil
|
||||||
cprintf("[Bug] %p %s RC %ld\n", t, desc.name, t.rc shr rcShift)
|
when traceCollector:
|
||||||
|
cprintf("[Bug] %p %s RC %ld\n", t, desc.name, t.rc shr rcShift)
|
||||||
deinit j.traceStack
|
deinit j.traceStack
|
||||||
|
|
||||||
proc thinout*[T](x: ref T) {.inline.} =
|
proc thinout*[T](x: ref T) {.inline.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue