fix #14339, #13511, #14420: fixes limited VM support for addr (#16002)

* fix #14339: fixes limited VM support for addr

* strengthen test

* reference bug #16003

* also fixes #13511

* also fixes #14420
This commit is contained in:
Timothee Cour 2020-11-25 11:48:10 -08:00 • committed by GitHub
commit 3e7077ac7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 160 additions and 44 deletions

View file

@ -746,10 +746,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
regs[ra].regAddr = addr(regs[rb])
of opcAddrNode:
decodeB(rkNodeAddr)
if regs[rb].kind == rkNode:
case regs[rb].kind
of rkNode:
regs[ra].nodeAddr = addr(regs[rb].node)
of rkNodeAddr: # bug #14339
regs[ra].nodeAddr = regs[rb].nodeAddr
else:
stackTrace(c, tos, pc, "limited VM support for 'addr'")
stackTrace(c, tos, pc, "limited VM support for 'addr', got kind: " & $regs[rb].kind)
of opcLdDeref:
# a = b[]
let ra = instr.regA