Minor fixes. All tests passes
--- a/IRBytecodeGenerator.st Wed Jun 11 14:54:42 2008 +0000
+++ b/IRBytecodeGenerator.st Wed Sep 17 10:30:02 2008 +0000
@@ -21,6 +21,15 @@
"Created: / 11-06-2008 / 13:53:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
+!IRBytecodeGenerator methodsFor:'accessing'!
+
+properties: aDictionary
+
+ properties := aDictionary.
+
+ "Created: / 17-09-2008 / 12:17:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
!IRBytecodeGenerator methodsFor:'accessing default'!
defaultStackCounter
@@ -62,9 +71,14 @@
primitiveNode: aPrimitiveNode
- literals isEmpty ifFalse: [self error: 'init prim before adding instructions'].
- aPrimitiveNode spec ifNotNil: [literals add: aPrimitiveNode spec].
- primNum _ aPrimitiveNode num.
+ "There are no primitives in St/X"
+ "
+ literals isEmpty ifFalse: [self error: 'init prim before adding instructions'].
+ aPrimitiveNode spec ifNotNil: [literals add: aPrimitiveNode spec].
+ primNum _ aPrimitiveNode num.
+ "
+
+ "Modified: / 17-09-2008 / 12:16:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!IRBytecodeGenerator methodsFor:'instructions'!
--- a/IRTranslator.st Wed Jun 11 14:54:42 2008 +0000
+++ b/IRTranslator.st Wed Sep 17 10:30:02 2008 +0000
@@ -19,20 +19,20 @@
"Created: / 11-06-2008 / 09:24:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
-!IRTranslator methodsFor:'initialization'!
+!IRTranslator methodsFor:'initialize'!
initialize
- "Invoked when a new instance is created."
+
+ gen := IRBytecodeGenerator new
+
+ "Modified: / 17-09-2008 / 12:19:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
- "/ please change as required (and remove this comment)
- pending := OrderedCollection new.
- gen := IRBytecodeGenerator new.
- "/ currentInstr := nil.
- "/ trailerBytes := nil.
+trailer: bytes
- "/ super initialize. -- commented since inherited method does nothing
+ trailerBytes := bytes
- "Created: / 11-06-2008 / 13:46:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 17-09-2008 / 12:20:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!IRTranslator methodsFor:'instructions'!
@@ -89,11 +89,13 @@
pushBlock: irMethod
- | meth block |
- meth _ irMethod compiledMethodWith: trailerBytes.
- meth isBlockMethod: true.
- block _ meth createBlock: nil.
- self addPending: (Message selector: #pushLiteral: argument: block)
+ | meth block |
+ meth := irMethod compiledMethodWith: trailerBytes.
+ meth isBlockMethod: true.
+ block := meth createBlock: nil.
+ self addPending: (Message selector: #pushLiteral: argument: block)
+
+ "Modified: / 17-09-2008 / 12:19:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
pushBlockMethod: irMethod
@@ -235,12 +237,12 @@
interpret: ir
- ir optimize.
- gen numArgs: ir numArgs.
- ir additionalLiterals do: [:lit | gen addLiteral: lit].
- super interpret: ir.
-
- "Modified: / 11-06-2008 / 13:52:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ ir optimize.
+ gen primitiveNode: ir primitiveNode.
+ gen numArgs: ir numArgs.
+ gen properties: ir properties.
+ ir additionalLiterals do: [:lit | gen addLiteral: lit].
+ super interpret: ir.
!
interpretAll: irSequences
@@ -305,20 +307,6 @@
^ pending removeLast value "message"
! !
-!IRTranslator methodsFor:'private - literals'!
-
-indexOfLiteral: object
-
- | idx |
- idx := literalFrame identityIndexOf: object.
- idx = 0 ifTrue:
- [literalFrame add: object.
- idx := literalFrame identityIndexOf: object].
- ^idx
-
- "Created: / 11-06-2008 / 10:56:24 / Jan Vrany <vranyj1@fel.cvut.cz>"
-! !
-
!IRTranslator methodsFor:'results'!
compiledMethod
@@ -330,7 +318,17 @@
^ gen compiledMethodUsing: aCompiledMethodClass
- "Modified: / 11-06-2008 / 14:08:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 17-09-2008 / 12:18:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+compiledMethodWith: trailer
+
+ ^ gen compiledMethodWith: trailer
+!
+
+compiledMethodWith: trailer using: aCompiledMethodClass
+
+ ^ gen compiledMethodWith: trailer using: aCompiledMethodClass
! !
!IRTranslator class methodsFor:'documentation'!
--- a/stx_goodies_newcompiler.st Wed Jun 11 14:54:42 2008 +0000
+++ b/stx_goodies_newcompiler.st Wed Sep 17 10:30:02 2008 +0000
@@ -21,7 +21,7 @@
#'stx:libwidg' "ScrollableView - referenced by IRMethod>>inspector2TabIRCode "
)
- "Modified: / 11-06-2008 / 16:54:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 17-09-2008 / 12:22:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!stx_goodies_newcompiler class methodsFor:'description - contents'!
@@ -63,7 +63,7 @@
IRTempStore
)
- "Modified: / 11-06-2008 / 16:54:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 17-09-2008 / 12:22:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
extensionMethodNames
@@ -72,7 +72,7 @@
Class bindingOf:
)
- "Modified: / 11-06-2008 / 16:54:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 17-09-2008 / 12:22:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!stx_goodies_newcompiler class methodsFor:'description - project information'!