--- a/compiler/TCodeGenerator.st Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TCodeGenerator.st Wed Sep 02 18:15:44 2015 +0100
@@ -121,7 +121,7 @@
| emitMethodNode emitMethod|
emitMethodNode := RBMethodNode new.
- emitMethodNode arguments: aTInlineAssemblyNode arguments , { RBVariableNode named: 'zelf' } , aTInlineAssemblyNode topNode arguments.
+ emitMethodNode arguments: (aTInlineAssemblyNode arguments collect:[ :e|e copy]) , { RBVariableNode named: 'zelf' } , (aTInlineAssemblyNode topNode arguments collect:[ :e|e copy]).
emitMethodNode body: aTInlineAssemblyNode body copy.
emitMethodNode variableNodesDo:[ :variableNode |
variableNode name = 'self' ifTrue:[
@@ -135,7 +135,7 @@
arguments: { asm } , ((1 to: function numArgs) collect: [ :i | function parameterAt: i ])
"Created: / 02-09-2015 / 06:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-09-2015 / 09:14:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-09-2015 / 10:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
acceptLiteralNode: aLiteralNode
@@ -145,10 +145,20 @@
"Modified: / 31-08-2015 / 12:20:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-acceptMessageNode: aMessageNode
- self notYetImplemented
+acceptMessageNode: aMessageNode
+ | receiver arguments methodName methodFunction |
+
+ receiver := self visitNode: aMessageNode receiver.
+ receiver := self visitNode: aMessageNode receiver.
+ arguments := aMessageNode arguments collect: [:argument | self visitNode: argument ].
+
+ methodName := self class llvmFunctionNameForClass: aMessageNode binding mclass clazz selector: aMessageNode selector.
+ methodFunction := context module getFunctionNamed: methodName.
+
+ ^ asm call: methodFunction _: { receiver } , arguments
"Created: / 31-08-2015 / 10:13:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-09-2015 / 07:13:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
acceptMethodNode: aMethodNode
@@ -157,13 +167,16 @@
binding := aMethodNode binding.
function := context module
addFunctionNamed: (self class llvmFunctionNameForClass: currentClass selector: currentMethod selector)
- type: (binding type asLLVMTypeInModule: context module).
+ type: (LLVMType
+ function: { binding receiverType asLLVMTypeInModule: context module } ,
+ (binding parameterTypes collect:[:t|t asLLVMTypeInModule: context module])
+ returning: (binding returnType asLLVMTypeInModule: context module)).
asm := function builder.
(function parameterAt: 1) name: 'self'.
super acceptMethodNode: aMethodNode
"Created: / 31-08-2015 / 09:42:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-09-2015 / 08:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-09-2015 / 21:31:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
acceptOptimizedNode: anOptimizedNode