summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-08-03 21:14:57 +0200
committerAraq <rumpf_a@web.de>2013-08-03 21:14:57 +0200
commit30bb68d48a90e45b83716ab81c9ecccdb425c781 (patch)
treeb9af06a619fdaa5b6d3e9f9cdfac9bbf04d661fa /compiler
parentec86d5db0f6a150db4db804876f2241451a07ffe (diff)
downloadNim-30bb68d48a90e45b83716ab81c9ecccdb425c781.tar.gz
new VM: next steps
Diffstat (limited to 'compiler')
-rw-r--r--compiler/pretty.nim3
-rw-r--r--compiler/vm.nim4
-rw-r--r--compiler/vmdef.nim1
-rw-r--r--compiler/vmgen.nim11
4 files changed, 14 insertions, 5 deletions
diff --git a/compiler/pretty.nim b/compiler/pretty.nim
index d86675412..4545e1c55 100644
--- a/compiler/pretty.nim
+++ b/compiler/pretty.nim
@@ -144,7 +144,8 @@ proc processSym(c: PPassContext, n: PNode): PNode =
         cannotRename.incl(s.id)
         return
     let last = first+identLen(line, first)-1
-    if last-first+1 != newName.len or differ(line, first, last, newName):
+    if differ(line, first, last, newName):
+      # last-first+1 != newName.len or 
       var x = line.subStr(0, first-1) & newName & line.substr(last+1)
       when removeTP:
         # the WinAPI module is full of 'TX = X' which after the substitution
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 7b24c3d6c..7929774ee 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -663,6 +663,10 @@ proc execute(c: PCtx, start: int) =
     of opcCallSite:
       if c.callsite != nil: regs[ra] = c.callsite
       else: stackTrace(c, tos, pc, errFieldXNotFound, "callsite")
+    of opcNLineInfo:
+      let rb = instr.regB
+      let n = regs[rb]
+      regs[ra] = newStrNodeT(n.info.toFileLineCol, n)
     else:
       InternalError(c.debug[pc], "unknown opcode " & $instr.opcode)
     inc pc
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim
index 449d632b1..1a19efe5a 100644
--- a/compiler/vmdef.nim
+++ b/compiler/vmdef.nim
@@ -85,6 +85,7 @@ type
     opcNError,
     opcNWarning,
     opcNHint,
+    opcNLineInfo,
     
     opcEcho,
     opcIndCall, # dest = call regStart, n; where regStart = fn, arg1, ...
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 427f8fafe..c5bfa3095 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -540,7 +540,8 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
   of mLtF64: genBinaryABC(c, n, dest, opcLtFloat)
   of mLePtr, mLeU, mLeU64: genBinaryABC(c, n, dest, opcLeu)
   of mLtPtr, mLtU, mLtU64: genBinaryABC(c, n, dest, opcLtu)
-  of mEqProc, mEqRef, mEqUntracedRef: genBinaryABC(c, n, dest, opcEqRef)
+  of mEqProc, mEqRef, mEqUntracedRef, mEqCString:
+    genBinaryABC(c, n, dest, opcEqRef)
   of mXor: genBinaryABC(c, n, dest, opcXor)
   of mNot: genUnaryABC(c, n, dest, opcNot)
   of mUnaryMinusI, mUnaryMinusI64: genUnaryABC(c, n, dest, opcUnaryMinusInt)
@@ -645,7 +646,8 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
     genUnaryABC(c, n, dest, opcParseExprToAst)
   of mParseStmtToAst:
     genUnaryABC(c, n, dest, opcParseStmtToAst)
-  of mExpandToAst: InternalError(n.info, "cannot generate code for: " & $m)
+  of mExpandToAst:
+    InternalError(n.info, "cannot generate code for: " & $m)
   of mTypeTrait: InternalError(n.info, "cannot generate code for: " & $m)
   of mIs: InternalError(n.info, "cannot generate code for: " & $m)
   of mSlurp: genUnaryABC(c, n, dest, opcSlurp)
@@ -700,9 +702,10 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
   of mNCallSite:
     if dest < 0: dest = c.getTemp(n.typ)
     c.gABC(n, opcCallSite, dest)
+  of mMinI, mMaxI, mMinI64, mMaxI64, mAbsF64, mMinF64, mMaxF64, mAbsI, mAbsI64:
+    c.genCall(n, dest)
   else:
-    # XXX get rid of these: mMinI, mMaxI, mMinI64, mMaxI64, mMinF64, mMaxF64
-    # mGCref, mGCunref, mEqCString, mAbsI, mAbsI64, mAbsF64
+    # mGCref, mGCunref, 
     InternalError(n.info, "cannot generate code for: " & $m)
 
 const