mark compiler modules as used, make nimble test rebuild in release mode, make release mode enable all assertions and bounds checks

This commit is contained in:
prod2 2022-02-08 06:04:39 +01:00
parent d4a6921302
commit 2517439caf
10 changed files with 15 additions and 23 deletions

View File

@ -15,6 +15,7 @@ bin = @["nds"]
requires "nim >= 1.6.2" requires "nim >= 1.6.2"
task test, "run tests": task test, "run tests":
exec "nim c --gc:arc -d:release --skipProjCfg --skipParentCfg --out:bin/nds src/nds.nim"
exec "nim c --gc:arc -d:debug --skipProjCfg --skipParentCfg -r tests/test.nim" exec "nim c --gc:arc -d:debug --skipProjCfg --skipParentCfg -r tests/test.nim"
exec "rm tests/test" exec "rm tests/test"

View File

@ -1,19 +1,13 @@
import strformat {.used.}
import strutils
import bitops # needed for value
import ../scanner import ../scanner
import ../chunk import ../chunk
import ../types/value
import ../config
# the following order of imports here is important # the following order of imports here is important
# it defines the allowed dependency precedence between the compiler files # it defines the allowed dependency precedence between the compiler files
import types import types
import utils import utils
import precedence import precedence
import jumps
import scope
# lists # lists

View File

@ -1,11 +1,7 @@
import strformat {.used.}
import strutils
import bitops # needed for value
import ../scanner import ../scanner
import ../chunk import ../chunk
import ../types/value
import ../config
# the following order of imports here is important # the following order of imports here is important
# it defines the allowed dependency precedence between the compiler files # it defines the allowed dependency precedence between the compiler files
@ -13,7 +9,6 @@ import types
import utils import utils
import precedence import precedence
import jumps import jumps
import scope
proc ifExpr(comp: Compiler) = proc ifExpr(comp: Compiler) =
# if expressions return the body if condition is truthy, # if expressions return the body if condition is truthy,

View File

@ -1,6 +1,5 @@
# THIS MODULE IS TO BE SPLIT UP LATER {.used.}
import strformat
import strutils import strutils
import bitops # needed for value import bitops # needed for value
@ -14,8 +13,6 @@ import ../config
import types import types
import utils import utils
import precedence import precedence
import jumps
import scope
# EXPRESSIONS # EXPRESSIONS

View File

@ -1,10 +1,9 @@
{.used.}
import strformat import strformat
import strutils
import bitops # needed for value
import ../scanner import ../scanner
import ../chunk import ../chunk
import ../types/value
import ../config import ../config
# the following order of imports here is important # the following order of imports here is important

View File

@ -1,3 +1,4 @@
{.used.}
import ../scanner import ../scanner
import ../chunk import ../chunk

View File

@ -1,3 +1,5 @@
{.used.}
import bitops # needed for value import bitops # needed for value
import ../scanner import ../scanner

View File

@ -10,7 +10,8 @@ const debugDumpChunk* = defined(debug)
const assertionsCompiler* = true # sanity checks in the compiler const assertionsCompiler* = true # sanity checks in the compiler
# vm debug options (setting any to true will slow runtime down!) # vm debug options (setting any to true will slow runtime down!)
const debugVM* = defined(debug) const debugVM* = defined(debug)
const assertionsVM* = defined(debug) # sanity checks in the VM, such as the stack being empty at the end const assertionsVM* = defined(debug) or defined(release) # sanity checks in the VM, such as the stack being empty at the end
const boundsChecks* = defined(debug) or defined(release)
const profileInstructions* = defined(ndsprofile) # if true, the time spent on every opcode is measured const profileInstructions* = defined(ndsprofile) # if true, the time spent on every opcode is measured
const debugClosures* = defined(debug) # specific closure debug switches const debugClosures* = defined(debug) # specific closure debug switches

View File

@ -1,7 +1,8 @@
import strformat import strformat
# configure ndlist here # configure ndlist here
const boundsChecks = defined(debug) import ../config
#const boundsChecks = defined(debug)
# boundsChecks default: false, true has a large performance impact, and emitting correct code is on the compiler's job # boundsChecks default: false, true has a large performance impact, and emitting correct code is on the compiler's job
# boundsChecking is only meant for debugging # boundsChecking is only meant for debugging
const growthFactor = 2 const growthFactor = 2

View File

@ -1,7 +1,8 @@
import ../pointerutils import ../pointerutils
# configure stacks here # configure stacks here
const boundsChecks = defined(debug) import ../config
#const boundsChecks = defined(debug)
# boundsChecks default: false, true has a large performance impact, and emitting correct code is on the compiler's job # boundsChecks default: false, true has a large performance impact, and emitting correct code is on the compiler's job
# boundsChecking is only meant for debugging # boundsChecking is only meant for debugging
const growthFactor = 2 const growthFactor = 2