diff -r 0bb85506f02a -r 1bfd09c6b3d8 IRBuilderTest.st --- a/IRBuilderTest.st Sat Oct 15 18:24:20 2011 +0000 +++ b/IRBuilderTest.st Tue Nov 15 21:28:05 2011 +0000 @@ -189,7 +189,8 @@ error "Redefinition for testing the #send:toSuperOf:" - "Created: / 15-02-2010 / 16:20:57 / Jan Vrany " + "Created: / 11-06-2008 / 16:08:52 / Jan Vrany " + "Created: / 15-11-2011 / 22:27:59 / Jan Vrany " ! isThisEverCalled @@ -208,7 +209,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true). ! @@ -225,7 +226,7 @@ returnTop; ir. aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:(3 @ 4) arguments:#()) = 7). @@ -245,7 +246,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil). ! @@ -263,7 +264,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil). ! @@ -283,7 +284,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil). ! @@ -298,7 +299,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true). @@ -318,7 +319,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = false). @@ -335,7 +336,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = #( #test 4 #you )). ! @@ -350,7 +351,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true). ! @@ -365,7 +366,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = $e). ! @@ -379,7 +380,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2.0). "Modified: / 03-11-2008 / 08:39:52 / Jan Vrany " @@ -395,7 +396,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2). ! @@ -409,7 +410,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:4 arguments:#()) = nil). ! @@ -423,7 +424,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 'hello'). ! @@ -438,7 +439,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = #you). ! @@ -453,7 +454,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Object). ! @@ -464,15 +465,16 @@ iRMethod := (IRBuilder new) numRargs:1; addTemps:#( #self ); - pushLiteralVariable:(ArithmeticValue bindingOf:#ArithmeticSignal); + pushLiteralVariable:#ArithmeticError; returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = ArithmeticValue arithmeticSignal). "Modified: / 11-06-2008 / 11:31:32 / Jan Vrany " + "Modified: / 15-11-2011 / 22:25:06 / Jan Vrany " ! testLiteralVariableGlobale @@ -485,7 +487,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Smalltalk). @@ -504,7 +506,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true). @@ -522,7 +524,7 @@ ir. aCompiledMethod := iRMethod compiledCode. receiver := (5 @ 8). - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) == receiver). ! @@ -539,7 +541,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#( 2 8 )) = 10). ! @@ -555,7 +557,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) == UndefinedObject). ! @@ -570,7 +572,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = nil). ! @@ -585,7 +587,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = 5). ! @@ -607,7 +609,7 @@ ir. aCompiledMethod := iRMethod compiledCode. receiver := Object new. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) isKindOf:ClosureEnvironment) ! @@ -627,7 +629,7 @@ aCompiledMethod := iRMethod compiledCode. self class basicAddSelector:#mock1 withMethod:(self class >> #mock1:with:). - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:(aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) = 3. @@ -650,9 +652,11 @@ aCompiledMethod := iRMethod compiledCode. self class basicAddSelector:#mock1 withMethod:(self class >> #mock1:with:). - self assert:(aCompiledMethod isKindOf:Method). - self should: - [ (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) ] + self assert:(aCompiledMethod isKindOf:CompiledMethod). + self + should:[ + (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) + ] raise:Error. self class basicRemoveSelector:#mock1. @@ -670,13 +674,15 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). - self should: - [ (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) ] + self assert:(aCompiledMethod isKindOf:CompiledMethod). + self + should:[ + (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) + ] raise:Error. "Modified: / 11-06-2008 / 16:09:12 / Jan Vrany " - "Modified: / 15-02-2010 / 16:20:44 / Jan Vrany " + "Modified: / 15-11-2011 / 22:25:36 / Jan Vrany " ! testStorIntoVariable @@ -686,14 +692,16 @@ numRargs:1; addTemps:#( #self ); pushLiteral:4; - storeIntoLiteralVariable:(IRBuilderTest bindingOf:#TestToPush); + storeIntoLiteralVariable:(#'IRBuilderTest:TestToPush'); returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). aCompiledMethod valueWithReceiver:nil arguments:#(). self assert:(IRBuilderTest testToPush = 4). IRBuilderTest testToPush:nil. + + "Modified: / 15-11-2011 / 22:27:39 / Jan Vrany " ! testStoreTemp @@ -708,7 +716,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 34). "Modified: / 11-06-2008 / 16:24:43 / Jan Vrany " @@ -731,7 +739,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) isKindOf:ClosureEnvironment). @@ -754,7 +762,7 @@ returnTop; ir. aCompiledMethod := iRMethod compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil). "Created: / 03-11-2008 / 13:34:50 / Jan Vrany " @@ -768,78 +776,34 @@ irBuilder := (IRBuilder new) numRargs:1; addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | + pushBlockUsingBuilder:[:builder | builder numRargs:1; addTemps:#( #barg1 ); - pushBlockUsingBuilder: - [:builder | - builder - numRargs:1; - addTemps:#( #barg2 ); - pushTemp:#barg2; - returnTop ]; - pushTemp:#barg1; - send:#value:; - returnTop ]; - pushLiteral:22; - send:#value:; + pushBlockUsingBuilder:[:builder| + builder + numRargs: 1; + addTemps: #( #barg2 ); + pushTemp: #barg2; + returnTop + ]; + pushTemp: #barg1; + send: #value:; + returnTop + ]; + pushLiteral: 22; + send:#value; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22). "Created: / 11-05-2009 / 23:04:13 / Jan Vrany " - "Modified: / 23-03-2010 / 21:47:41 / Jan Vrany " -! - -testBlock_blockNesting_2 - |aCompiledMethod irBuilder| - - irBuilder := (IRBuilder new) - numRargs:1; - addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | - builder - numRargs:1; - addTemps:#( #barg1 ); - pushBlockUsingBuilder: - [:builder | - builder - numRargs:1; - addTemps:#( #barg2 ); - pushTemp:#barg2; - returnTop ]; - pushTemp:#barg1; - send:#value:; - pushBlockUsingBuilder: - [:builder | - builder - numRargs:1; - addTemps:#( #barg2 ); - pushLiteral:-1; - returnTop ]; - pushTemp:#barg1; - send:#value:; - returnTop ]; - pushLiteral:22; - send:#value:; - returnTop; - ir. - " - irBuilder ir - " - aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). - self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = -1). - - "Created: / 23-03-2010 / 21:43:49 / Jan Vrany " ! testBlock_blockTempArg @@ -848,22 +812,23 @@ irBuilder := (IRBuilder new) numRargs:1; addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | + pushBlockUsingBuilder:[:builder | builder numRargs:1; addTemps:#( #barg1 ); pushTemp:#barg1; - returnTop ]; + returnTop + ]; pushLiteral:22; send:#value:; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22). "Created: / 30-03-2009 / 14:26:18 / Jan Vrany " @@ -876,23 +841,24 @@ irBuilder := (IRBuilder new) numRargs:1; addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | + pushBlockUsingBuilder:[:builder | builder numRargs:0; addTemps:#( #bvar1 ); - pushLiteral:22; + pushLiteral: 22; storeTemp:#bvar1; - pushTemp:#bvar1; - returnTop ]; + pushTemp: #bvar1; + returnTop + ]; send:#value; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22). "Created: / 30-03-2009 / 23:03:48 / Jan Vrany " @@ -904,24 +870,25 @@ irBuilder := (IRBuilder new) numRargs:1; addTemps:#( #self ); - pushLiteral:false; - pushLiteral:true; - jumpAheadTo:#end if:false; - pushBlockUsingBuilder: - [:builder | + pushLiteral: false; + pushLiteral: true; + jumpAheadTo: #end if: false; + pushBlockUsingBuilder:[:builder | builder - numRargs:0; - pushLiteral:true; - returnTop ]; - send:#value; - jumpAheadTarget:#end; + numRargs: 0; + pushLiteral: true; + returnTop + ]; + send: #value; + jumpAheadTarget: #end; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true). "Created: / 13-05-2009 / 11:24:48 / Jan Vrany " @@ -932,32 +899,32 @@ irBuilder := (IRBuilder new) numRargs:1; - addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | + addTemps:#( #self); + pushBlockUsingBuilder:[:builder | builder - numRargs:0; - pushLiteral:1; - pushLiteral:0; - send:#'/'; - pushLiteral:false; - remoteReturn ]; - pushLiteralVariable:#Error; - pushBlockUsingBuilder: - [:builder | - builder - numRargs:0; - pushLiteral:true; - remoteReturn ]; - send:#on:do:; - pushLiteral:false; + numRargs:0; + pushLiteral: 1; + pushLiteral: 0; + send: #/; + pushLiteral: false; + remoteReturn + ]; + pushLiteralVariable: #Error; + pushBlockUsingBuilder:[:builder| + builder + numRargs:0; + pushLiteral: true; + remoteReturn]; + send: #on:do:; + pushLiteral: false; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true). "Created: / 11-05-2009 / 21:53:19 / Jan Vrany " @@ -968,31 +935,31 @@ irBuilder := (IRBuilder new) numRargs:1; - addTemps:#( #self ); - pushBlockUsingBuilder: - [:builder | + addTemps:#( #self); + pushBlockUsingBuilder:[:builder | builder - numRargs:0; - pushLiteral:1; - pushLiteral:0; - send:#'/'; - pushLiteral:false; - returnTop ]; - pushLiteralVariable:#Error; - pushBlockUsingBuilder: - [:builder | - builder - numRargs:0; - pushLiteral:true; - returnTop ]; - send:#on:do:; + numRargs:0; + pushLiteral: 1; + pushLiteral: 0; + send: #/; + pushLiteral: false; + returnTop + ]; + pushLiteralVariable: #Error; + pushBlockUsingBuilder:[:builder| + builder + numRargs:0; + pushLiteral: true; + returnTop]; + send: #on:do:; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true). "Created: / 11-05-2009 / 21:53:25 / Jan Vrany " @@ -1002,27 +969,28 @@ |aCompiledMethod irBuilder| irBuilder := (IRBuilder new) - numRargs:1; - addTemps:#( #self #i ); - pushTemp:#i; - pushLiteral:3; - pushReceiver; - pushBlockUsingBuilder: - [:builder | + numRargs: 1; + addTemps: #(self i); + pushTemp: #i; + pushLiteral: 3; + pushReceiver; + + pushBlockUsingBuilder: [ :builder | builder - numRargs:0; - addTemps:#(); - pushTemp:#i; - returnTop. ]; - returnTop; - ir. - " - irBuilder ir + numRargs: 0; + addTemps: #(); + pushTemp: #i; + returnTop. + ]; + returnTop; + ir. " + irBuilder ir + " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). - self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) - isKindOf:Block). + self assert:(aCompiledMethod isKindOf:CompiledMethod). + self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) isKindOf: Block). "Created: / 11-05-2009 / 21:55:30 / Jan Vrany " ! @@ -1032,23 +1000,24 @@ irBuilder := (IRBuilder new) numRargs:1; - addTemps:#( #self #a ); - pushLiteral:22; - storeTemp:#a; - pushBlockUsingBuilder: - [:builder | + addTemps:#( #self #a); + pushLiteral: 22; + storeTemp: #a; + pushBlockUsingBuilder:[:builder | builder numRargs:0; - pushTemp:#a; - returnTop ]; + pushTemp: #a; + returnTop + ]; send:#value; returnTop; ir. - " - irBuilder ir + " + irBuilder ir " + aCompiledMethod := irBuilder compiledCode. - self assert:(aCompiledMethod isKindOf:Method). + self assert:(aCompiledMethod isKindOf:CompiledMethod). self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22). "Created: / 30-03-2009 / 23:05:00 / Jan Vrany " @@ -1058,11 +1027,11 @@ !IRBuilderTest class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilderTest.st,v 1.3 2009/10/08 12:03:51 fm Exp $' + ^ '$Id$' ! version_CVS - ^ '$Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilderTest.st,v 1.3 2009/10/08 12:03:51 fm Exp $' + ^ '§Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRBuilderTest.st,v 1.3 2009/10/08 12:03:51 fm Exp §' ! version_SVN