diff --git a/compiler/options.nim b/compiler/options.nim index bd6bc1a092..ea6b913218 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -219,8 +219,10 @@ proc getPackageName*(path: string): string = else: let x = path.substr(i+1, b-1) case x.normalize - of "lib", "src", "source", "package", "pckg", "library": b = i - else: return x + of "lib", "src", "source", "package", "pckg", "library", "private": + b = i + else: + return x.replace('.', '_') result = "" proc withPackageName*(path: string): string = diff --git a/compiler/vm.nim b/compiler/vm.nim index d5a816e532..42303b3210 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -231,11 +231,11 @@ proc compile(c: PCtx, s: PSym): int = result = vmgen.genProc(c, s) #c.echoCode -proc execute(c: PCtx, start: int) = +proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = var pc = start + var tos = tos var regs: TNodeSeq # alias to tos.slots for performance - var tos: PStackFrame - newSeq(regs, c.prc.maxSlots) + move(regs, tos.slots) while true: {.computedGoto.} let instr = c.code[pc] @@ -841,6 +841,13 @@ proc execute(c: PCtx, start: int) = regs[ra].strVal = typ.typeToString(preferExported) inc pc +proc execute(c: PCtx, start: int) = + var pc = start + var regs: TNodeSeq # alias to tos.slots for performance + var tos: PStackFrame + newSeq(tos.slots, c.prc.maxSlots) + rawExecute(c, start, tos) + proc evalStmt*(c: PCtx, n: PNode) = let start = genStmt(c, n) # execute new instructions; this redundant opcEof check saves us lots @@ -892,6 +899,9 @@ proc setupMacroParam(x: PNode): PNode = result = x if result.kind in {nkHiddenSubConv, nkHiddenStdConv}: result = result.sons[1] +type + PEvalContext* = PCtx + proc evalMacroCall(c: PEvalContext, n, nOrig: PNode, sym: PSym): PNode = # XXX GlobalError() is ugly here, but I don't know a better solution for now inc(evalTemplateCounter)