IRBytecodeGenerator.st
changeset 6 49a61123c743
parent 5 b94aea1d3710
child 7 0de2eaa86456
--- a/IRBytecodeGenerator.st	Mon Dec 01 19:01:08 2008 +0000
+++ b/IRBytecodeGenerator.st	Tue Dec 02 08:14:54 2008 +0000
@@ -3,7 +3,7 @@
 Object subclass:#IRBytecodeGenerator
 	instanceVariableNames:'seqOrder orderSeq jumps literals lastLiteral currentSeqId
 		currentSeqNum lastSpecialReturn instrMaps instrMap maxTemp stacks
-		stack primNum numArgs properties code seqCode'
+		stack primNum numArgs properties code seqCode lastLine'
 	classVariableNames:'BytecodeTable Bytecodes SpecialConstants SpecialSelectors'
 	poolDictionaries:''
 	category:'NewCompiler-Bytecode'
@@ -55,11 +55,12 @@
         numArgs := 0.
         currentSeqNum := 0.
         orderSeq := OrderedDictionary new.  "reverse map of seqOrder"
+        lastLine := 0.
 
         "starting label in case one is not provided by client"
         self label: self newDummySeqId.
 
-    "Modified: / 05-11-2008 / 10:33:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 02-12-2008 / 09:08:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 numArgs: n
@@ -136,6 +137,23 @@
     "Modified: / 11-06-2008 / 13:58:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
+line: line
+
+    lastLine := line.
+
+    (line < 256) 
+        ifTrue:
+            [self 
+                nextPut: #lineno;
+                nextPut: line]
+        ifFalse:
+            [self 
+                nextPut: #lineno16;
+                nextPut: line]
+
+    "Created: / 02-12-2008 / 09:02:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
 popTop
 
         stack pop.
@@ -289,11 +307,12 @@
 
         self 
             nextPut: #send;
-            nextPut: 0; "lineno"
+            nextPut: lastLine;
             nextPut: (self addLiteral: selector);
             nextPut: sendNumArgs.
 
     "Created: / 01-12-2008 / 19:47:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 02-12-2008 / 09:10:31 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 send: selector numArgs: sendNumArgs toSuperOf: behavior
@@ -303,12 +322,13 @@
 
         self 
             nextPut: #superSend;
-            nextPut: 0; "lineno"
+            nextPut: lastLine;
             nextPut: (self addLiteral: selector);
             nextPut: sendNumArgs;
             nextPut: (self addLiteral: behavior superclass)
 
     "Created: / 01-12-2008 / 19:48:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 02-12-2008 / 09:10:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 storeInstVar: index