diff --git a/src/Tinyrossa-Tests/TRCompilationTestCase.class.st b/src/Tinyrossa-Tests/TRCompilationTestCase.class.st index a26ada0..a9ab6ff 100644 --- a/src/Tinyrossa-Tests/TRCompilationTestCase.class.st +++ b/src/Tinyrossa-Tests/TRCompilationTestCase.class.st @@ -253,6 +253,53 @@ TRCompilationTestCase >> test03_lconst [ " ] +{ #category : #tests } +TRCompilationTestCase >> test04_call_resolved [ + | comp1 bldr1 comp2 bldr2 | + + self target name = 'powerpc64le-linux' ifTrue: [ + self skip: 'Skipped since calls are not implemented for POWER (see issue #45)'. + ]. + + " ### CALLEE ### " + comp1 := TRCompilation forConfig: compilation config. + bldr1 := comp1 builder. + bldr1 defineName: 'callee' type: Int32. + bldr1 defineParameter: 'x' type: Int32. + bldr1 ireturn: + { bldr1 iadd: + { bldr1 iload: 'x'. + bldr1 iconst: 1 } }. + comp1 optimize. + comp1 compile. + + " ### CALLER ### " + comp2 := TRCompilation forConfig: compilation config. + bldr2 := comp2 builder. + bldr2 defineName: 'caller' type: Int32. + bldr2 defineParameter: 'x' type: Int32. + bldr2 defineFunction: 'callee' type: Int32. + bldr2 ireturn: + { bldr2 iadd: + { bldr2 iload: 'x'. + bldr2 icall: { bldr2 iload: 'x' . 'callee' } } }. + comp2 optimize. + comp2 compile. + + " ### ######### ### " + + shell inject: comp1. + shell inject: comp2. + + self assert: (shell invoke: comp2 functionSymbol with: { 10 } types: { Int32 }) + equals: 21 + + " + TRRV64GCompilationTests debug: #test03_lconst_n + TRPPC64CompilationTests debug: #test03_lconst_n + " +] + { #category : #'tests - examples' } TRCompilationTestCase >> test_example01_meaningOfLife [ TRCompilationExamples new