Fix some stuff?
This commit is contained in:
parent
c230142378
commit
9c878e5b9e
|
@ -31,7 +31,7 @@ when debugVM or debugMem or debugGC:
|
||||||
import std/terminal
|
import std/terminal
|
||||||
|
|
||||||
|
|
||||||
{.push checks:on.} # The VM is a critical point where checks are deleterious
|
{.push checks:off.} # The VM is a critical point where checks are deleterious
|
||||||
|
|
||||||
type
|
type
|
||||||
PeonVM* = ref object
|
PeonVM* = ref object
|
||||||
|
@ -1028,7 +1028,6 @@ proc run*(self: PeonVM, chunk: Chunk) =
|
||||||
self.operands = @[]
|
self.operands = @[]
|
||||||
self.results = @[]
|
self.results = @[]
|
||||||
self.ip = 0
|
self.ip = 0
|
||||||
#[
|
|
||||||
# Sorry, but there only is enough space
|
# Sorry, but there only is enough space
|
||||||
# for one GC in this VM :(
|
# for one GC in this VM :(
|
||||||
when defined(gcOrc):
|
when defined(gcOrc):
|
||||||
|
@ -1036,7 +1035,6 @@ proc run*(self: PeonVM, chunk: Chunk) =
|
||||||
when not defined(gcArc):
|
when not defined(gcArc):
|
||||||
GC_disable()
|
GC_disable()
|
||||||
GC_disableMarkAndSweep()
|
GC_disableMarkAndSweep()
|
||||||
]#
|
|
||||||
try:
|
try:
|
||||||
self.dispatch()
|
self.dispatch()
|
||||||
except NilAccessDefect:
|
except NilAccessDefect:
|
||||||
|
@ -1044,7 +1042,6 @@ proc run*(self: PeonVM, chunk: Chunk) =
|
||||||
quit(1)
|
quit(1)
|
||||||
# We clean up after ourselves!
|
# We clean up after ourselves!
|
||||||
self.gc.collect()
|
self.gc.collect()
|
||||||
#[
|
|
||||||
# This is unnecessary if we use ARC,
|
# This is unnecessary if we use ARC,
|
||||||
# but *just in case*
|
# but *just in case*
|
||||||
when defined(gcOrc):
|
when defined(gcOrc):
|
||||||
|
@ -1052,6 +1049,6 @@ proc run*(self: PeonVM, chunk: Chunk) =
|
||||||
when not defined(gcArc):
|
when not defined(gcArc):
|
||||||
GC_enable()
|
GC_enable()
|
||||||
GC_enableMarkAndSweep()
|
GC_enableMarkAndSweep()
|
||||||
]#
|
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ proc assignment(self: Compiler, node: ASTNode) =
|
||||||
elif r.isLet:
|
elif r.isLet:
|
||||||
self.error(&"cannot reassign '{name.token.lexeme}'", name)
|
self.error(&"cannot reassign '{name.token.lexeme}'", name)
|
||||||
self.expression(node.value)
|
self.expression(node.value)
|
||||||
if self.scopeDepth > 0 and r.depth != self.scopeDepth:
|
if not r.isClosedOver:
|
||||||
self.emitByte(StoreVar, node.token.line)
|
self.emitByte(StoreVar, node.token.line)
|
||||||
self.emitBytes(self.getStackPos(r).toTriple(), node.token.line)
|
self.emitBytes(self.getStackPos(r).toTriple(), node.token.line)
|
||||||
else:
|
else:
|
||||||
|
@ -1852,7 +1852,7 @@ proc funDecl(self: Compiler, node: FunDecl, fn: Name = nil, args: seq[Expression
|
||||||
if not self.currentFunction.isNil():
|
if not self.currentFunction.isNil():
|
||||||
self.currentFunction.valueType.children.add(fn.valueType)
|
self.currentFunction.valueType.children.add(fn.valueType)
|
||||||
self.currentFunction = fn
|
self.currentFunction = fn
|
||||||
var names = self.names[^(node.arguments.len())..^1]
|
var names {.used.} = self.names[^(node.arguments.len())..^1]
|
||||||
if fn.valueType.isBuiltinFunction:
|
if fn.valueType.isBuiltinFunction:
|
||||||
fn.codePos = self.chunk.code.len()
|
fn.codePos = self.chunk.code.len()
|
||||||
# We take the arguments off of our name list
|
# We take the arguments off of our name list
|
||||||
|
|
Loading…
Reference in New Issue