make the VM aware of tyOwned
This commit is contained in:
parent
adbabf145c
commit
7ec187a8e1
1 changed files with 4 additions and 4 deletions
|
|
@ -1337,7 +1337,7 @@ proc fitsRegister*(t: PType): bool =
|
||||||
tyRange, tyEnum, tyBool, tyInt..tyUInt64, tyChar}
|
tyRange, tyEnum, tyBool, tyInt..tyUInt64, tyChar}
|
||||||
|
|
||||||
proc unneededIndirection(n: PNode): bool =
|
proc unneededIndirection(n: PNode): bool =
|
||||||
n.typ.skipTypes(abstractInst-{tyTypeDesc}).kind == tyRef
|
n.typ.skipTypes(abstractInstOwned-{tyTypeDesc}).kind == tyRef
|
||||||
|
|
||||||
proc canElimAddr(n: PNode): PNode =
|
proc canElimAddr(n: PNode): PNode =
|
||||||
case n.sons[0].kind
|
case n.sons[0].kind
|
||||||
|
|
@ -1397,7 +1397,7 @@ proc genDeref(c: PCtx, n: PNode, dest: var TDest, flags: TGenFlags) =
|
||||||
c.gABC(n, opcNodeToReg, dest, dest)
|
c.gABC(n, opcNodeToReg, dest, dest)
|
||||||
|
|
||||||
proc whichAsgnOpc(n: PNode): TOpcode =
|
proc whichAsgnOpc(n: PNode): TOpcode =
|
||||||
case n.typ.skipTypes(abstractRange-{tyTypeDesc}).kind
|
case n.typ.skipTypes(abstractRange+{tyOwned}-{tyTypeDesc}).kind
|
||||||
of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64:
|
of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64:
|
||||||
opcAsgnInt
|
opcAsgnInt
|
||||||
of tyString, tyCString:
|
of tyString, tyCString:
|
||||||
|
|
@ -1717,7 +1717,7 @@ proc getNullValueAux(obj: PNode, result: PNode; conf: ConfigRef) =
|
||||||
else: globalError(conf, result.info, "cannot create null element for: " & $obj)
|
else: globalError(conf, result.info, "cannot create null element for: " & $obj)
|
||||||
|
|
||||||
proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
|
proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
|
||||||
var t = skipTypes(typ, abstractRange+{tyStatic}-{tyTypeDesc})
|
var t = skipTypes(typ, abstractRange+{tyStatic, tyOwned}-{tyTypeDesc})
|
||||||
case t.kind
|
case t.kind
|
||||||
of tyBool, tyEnum, tyChar, tyInt..tyInt64:
|
of tyBool, tyEnum, tyChar, tyInt..tyInt64:
|
||||||
result = newNodeIT(nkIntLit, info, t)
|
result = newNodeIT(nkIntLit, info, t)
|
||||||
|
|
@ -1864,7 +1864,7 @@ proc genSetConstr(c: PCtx, n: PNode, dest: var TDest) =
|
||||||
|
|
||||||
proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) =
|
proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) =
|
||||||
if dest < 0: dest = c.getTemp(n.typ)
|
if dest < 0: dest = c.getTemp(n.typ)
|
||||||
let t = n.typ.skipTypes(abstractRange-{tyTypeDesc})
|
let t = n.typ.skipTypes(abstractRange+{tyOwned}-{tyTypeDesc})
|
||||||
if t.kind == tyRef:
|
if t.kind == tyRef:
|
||||||
c.gABx(n, opcNew, dest, c.genType(t.sons[0]))
|
c.gABx(n, opcNew, dest, c.genType(t.sons[0]))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue