pushLiteral: instruction optimized
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 16 May 2009 16:51:05 +0000
changeset 20 7d49846b36bd
parent 19 3bb7360f9dff
child 21 a5d30403049c
pushLiteral: instruction optimized
IRBytecodeGenerator.st
--- a/IRBytecodeGenerator.st	Wed May 13 09:30:49 2009 +0000
+++ b/IRBytecodeGenerator.st	Sat May 16 16:51:05 2009 +0000
@@ -271,26 +271,36 @@
     "Modified: / 11-06-2008 / 14:19:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
-pushLiteral: object
-
-        stack push.
+pushLiteral:object 
+    stack push.
 
-        self 
-            nextPut: #pushLitS;
-            nextPut: (self addLiteral: object).
+    object == nil   ifTrue:[^self nextPut: #pushNil].
+    object == 0     ifTrue:[^self nextPut: #push0].
+    object == 1     ifTrue:[^self nextPut: #push1].
+    object == 2     ifTrue:[^self nextPut: #push2].
+    object == -1    ifTrue:[^self nextPut: #pushMinus1].
+    object == true  ifTrue:[^self nextPut: #pushTrue].
+    object == false ifTrue:[^self nextPut: #pushFalse].
 
-    "Modified: / 03-11-2008 / 14:32:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    self
+        nextPut:#pushLitS;
+        nextPut:(self addLiteral:object).
+
+    "Modified: / 16-05-2009 / 18:16:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
-pushLiteralVariable: object
+pushLiteralVariable:object 
 
-        stack push.
+    self
+        assert:  object isSymbol
+        message: 'Literal variables are identified by symbols!!'.
 
-        self 
-            nextPut: #pushGlobalS;
-            nextPut: (self addLiteral: object)
+    stack push.
+    self
+        nextPut:#pushGlobalS;
+        nextPut:(self addLiteral:object)
 
-    "Modified: / 11-06-2008 / 14:13:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 16-05-2009 / 18:00:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 pushMethodArg: index