Minor additions/changes

This commit is contained in:
Mattia Giambirtone 2022-10-08 15:21:13 +02:00
parent 11c8c0a5ab
commit 66cd6be0be
2 changed files with 5 additions and 4 deletions

View File

@ -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]

View File

@ -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