IRBytecodeGenerator.st
changeset 3 c9845c180bd4
parent 2 6e1de7f85d59
child 4 7195866510e1
--- a/IRBytecodeGenerator.st	Wed Sep 17 10:30:02 2008 +0000
+++ b/IRBytecodeGenerator.st	Mon Nov 03 17:02:40 2008 +0000
@@ -170,10 +170,10 @@
         stack push.
 
         self 
-            nextPut: #pushLit;
+            nextPut: #pushLitS;
             nextPut: (self addLiteral: object).
 
-    "Modified: / 11-06-2008 / 14:04:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 03-11-2008 / 14:32:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 pushLiteralVariable: object
@@ -403,11 +403,11 @@
 
 addLiteral: object
 
-    (literals includes: object)
+    (literals includesIdentical: object)
         ifFalse:[literals add: object].
     ^ literals identityIndexOf: object
 
-    "Modified: / 11-06-2008 / 13:49:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 03-11-2008 / 13:49:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 from: fromSeqId goto: toSeqId
@@ -528,13 +528,19 @@
 
 !IRBytecodeGenerator methodsFor:'results'!
 
-bytecodes
+bytecodesAndLiteralArray
+
+    | byteCodeCompiler |
+    byteCodeCompiler := ByteCodeCompiler new.
 
-    ^ByteCodeCompiler new
-        genByteCodeFrom: self symboliccodes;
-        code.
+    byteCodeCompiler literalArray: literals.
+    byteCodeCompiler genByteCodeFrom: self symboliccodes.
 
-    "Modified: / 11-06-2008 / 14:01:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    ^Array 
+        with: byteCodeCompiler code
+        with: byteCodeCompiler literalArray.
+
+    "Created: / 03-11-2008 / 14:20:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 compiledMethod
@@ -546,23 +552,37 @@
 
 compiledMethodUsing: aCompiledMethodClass
 
+    "
+        self symboliccodes
+    " 
+
+    | bytecodesAndLiteralArray |
+    bytecodesAndLiteralArray := self bytecodesAndLiteralArray.
+
     ^(aCompiledMethodClass new: literals size)
         numberOfArgs: numArgs;
         numberOfVars: maxTemp - numArgs ;
-        byteCode: self bytecodes;
-        literals: literals asArray;
+        byteCode: bytecodesAndLiteralArray first;
+        literals: bytecodesAndLiteralArray second asArray;
         yourself
 
     "Created: / 11-06-2008 / 14:02:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 03-11-2008 / 14:22:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 literals
 
-	literals := literals asArray copyWith: MethodProperties new.
+    ^literals asArray
+
+
+    " old "
+    "    literals := literals asArray copyWith: MethodProperties new.
 
-	^ lastLiteral 
-		ifNil: [literals copyWith: nil ] 
-		ifNotNil: [literals copyWith: lastLiteral]
+        ^ lastLiteral 
+                ifNil: [literals copyWith: nil ] 
+                ifNotNil: [literals copyWith: lastLiteral]"
+
+    "Modified: / 03-11-2008 / 13:41:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 numArgs