diff --git a/nds.nimble b/nds.nimble index 69e57f3..e93eae1 100644 --- a/nds.nimble +++ b/nds.nimble @@ -15,6 +15,7 @@ bin = @["nds"] requires "nim >= 1.6.2" 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 "rm tests/test" diff --git a/src/ndspkg/compiler/collections.nim b/src/ndspkg/compiler/collections.nim index f961c2e..6fc8dbe 100644 --- a/src/ndspkg/compiler/collections.nim +++ b/src/ndspkg/compiler/collections.nim @@ -1,19 +1,13 @@ -import strformat -import strutils -import bitops # needed for value +{.used.} import ../scanner import ../chunk -import ../types/value -import ../config # the following order of imports here is important # it defines the allowed dependency precedence between the compiler files import types import utils import precedence -import jumps -import scope # lists diff --git a/src/ndspkg/compiler/controlflow.nim b/src/ndspkg/compiler/controlflow.nim index ddedee5..a94cc44 100644 --- a/src/ndspkg/compiler/controlflow.nim +++ b/src/ndspkg/compiler/controlflow.nim @@ -1,11 +1,7 @@ -import strformat -import strutils -import bitops # needed for value +{.used.} import ../scanner import ../chunk -import ../types/value -import ../config # the following order of imports here is important # it defines the allowed dependency precedence between the compiler files @@ -13,7 +9,6 @@ import types import utils import precedence import jumps -import scope proc ifExpr(comp: Compiler) = # if expressions return the body if condition is truthy, diff --git a/src/ndspkg/compiler/expressions.nim b/src/ndspkg/compiler/expressions.nim index e181023..7070549 100644 --- a/src/ndspkg/compiler/expressions.nim +++ b/src/ndspkg/compiler/expressions.nim @@ -1,6 +1,5 @@ -# THIS MODULE IS TO BE SPLIT UP LATER +{.used.} -import strformat import strutils import bitops # needed for value @@ -14,8 +13,6 @@ import ../config import types import utils import precedence -import jumps -import scope # EXPRESSIONS diff --git a/src/ndspkg/compiler/functions.nim b/src/ndspkg/compiler/functions.nim index 4a25c9f..be1cab0 100644 --- a/src/ndspkg/compiler/functions.nim +++ b/src/ndspkg/compiler/functions.nim @@ -1,10 +1,9 @@ +{.used.} + import strformat -import strutils -import bitops # needed for value import ../scanner import ../chunk -import ../types/value import ../config # the following order of imports here is important diff --git a/src/ndspkg/compiler/statement.nim b/src/ndspkg/compiler/statement.nim index 8d89ac9..d11fd6e 100644 --- a/src/ndspkg/compiler/statement.nim +++ b/src/ndspkg/compiler/statement.nim @@ -1,3 +1,4 @@ +{.used.} import ../scanner import ../chunk diff --git a/src/ndspkg/compiler/variables.nim b/src/ndspkg/compiler/variables.nim index 09997c9..7e60ae4 100644 --- a/src/ndspkg/compiler/variables.nim +++ b/src/ndspkg/compiler/variables.nim @@ -1,3 +1,5 @@ +{.used.} + import bitops # needed for value import ../scanner diff --git a/src/ndspkg/config.nim b/src/ndspkg/config.nim index 985ab05..c5e74e9 100644 --- a/src/ndspkg/config.nim +++ b/src/ndspkg/config.nim @@ -10,7 +10,8 @@ const debugDumpChunk* = defined(debug) const assertionsCompiler* = true # sanity checks in the compiler # vm debug options (setting any to true will slow runtime down!) 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 debugClosures* = defined(debug) # specific closure debug switches diff --git a/src/ndspkg/types/ndlist.nim b/src/ndspkg/types/ndlist.nim index 3a89f22..21c3a15 100644 --- a/src/ndspkg/types/ndlist.nim +++ b/src/ndspkg/types/ndlist.nim @@ -1,7 +1,8 @@ import strformat # 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 # boundsChecking is only meant for debugging const growthFactor = 2 diff --git a/src/ndspkg/types/stack.nim b/src/ndspkg/types/stack.nim index 43be89e..bba8af8 100644 --- a/src/ndspkg/types/stack.nim +++ b/src/ndspkg/types/stack.nim @@ -1,7 +1,8 @@ import ../pointerutils # 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 # boundsChecking is only meant for debugging const growthFactor = 2