mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-14 23:53:47 +00:00
fixes VM register liveness for lent
This commit is contained in:
@@ -1842,6 +1842,8 @@ proc genArrAccessOpcode(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
||||
if dest < 0: dest = c.getTemp(n.typ)
|
||||
if opc in {opcLdArrAddr, opcLdStrIdxAddr} and gfNodeAddr in flags:
|
||||
c.gABC(n, opc, dest, a, b)
|
||||
if c.prc.regInfo[a].kind >= slotTempUnknown:
|
||||
c.prc.regInfo[a].kind = slotTempPerm
|
||||
elif needsRegLoad():
|
||||
var cc = c.getTemp(n.typ)
|
||||
c.gABC(n, opc, cc, a, b)
|
||||
@@ -1858,6 +1860,8 @@ proc genObjAccessAux(c: PCtx; n: PNode; a, b: int, dest: var TDest; flags: TGenF
|
||||
if dest < 0: dest = c.getTemp(n.typ)
|
||||
if {gfNodeAddr} * flags != {}:
|
||||
c.gABC(n, opcLdObjAddr, dest, a, b)
|
||||
if a < c.prc.regInfo.len and c.prc.regInfo[a].kind >= slotTempUnknown:
|
||||
c.prc.regInfo[a].kind = slotTempPerm
|
||||
elif needsRegLoad():
|
||||
var cc = c.getTemp(n.typ)
|
||||
c.gABC(n, opcLdObj, cc, a, b)
|
||||
|
||||
16
tests/vm/t25849.nim
Normal file
16
tests/vm/t25849.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
discard """
|
||||
targets: "c cpp js"
|
||||
"""
|
||||
|
||||
import std/os
|
||||
from std/sequtils import toSeq
|
||||
|
||||
iterator items(a: array[3, string]): lent string {.inline.} =
|
||||
for i in 0..2:
|
||||
yield a[i]
|
||||
|
||||
static:
|
||||
const key = "NIM_TESTS_TOSENV_KEY"
|
||||
for val in items(["a", "b", "c"]):
|
||||
putEnv(key, val)
|
||||
doAssert (key, val) in toSeq(envPairs())
|
||||
Reference in New Issue
Block a user