From 66cd6be0be28b2145ea04480eb9323bdd6c6cd25 Mon Sep 17 00:00:00 2001 From: Mattia Giambirtone Date: Sat, 8 Oct 2022 15:21:13 +0200 Subject: [PATCH] Minor additions/changes --- src/backend/vm.nim | 4 ++-- src/config.nim | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/backend/vm.nim b/src/backend/vm.nim index 94829e6..5627ac9 100644 --- a/src/backend/vm.nim +++ b/src/backend/vm.nim @@ -31,7 +31,7 @@ when debugVM or debugMem or debugGC: import std/terminal -{.push checks:on.} # The VM is a critical point where checks are deleterious +{.push checks:not disableVMChecks.} # The VM is a critical point where checks are deleterious type PeonVM* = ref object @@ -68,7 +68,7 @@ type HeapObject* = object ## A tagged box for a heap-allocated ## peon object - marked*: bool + marked*: bool # Used in the GC phase case kind*: ObjectKind of String: str*: ptr UncheckedArray[char] diff --git a/src/config.nim b/src/config.nim index ec501ad..128e0a3 100644 --- a/src/config.nim +++ b/src/config.nim @@ -27,6 +27,7 @@ const debugStressGC* {.booldefine.} = false # Make the GC run a collection at const PeonBytecodeMarker* = "PEON_BYTECODE" # Magic value at the beginning of bytecode files const HeapGrowFactor* = 2 # The growth factor used by the GC to schedule the next collection const FirstGC* = 1024 * 1024; # How many bytes to allocate before running the first GC +const disableVMChecks* {.booldefine.} = true; # Disables all types of compiler (nim-wise) checks in the VM when HeapGrowFactor <= 1: {.fatal: "Heap growth factor must be > 1".} const PeonVersion* = (major: 0, minor: 1, patch: 0) @@ -35,8 +36,8 @@ const PeonCommitHash* = "058b021493577a45ff6418d8073008be401b5910" when len(PeonCommitHash) != 40: {.fatal: "The git commit hash must be exactly 40 characters long".} const PeonBranch* = "master" -when len(PeonBranch) > 255: - {.fatal: "The git branch name's length must be less than or equal to 255 characters".} +when len(PeonBranch) > 255 or len(PeonBranch) == 0: + {.fatal: "The git branch name's length must be within 1 and 255 characters".} const PeonVersionString* = &"Peon {PeonVersion.major}.{PeonVersion.minor}.{PeonVersion.patch} {PeonRelease} ({PeonBranch}, {CompileDate}, {CompileTime}, {PeonCommitHash[0..8]}) [Nim {NimVersion}] on {hostOS} ({hostCPU})" const HelpMessage* = """The peon programming language, Copyright (C) 2022 Mattia Giambirtone & All Contributors