fixes #16790; fixes #19075; put big arrays on the constant seqs; don't inline them in the VM; big performance boost (#21318)

* don't inline arrays in VM

* add a test for #19075
This commit is contained in:
ringabout 2023-02-01 02:22:10 +08:00 • committed by GitHub
commit b5f64f55d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View file

@ -32,7 +32,7 @@ when defined(nimPreviewSlimSystem):
import std/assertions
import
strutils, ast, types, msgs, renderer, vmdef,
strutils, ast, types, msgs, renderer, vmdef, trees,
intsets, magicsys, options, lowerings, lineinfos, transf, astmsgs
from modulegraphs import getBody
@ -2054,7 +2054,10 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
genLit(c, n, dest)
of skConst:
let constVal = if s.astdef != nil: s.astdef else: s.typ.n
gen(c, constVal, dest)
if dontInlineConstant(n, constVal):
genLit(c, constVal, dest)
else:
gen(c, constVal, dest)
of skEnumField:
# we never reach this case - as of the time of this comment,
# skEnumField is folded to an int in semfold.nim, but this code