IRBuilderTest.st
changeset 33 9c1e160e9688
parent 30 1b7ff9c8c40b
child 36 1bfd09c6b3d8
equal deleted inserted replaced
32:326e2b5665e1 33:9c1e160e9688
   206                 pushDup;
   206                 pushDup;
   207                 send:#'=';
   207                 send:#'=';
   208                 returnTop;
   208                 returnTop;
   209                 ir.
   209                 ir.
   210     aCompiledMethod := iRMethod compiledCode.
   210     aCompiledMethod := iRMethod compiledCode.
   211     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   211     self assert:(aCompiledMethod isKindOf:Method).
   212     self 
   212     self 
   213         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   213         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   214 !
   214 !
   215 
   215 
   216 testInstVar
   216 testInstVar
   223                 pushInstVar:2;
   223                 pushInstVar:2;
   224                 send:#'+';
   224                 send:#'+';
   225                 returnTop;
   225                 returnTop;
   226                 ir.
   226                 ir.
   227     aCompiledMethod := irBuilder compiledCode.
   227     aCompiledMethod := irBuilder compiledCode.
   228     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   228     self assert:(aCompiledMethod isKindOf:Method).
   229     self 
   229     self 
   230         assert:((aCompiledMethod valueWithReceiver:(3 @ 4) arguments:#()) = 7).
   230         assert:((aCompiledMethod valueWithReceiver:(3 @ 4) arguments:#()) = 7).
   231 
   231 
   232     "Modified: / 11-06-2008 / 13:16:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
   232     "Modified: / 11-06-2008 / 13:16:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
   233 !
   233 !
   243                 pushLiteral:3;
   243                 pushLiteral:3;
   244                 jumpAheadTarget:#end;
   244                 jumpAheadTarget:#end;
   245                 returnTop;
   245                 returnTop;
   246                 ir.
   246                 ir.
   247     aCompiledMethod := iRMethod compiledCode.
   247     aCompiledMethod := iRMethod compiledCode.
   248     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   248     self assert:(aCompiledMethod isKindOf:Method).
   249     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   249     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   250 !
   250 !
   251 
   251 
   252 testJumpAheadToIf
   252 testJumpAheadToIf
   253     |iRMethod aCompiledMethod|
   253     |iRMethod aCompiledMethod|
   261                 pushLiteral:3;
   261                 pushLiteral:3;
   262                 jumpAheadTarget:#end;
   262                 jumpAheadTarget:#end;
   263                 returnTop;
   263                 returnTop;
   264                 ir.
   264                 ir.
   265     aCompiledMethod := iRMethod compiledCode.
   265     aCompiledMethod := iRMethod compiledCode.
   266     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   266     self assert:(aCompiledMethod isKindOf:Method).
   267     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   267     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   268 !
   268 !
   269 
   269 
   270 testJumpBackTo
   270 testJumpBackTo
   271     |iRMethod aCompiledMethod|
   271     |iRMethod aCompiledMethod|
   281                 jumpBackTo:#begin;
   281                 jumpBackTo:#begin;
   282                 jumpAheadTarget:#end;
   282                 jumpAheadTarget:#end;
   283                 returnTop;
   283                 returnTop;
   284                 ir.
   284                 ir.
   285     aCompiledMethod := iRMethod compiledCode.
   285     aCompiledMethod := iRMethod compiledCode.
   286     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   286     self assert:(aCompiledMethod isKindOf:Method).
   287     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   287     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   288 !
   288 !
   289 
   289 
   290 testLine1
   290 testLine1
   291     |iRMethod aCompiledMethod|
   291     |iRMethod aCompiledMethod|
   296                 line:5;
   296                 line:5;
   297                 pushLiteral:true;
   297                 pushLiteral:true;
   298                 returnTop;
   298                 returnTop;
   299                 ir.
   299                 ir.
   300     aCompiledMethod := iRMethod compiledCode.
   300     aCompiledMethod := iRMethod compiledCode.
   301     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   301     self assert:(aCompiledMethod isKindOf:Method).
   302     self 
   302     self 
   303         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   303         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   304 
   304 
   305     "Created: / 02-12-2008 / 09:11:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
   305     "Created: / 02-12-2008 / 09:11:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
   306 !
   306 !
   316                 pushLiteral:false;
   316                 pushLiteral:false;
   317                 send:#'&';
   317                 send:#'&';
   318                 returnTop;
   318                 returnTop;
   319                 ir.
   319                 ir.
   320     aCompiledMethod := iRMethod compiledCode.
   320     aCompiledMethod := iRMethod compiledCode.
   321     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   321     self assert:(aCompiledMethod isKindOf:Method).
   322     self 
   322     self 
   323         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = false).
   323         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = false).
   324 
   324 
   325     "Created: / 02-12-2008 / 09:11:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
   325     "Created: / 02-12-2008 / 09:11:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
   326 !
   326 !
   333                 addTemps:#( #self );
   333                 addTemps:#( #self );
   334                 pushLiteral:#( #test 4 #you );
   334                 pushLiteral:#( #test 4 #you );
   335                 returnTop;
   335                 returnTop;
   336                 ir.
   336                 ir.
   337     aCompiledMethod := iRMethod compiledCode.
   337     aCompiledMethod := iRMethod compiledCode.
   338     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   338     self assert:(aCompiledMethod isKindOf:Method).
   339     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   339     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   340                 = #( #test 4 #you )).
   340                 = #( #test 4 #you )).
   341 !
   341 !
   342 
   342 
   343 testLiteralBoolean
   343 testLiteralBoolean
   348                 addTemps:#( #self );
   348                 addTemps:#( #self );
   349                 pushLiteral:true;
   349                 pushLiteral:true;
   350                 returnTop;
   350                 returnTop;
   351                 ir.
   351                 ir.
   352     aCompiledMethod := iRMethod compiledCode.
   352     aCompiledMethod := iRMethod compiledCode.
   353     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   353     self assert:(aCompiledMethod isKindOf:Method).
   354     self 
   354     self 
   355         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   355         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   356 !
   356 !
   357 
   357 
   358 testLiteralCharacter
   358 testLiteralCharacter
   363                 addTemps:#( #self );
   363                 addTemps:#( #self );
   364                 pushLiteral:$e;
   364                 pushLiteral:$e;
   365                 returnTop;
   365                 returnTop;
   366                 ir.
   366                 ir.
   367     aCompiledMethod := iRMethod compiledCode.
   367     aCompiledMethod := iRMethod compiledCode.
   368     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   368     self assert:(aCompiledMethod isKindOf:Method).
   369     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = $e).
   369     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = $e).
   370 !
   370 !
   371 
   371 
   372 testLiteralFloat
   372 testLiteralFloat
   373     |iRMethod aCompiledMethod|
   373     |iRMethod aCompiledMethod|
   377                 addTemps:#( #self );
   377                 addTemps:#( #self );
   378                 pushLiteral:2.0;
   378                 pushLiteral:2.0;
   379                 returnTop;
   379                 returnTop;
   380                 ir.
   380                 ir.
   381     aCompiledMethod := iRMethod compiledCode.
   381     aCompiledMethod := iRMethod compiledCode.
   382     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   382     self assert:(aCompiledMethod isKindOf:Method).
   383     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2.0).
   383     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2.0).
   384 
   384 
   385     "Modified: / 03-11-2008 / 08:39:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
   385     "Modified: / 03-11-2008 / 08:39:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
   386 !
   386 !
   387 
   387 
   393                 addTemps:#( #self );
   393                 addTemps:#( #self );
   394                 pushLiteral:2;
   394                 pushLiteral:2;
   395                 returnTop;
   395                 returnTop;
   396                 ir.
   396                 ir.
   397     aCompiledMethod := iRMethod compiledCode.
   397     aCompiledMethod := iRMethod compiledCode.
   398     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   398     self assert:(aCompiledMethod isKindOf:Method).
   399     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2).
   399     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 2).
   400 !
   400 !
   401 
   401 
   402 testLiteralNil
   402 testLiteralNil
   403     |iRMethod aCompiledMethod|
   403     |iRMethod aCompiledMethod|
   407                 addTemps:#( #self );
   407                 addTemps:#( #self );
   408                 pushLiteral:nil;
   408                 pushLiteral:nil;
   409                 returnTop;
   409                 returnTop;
   410                 ir.
   410                 ir.
   411     aCompiledMethod := iRMethod compiledCode.
   411     aCompiledMethod := iRMethod compiledCode.
   412     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   412     self assert:(aCompiledMethod isKindOf:Method).
   413     self assert:((aCompiledMethod valueWithReceiver:4 arguments:#()) = nil).
   413     self assert:((aCompiledMethod valueWithReceiver:4 arguments:#()) = nil).
   414 !
   414 !
   415 
   415 
   416 testLiteralString
   416 testLiteralString
   417     |iRMethod aCompiledMethod|
   417     |iRMethod aCompiledMethod|
   421                 addTemps:#( #self );
   421                 addTemps:#( #self );
   422                 pushLiteral:'hello';
   422                 pushLiteral:'hello';
   423                 returnTop;
   423                 returnTop;
   424                 ir.
   424                 ir.
   425     aCompiledMethod := iRMethod compiledCode.
   425     aCompiledMethod := iRMethod compiledCode.
   426     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   426     self assert:(aCompiledMethod isKindOf:Method).
   427     self 
   427     self 
   428         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 'hello').
   428         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 'hello').
   429 !
   429 !
   430 
   430 
   431 testLiteralSymbole
   431 testLiteralSymbole
   436                 addTemps:#( #self );
   436                 addTemps:#( #self );
   437                 pushLiteral:#you;
   437                 pushLiteral:#you;
   438                 returnTop;
   438                 returnTop;
   439                 ir.
   439                 ir.
   440     aCompiledMethod := iRMethod compiledCode.
   440     aCompiledMethod := iRMethod compiledCode.
   441     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   441     self assert:(aCompiledMethod isKindOf:Method).
   442     self 
   442     self 
   443         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = #you).
   443         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = #you).
   444 !
   444 !
   445 
   445 
   446 testLiteralVariableClass
   446 testLiteralVariableClass
   451                 addTemps:#( #self );
   451                 addTemps:#( #self );
   452                 pushLiteralVariable:Object binding;
   452                 pushLiteralVariable:Object binding;
   453                 returnTop;
   453                 returnTop;
   454                 ir.
   454                 ir.
   455     aCompiledMethod := iRMethod compiledCode.
   455     aCompiledMethod := iRMethod compiledCode.
   456     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   456     self assert:(aCompiledMethod isKindOf:Method).
   457     self 
   457     self 
   458         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Object).
   458         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Object).
   459 !
   459 !
   460 
   460 
   461 testLiteralVariableClassVariable
   461 testLiteralVariableClassVariable
   466                 addTemps:#( #self );
   466                 addTemps:#( #self );
   467                 pushLiteralVariable:(ArithmeticValue bindingOf:#ArithmeticSignal);
   467                 pushLiteralVariable:(ArithmeticValue bindingOf:#ArithmeticSignal);
   468                 returnTop;
   468                 returnTop;
   469                 ir.
   469                 ir.
   470     aCompiledMethod := iRMethod compiledCode.
   470     aCompiledMethod := iRMethod compiledCode.
   471     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   471     self assert:(aCompiledMethod isKindOf:Method).
   472     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   472     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   473                 = ArithmeticValue arithmeticSignal).
   473                 = ArithmeticValue arithmeticSignal).
   474 
   474 
   475     "Modified: / 11-06-2008 / 11:31:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
   475     "Modified: / 11-06-2008 / 11:31:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
   476 !
   476 !
   483                 addTemps:#( #self );
   483                 addTemps:#( #self );
   484                 pushLiteralVariable:Smalltalk binding;
   484                 pushLiteralVariable:Smalltalk binding;
   485                 returnTop;
   485                 returnTop;
   486                 ir.
   486                 ir.
   487     aCompiledMethod := iRMethod compiledCode.
   487     aCompiledMethod := iRMethod compiledCode.
   488     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   488     self assert:(aCompiledMethod isKindOf:Method).
   489     self 
   489     self 
   490         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Smalltalk).
   490         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = Smalltalk).
   491 
   491 
   492     "Modified: / 11-06-2008 / 11:32:07 / Jan Vrany <vranyj1@fel.cvut.cz>"
   492     "Modified: / 11-06-2008 / 11:32:07 / Jan Vrany <vranyj1@fel.cvut.cz>"
   493 !
   493 !
   502                 pushLiteral:false;
   502                 pushLiteral:false;
   503                 popTop;
   503                 popTop;
   504                 returnTop;
   504                 returnTop;
   505                 ir.
   505                 ir.
   506     aCompiledMethod := iRMethod compiledCode.
   506     aCompiledMethod := iRMethod compiledCode.
   507     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   507     self assert:(aCompiledMethod isKindOf:Method).
   508     self 
   508     self 
   509         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   509         assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = true).
   510 
   510 
   511     "Modified: / 11-06-2008 / 13:22:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
   511     "Modified: / 11-06-2008 / 13:22:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
   512 !
   512 !
   520                 pushReceiver;
   520                 pushReceiver;
   521                 returnTop;
   521                 returnTop;
   522                 ir.
   522                 ir.
   523     aCompiledMethod := iRMethod compiledCode.
   523     aCompiledMethod := iRMethod compiledCode.
   524     receiver := (5 @ 8).
   524     receiver := (5 @ 8).
   525     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   525     self assert:(aCompiledMethod isKindOf:Method).
   526     self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
   526     self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
   527                 == receiver).
   527                 == receiver).
   528 !
   528 !
   529 
   529 
   530 testPushTempArgument
   530 testPushTempArgument
   537                 pushTemp:#b;
   537                 pushTemp:#b;
   538                 send:#'+';
   538                 send:#'+';
   539                 returnTop;
   539                 returnTop;
   540                 ir.
   540                 ir.
   541     aCompiledMethod := iRMethod compiledCode.
   541     aCompiledMethod := iRMethod compiledCode.
   542     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   542     self assert:(aCompiledMethod isKindOf:Method).
   543     self 
   543     self 
   544         assert:((aCompiledMethod valueWithReceiver:nil arguments:#( 2 8 )) = 10).
   544         assert:((aCompiledMethod valueWithReceiver:nil arguments:#( 2 8 )) = 10).
   545 !
   545 !
   546 
   546 
   547 testPushTempSelf
   547 testPushTempSelf
   553                 pushTemp:#self;
   553                 pushTemp:#self;
   554                 send:#class;
   554                 send:#class;
   555                 returnTop;
   555                 returnTop;
   556                 ir.
   556                 ir.
   557     aCompiledMethod := iRMethod compiledCode.
   557     aCompiledMethod := iRMethod compiledCode.
   558     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   558     self assert:(aCompiledMethod isKindOf:Method).
   559     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   559     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   560                 == UndefinedObject).
   560                 == UndefinedObject).
   561 !
   561 !
   562 
   562 
   563 testPushTempTemp
   563 testPushTempTemp
   568                 addTemps:#( #self #a );
   568                 addTemps:#( #self #a );
   569                 pushTemp:#a;
   569                 pushTemp:#a;
   570                 returnTop;
   570                 returnTop;
   571                 ir.
   571                 ir.
   572     aCompiledMethod := iRMethod compiledCode.
   572     aCompiledMethod := iRMethod compiledCode.
   573     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   573     self assert:(aCompiledMethod isKindOf:Method).
   574     self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = nil).
   574     self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = nil).
   575 !
   575 !
   576 
   576 
   577 testPushThisContext
   577 testPushThisContext
   578     |iRMethod aCompiledMethod|
   578     |iRMethod aCompiledMethod|
   583                 pushThisContext;
   583                 pushThisContext;
   584                 send:#receiver;
   584                 send:#receiver;
   585                 returnTop;
   585                 returnTop;
   586                 ir.
   586                 ir.
   587     aCompiledMethod := iRMethod compiledCode.
   587     aCompiledMethod := iRMethod compiledCode.
   588     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   588     self assert:(aCompiledMethod isKindOf:Method).
   589     self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = 5).
   589     self assert:((aCompiledMethod valueWithReceiver:5 arguments:#()) = 5).
   590 !
   590 !
   591 
   591 
   592 testPushThisEnv
   592 testPushThisEnv
   593     |iRMethod aCompiledMethod receiver|
   593     |iRMethod aCompiledMethod receiver|
   605                 pushThisEnv;
   605                 pushThisEnv;
   606                 returnTop;
   606                 returnTop;
   607                 ir.
   607                 ir.
   608     aCompiledMethod := iRMethod compiledCode.
   608     aCompiledMethod := iRMethod compiledCode.
   609     receiver := Object new.
   609     receiver := Object new.
   610     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   610     self assert:(aCompiledMethod isKindOf:Method).
   611     self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
   611     self assert:((aCompiledMethod valueWithReceiver:receiver arguments:#()) 
   612                 isKindOf:ClosureEnvironment)
   612                 isKindOf:ClosureEnvironment)
   613 !
   613 !
   614 
   614 
   615 testSendNumArgs1
   615 testSendNumArgs1
   625                 returnTop;
   625                 returnTop;
   626                 ir.
   626                 ir.
   627     aCompiledMethod := iRMethod compiledCode.
   627     aCompiledMethod := iRMethod compiledCode.
   628     self class basicAddSelector:#mock1
   628     self class basicAddSelector:#mock1
   629         withMethod:(self class >> #mock1:with:).
   629         withMethod:(self class >> #mock1:with:).
   630     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   630     self assert:(aCompiledMethod isKindOf:Method).
   631     self 
   631     self 
   632         assert:(aCompiledMethod valueWithReceiver:(IRBuilderTest new)
   632         assert:(aCompiledMethod valueWithReceiver:(IRBuilderTest new)
   633                 arguments:#()) = 3.
   633                 arguments:#()) = 3.
   634     self class basicRemoveSelector:#mock1.
   634     self class basicRemoveSelector:#mock1.
   635 
   635 
   648                 returnTop;
   648                 returnTop;
   649                 ir.
   649                 ir.
   650     aCompiledMethod := iRMethod compiledCode.
   650     aCompiledMethod := iRMethod compiledCode.
   651     self class basicAddSelector:#mock1
   651     self class basicAddSelector:#mock1
   652         withMethod:(self class >> #mock1:with:).
   652         withMethod:(self class >> #mock1:with:).
   653     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   653     self assert:(aCompiledMethod isKindOf:Method).
   654     self 
   654     self should:
   655         should:[
   655             [ (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) ]
   656             (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#())
       
   657         ]
       
   658         raise:Error.
   656         raise:Error.
   659     self class basicRemoveSelector:#mock1.
   657     self class basicRemoveSelector:#mock1.
   660 
   658 
   661     "Created: / 01-12-2008 / 19:59:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
   659     "Created: / 01-12-2008 / 19:59:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
   662 !
   660 !
   670                 pushReceiver;
   668                 pushReceiver;
   671                 send:#error toSuperOf:IRBuilderTest;
   669                 send:#error toSuperOf:IRBuilderTest;
   672                 returnTop;
   670                 returnTop;
   673                 ir.
   671                 ir.
   674     aCompiledMethod := iRMethod compiledCode.
   672     aCompiledMethod := iRMethod compiledCode.
   675     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   673     self assert:(aCompiledMethod isKindOf:Method).
   676     self 
   674     self should:
   677         should:[
   675             [ (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#()) ]
   678             (aCompiledMethod valueWithReceiver:(IRBuilderTest new) arguments:#())
       
   679         ]
       
   680         raise:Error.
   676         raise:Error.
   681 
   677 
   682     "Modified: / 11-06-2008 / 16:09:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
   678     "Modified: / 11-06-2008 / 16:09:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
   683     "Modified: / 15-02-2010 / 16:20:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   679     "Modified: / 15-02-2010 / 16:20:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   684 !
   680 !
   692                 pushLiteral:4;
   688                 pushLiteral:4;
   693                 storeIntoLiteralVariable:(IRBuilderTest bindingOf:#TestToPush);
   689                 storeIntoLiteralVariable:(IRBuilderTest bindingOf:#TestToPush);
   694                 returnTop;
   690                 returnTop;
   695                 ir.
   691                 ir.
   696     aCompiledMethod := iRMethod compiledCode.
   692     aCompiledMethod := iRMethod compiledCode.
   697     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   693     self assert:(aCompiledMethod isKindOf:Method).
   698     aCompiledMethod valueWithReceiver:nil arguments:#().
   694     aCompiledMethod valueWithReceiver:nil arguments:#().
   699     self assert:(IRBuilderTest testToPush = 4).
   695     self assert:(IRBuilderTest testToPush = 4).
   700     IRBuilderTest testToPush:nil.
   696     IRBuilderTest testToPush:nil.
   701 !
   697 !
   702 
   698 
   710                 storeTemp:#a;
   706                 storeTemp:#a;
   711                 pushTemp:#a;
   707                 pushTemp:#a;
   712                 returnTop;
   708                 returnTop;
   713                 ir.
   709                 ir.
   714     aCompiledMethod := iRMethod compiledCode.
   710     aCompiledMethod := iRMethod compiledCode.
   715     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   711     self assert:(aCompiledMethod isKindOf:Method).
   716     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 34).
   712     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = 34).
   717 
   713 
   718     "Modified: / 11-06-2008 / 16:24:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
   714     "Modified: / 11-06-2008 / 16:24:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
   719 !
   715 !
   720 
   716 
   733                 pushLiteral:5;
   729                 pushLiteral:5;
   734                 send:#privGetInstVar:;
   730                 send:#privGetInstVar:;
   735                 returnTop;
   731                 returnTop;
   736                 ir.
   732                 ir.
   737     aCompiledMethod := iRMethod compiledCode.
   733     aCompiledMethod := iRMethod compiledCode.
   738     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   734     self assert:(aCompiledMethod isKindOf:Method).
   739     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   735     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) 
   740                 isKindOf:ClosureEnvironment).
   736                 isKindOf:ClosureEnvironment).
   741 
   737 
   742     "Modified: / 11-06-2008 / 14:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
   738     "Modified: / 11-06-2008 / 14:47:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
   743 !
   739 !
   756                 pushLiteral:3;
   752                 pushLiteral:3;
   757                 jumpAheadTarget:#end;
   753                 jumpAheadTarget:#end;
   758                 returnTop;
   754                 returnTop;
   759                 ir.
   755                 ir.
   760     aCompiledMethod := iRMethod compiledCode.
   756     aCompiledMethod := iRMethod compiledCode.
   761     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   757     self assert:(aCompiledMethod isKindOf:Method).
   762     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   758     self assert:((aCompiledMethod valueWithReceiver:nil arguments:#()) = nil).
   763 
   759 
   764     "Created: / 03-11-2008 / 13:34:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
   760     "Created: / 03-11-2008 / 13:34:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
   765 ! !
   761 ! !
   766 
   762 
   770     |aCompiledMethod irBuilder|
   766     |aCompiledMethod irBuilder|
   771 
   767 
   772     irBuilder := (IRBuilder new)
   768     irBuilder := (IRBuilder new)
   773                 numRargs:1;
   769                 numRargs:1;
   774                 addTemps:#( #self );
   770                 addTemps:#( #self );
   775                 pushBlockUsingBuilder:[:builder | 
   771                 pushBlockUsingBuilder:
       
   772                         [:builder | 
   776                         builder
   773                         builder
   777                             numRargs:1;
   774                             numRargs:1;
   778                             addTemps:#( #barg1 );
   775                             addTemps:#( #barg1 );
   779                             pushBlockUsingBuilder:[:builder|
   776                             pushBlockUsingBuilder:
   780                                 builder
   777                                     [:builder | 
   781                                     numRargs: 1;
   778                                     builder
   782                                     addTemps: #( #barg2 );
   779                                         numRargs:1;
   783                                     pushTemp: #barg2;
   780                                         addTemps:#( #barg2 );
   784                                     returnTop
   781                                         pushTemp:#barg2;
   785                             ];
   782                                         returnTop ];
   786                             pushTemp: #barg1;
   783                             pushTemp:#barg1;
   787                             send: #value:;
   784                             send:#value:;
   788                             returnTop
   785                             returnTop ];
   789                     ];
   786                 pushLiteral:22;
   790                 pushLiteral: 22;
       
   791                 send:#value:;
   787                 send:#value:;
   792                 returnTop;
   788                 returnTop;
   793                 ir.
   789                 ir.
   794     "
   790      "
   795         irBuilder ir
   791      irBuilder ir
   796     "
   792     "
   797 
       
   798     aCompiledMethod := irBuilder compiledCode.
   793     aCompiledMethod := irBuilder compiledCode.
   799     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   794     self assert:(aCompiledMethod isKindOf:Method).
   800     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   795     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   801 
   796 
   802     "Created: / 11-05-2009 / 23:04:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
   797     "Created: / 11-05-2009 / 23:04:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
   803     "Modified: / 23-03-2010 / 21:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   798     "Modified: / 23-03-2010 / 21:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   804 !
   799 !
   807     |aCompiledMethod irBuilder|
   802     |aCompiledMethod irBuilder|
   808 
   803 
   809     irBuilder := (IRBuilder new)
   804     irBuilder := (IRBuilder new)
   810                 numRargs:1;
   805                 numRargs:1;
   811                 addTemps:#( #self );
   806                 addTemps:#( #self );
   812                 pushBlockUsingBuilder:[:builder | 
   807                 pushBlockUsingBuilder:
       
   808                         [:builder | 
   813                         builder
   809                         builder
   814                             numRargs:1;
   810                             numRargs:1;
   815                             addTemps:#( #barg1 );
   811                             addTemps:#( #barg1 );
   816                             pushBlockUsingBuilder:[:builder|
   812                             pushBlockUsingBuilder:
   817                                 builder
   813                                     [:builder | 
   818                                     numRargs: 1;
   814                                     builder
   819                                     addTemps: #( #barg2 );
   815                                         numRargs:1;
   820                                     pushTemp: #barg2;
   816                                         addTemps:#( #barg2 );
   821                                     returnTop
   817                                         pushTemp:#barg2;
   822                             ];
   818                                         returnTop ];
   823                             pushTemp: #barg1;
   819                             pushTemp:#barg1;
   824                             send: #value:;
   820                             send:#value:;
   825                             pushBlockUsingBuilder:[:builder|
   821                             pushBlockUsingBuilder:
   826                                 builder
   822                                     [:builder | 
   827                                     numRargs: 1;
   823                                     builder
   828                                     addTemps: #( #barg2 );
   824                                         numRargs:1;
   829                                     pushLiteral: -1;
   825                                         addTemps:#( #barg2 );
   830                                     returnTop
   826                                         pushLiteral:-1;
   831                             ];
   827                                         returnTop ];
   832                             pushTemp: #barg1;
   828                             pushTemp:#barg1;
   833                             send: #value:;
   829                             send:#value:;
   834                             returnTop
   830                             returnTop ];
   835                     ];
   831                 pushLiteral:22;
   836                 pushLiteral: 22;
       
   837                 send:#value:;
   832                 send:#value:;
   838                 returnTop;
   833                 returnTop;
   839                 ir.
   834                 ir.
   840     "
   835      "
   841         irBuilder ir
   836      irBuilder ir
   842     "
   837     "
   843 
       
   844     aCompiledMethod := irBuilder compiledCode.
   838     aCompiledMethod := irBuilder compiledCode.
   845     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   839     self assert:(aCompiledMethod isKindOf:Method).
   846     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = -1).
   840     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = -1).
   847 
   841 
   848     "Created: / 23-03-2010 / 21:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   842     "Created: / 23-03-2010 / 21:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   849 !
   843 !
   850 
   844 
   852     |aCompiledMethod irBuilder|
   846     |aCompiledMethod irBuilder|
   853 
   847 
   854     irBuilder := (IRBuilder new)
   848     irBuilder := (IRBuilder new)
   855                 numRargs:1;
   849                 numRargs:1;
   856                 addTemps:#( #self );
   850                 addTemps:#( #self );
   857                 pushBlockUsingBuilder:[:builder | 
   851                 pushBlockUsingBuilder:
       
   852                         [:builder | 
   858                         builder
   853                         builder
   859                             numRargs:1;
   854                             numRargs:1;
   860                             addTemps:#( #barg1 );
   855                             addTemps:#( #barg1 );
   861                             pushTemp:#barg1;
   856                             pushTemp:#barg1;
   862                             returnTop
   857                             returnTop ];
   863                     ];
       
   864                 pushLiteral:22;
   858                 pushLiteral:22;
   865                 send:#value:;
   859                 send:#value:;
   866                 returnTop;
   860                 returnTop;
   867                 ir.
   861                 ir.
   868     "
   862      "
   869         irBuilder ir
   863      irBuilder ir
   870     "
   864     "
   871 
       
   872     aCompiledMethod := irBuilder compiledCode.
   865     aCompiledMethod := irBuilder compiledCode.
   873     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   866     self assert:(aCompiledMethod isKindOf:Method).
   874     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   867     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   875 
   868 
   876     "Created: / 30-03-2009 / 14:26:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
   869     "Created: / 30-03-2009 / 14:26:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
   877     "Modified: / 30-03-2009 / 19:16:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
   870     "Modified: / 30-03-2009 / 19:16:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
   878 !
   871 !
   881     |aCompiledMethod irBuilder|
   874     |aCompiledMethod irBuilder|
   882 
   875 
   883     irBuilder := (IRBuilder new)
   876     irBuilder := (IRBuilder new)
   884                 numRargs:1;
   877                 numRargs:1;
   885                 addTemps:#( #self );
   878                 addTemps:#( #self );
   886                 pushBlockUsingBuilder:[:builder | 
   879                 pushBlockUsingBuilder:
       
   880                         [:builder | 
   887                         builder
   881                         builder
   888                             numRargs:0;
   882                             numRargs:0;
   889                             addTemps:#( #bvar1 );
   883                             addTemps:#( #bvar1 );
   890                             pushLiteral: 22;
   884                             pushLiteral:22;
   891                             storeTemp:#bvar1;
   885                             storeTemp:#bvar1;
   892                             pushTemp: #bvar1;
   886                             pushTemp:#bvar1;
   893                             returnTop
   887                             returnTop ];
   894                     ];
       
   895                 send:#value;
   888                 send:#value;
   896                 returnTop;
   889                 returnTop;
   897                 ir.
   890                 ir.
   898     "
   891      "
   899         irBuilder ir
   892      irBuilder ir
   900     "
   893     "
   901 
       
   902     aCompiledMethod := irBuilder compiledCode.
   894     aCompiledMethod := irBuilder compiledCode.
   903     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   895     self assert:(aCompiledMethod isKindOf:Method).
   904     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   896     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
   905 
   897 
   906     "Created: / 30-03-2009 / 23:03:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
   898     "Created: / 30-03-2009 / 23:03:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
   907 !
   899 !
   908 
   900 
   910     |aCompiledMethod irBuilder|
   902     |aCompiledMethod irBuilder|
   911 
   903 
   912     irBuilder := (IRBuilder new)
   904     irBuilder := (IRBuilder new)
   913                 numRargs:1;
   905                 numRargs:1;
   914                 addTemps:#( #self );
   906                 addTemps:#( #self );
   915                 pushLiteral: false;
   907                 pushLiteral:false;
   916                 pushLiteral: true;
   908                 pushLiteral:true;
   917                 jumpAheadTo: #end if: false;
   909                 jumpAheadTo:#end if:false;
   918                 pushBlockUsingBuilder:[:builder | 
   910                 pushBlockUsingBuilder:
       
   911                         [:builder | 
   919                         builder
   912                         builder
   920                             numRargs: 0;
   913                             numRargs:0;
   921                             pushLiteral: true;
   914                             pushLiteral:true;
   922                             returnTop
   915                             returnTop ];
   923                     ];
   916                 send:#value;
   924                 send: #value;
   917                 jumpAheadTarget:#end;
   925                 jumpAheadTarget: #end;
   918                 returnTop;
   926                 returnTop;
   919                 ir.
   927                 ir.
   920      "
   928     "
   921      irBuilder ir
   929         irBuilder ir
   922     "
   930     "
       
   931 
       
   932     aCompiledMethod := irBuilder compiledCode.
   923     aCompiledMethod := irBuilder compiledCode.
   933     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   924     self assert:(aCompiledMethod isKindOf:Method).
   934     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
   925     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
   935 
   926 
   936     "Created: / 13-05-2009 / 11:24:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
   927     "Created: / 13-05-2009 / 11:24:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
   937 !
   928 !
   938 
   929 
   939 testBlock_exceptionHandler
   930 testBlock_exceptionHandler
   940     |aCompiledMethod irBuilder|
   931     |aCompiledMethod irBuilder|
   941 
   932 
   942     irBuilder := (IRBuilder new)
   933     irBuilder := (IRBuilder new)
   943                 numRargs:1;
   934                 numRargs:1;
   944                 addTemps:#( #self);
   935                 addTemps:#( #self );
   945                pushBlockUsingBuilder:[:builder | 
   936                 pushBlockUsingBuilder:
       
   937                         [:builder | 
   946                         builder
   938                         builder
   947                             numRargs:0;  
   939                             numRargs:0;
   948                             pushLiteral: 1;
   940                             pushLiteral:1;
   949                             pushLiteral: 0;
   941                             pushLiteral:0;
   950                             send: #/;
   942                             send:#'/';
   951                             pushLiteral: false;
   943                             pushLiteral:false;
   952                             remoteReturn
   944                             remoteReturn ];
   953                     ];
   945                 pushLiteralVariable:#Error;
   954                 pushLiteralVariable: #Error;
   946                 pushBlockUsingBuilder:
   955                 pushBlockUsingBuilder:[:builder|
   947                         [:builder | 
   956                     builder
   948                         builder
   957                         numRargs:0;
   949                             numRargs:0;
   958                         pushLiteral: true;
   950                             pushLiteral:true;
   959                         remoteReturn];
   951                             remoteReturn ];
   960                 send: #on:do:;
   952                 send:#on:do:;
   961                 pushLiteral: false;
   953                 pushLiteral:false;
   962                 returnTop;
   954                 returnTop;
   963                 ir.
   955                 ir.
   964     "
   956      "
   965         irBuilder ir
   957      irBuilder ir
   966     "
   958     "
   967 
       
   968     aCompiledMethod := irBuilder compiledCode.
   959     aCompiledMethod := irBuilder compiledCode.
   969     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   960     self assert:(aCompiledMethod isKindOf:Method).
   970     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
   961     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
   971 
   962 
   972     "Created: / 11-05-2009 / 21:53:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
   963     "Created: / 11-05-2009 / 21:53:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
   973 !
   964 !
   974 
   965 
   975 testBlock_exceptionHandler_noRemoteReturn
   966 testBlock_exceptionHandler_noRemoteReturn
   976     |aCompiledMethod irBuilder|
   967     |aCompiledMethod irBuilder|
   977 
   968 
   978     irBuilder := (IRBuilder new)
   969     irBuilder := (IRBuilder new)
   979                 numRargs:1;
   970                 numRargs:1;
   980                 addTemps:#( #self);
   971                 addTemps:#( #self );
   981                pushBlockUsingBuilder:[:builder | 
   972                 pushBlockUsingBuilder:
       
   973                         [:builder | 
   982                         builder
   974                         builder
   983                             numRargs:0;  
   975                             numRargs:0;
   984                             pushLiteral: 1;
   976                             pushLiteral:1;
   985                             pushLiteral: 0;
   977                             pushLiteral:0;
   986                             send: #/;
   978                             send:#'/';
   987                             pushLiteral: false;
   979                             pushLiteral:false;
   988                             returnTop
   980                             returnTop ];
   989                     ];
   981                 pushLiteralVariable:#Error;
   990                 pushLiteralVariable: #Error;
   982                 pushBlockUsingBuilder:
   991                 pushBlockUsingBuilder:[:builder|
   983                         [:builder | 
   992                     builder
   984                         builder
   993                         numRargs:0;
   985                             numRargs:0;
   994                         pushLiteral: true;
   986                             pushLiteral:true;
   995                         returnTop];
   987                             returnTop ];
   996                 send: #on:do:;
   988                 send:#on:do:;
   997                 returnTop;
   989                 returnTop;
   998                 ir.
   990                 ir.
   999     "
   991      "
  1000         irBuilder ir
   992      irBuilder ir
  1001     "
   993     "
  1002 
       
  1003     aCompiledMethod := irBuilder compiledCode.
   994     aCompiledMethod := irBuilder compiledCode.
  1004     self assert:(aCompiledMethod isKindOf:CompiledMethod).
   995     self assert:(aCompiledMethod isKindOf:Method).
  1005     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
   996     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = true).
  1006 
   997 
  1007     "Created: / 11-05-2009 / 21:53:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
   998     "Created: / 11-05-2009 / 21:53:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1008 !
   999 !
  1009 
  1000 
  1010 testBlock_invalid_instruction_ordering_bug_1
  1001 testBlock_invalid_instruction_ordering_bug_1
  1011     |aCompiledMethod irBuilder|
  1002     |aCompiledMethod irBuilder|
  1012 
  1003 
  1013     irBuilder := (IRBuilder new)
  1004     irBuilder := (IRBuilder new)
  1014                     numRargs: 1;
  1005                 numRargs:1;
  1015                     addTemps: #(self i);
  1006                 addTemps:#( #self #i );
  1016                     pushTemp: #i;
  1007                 pushTemp:#i;
  1017                     pushLiteral: 3;
  1008                 pushLiteral:3;
  1018                     pushReceiver;
  1009                 pushReceiver;
  1019 
  1010                 pushBlockUsingBuilder:
  1020                     pushBlockUsingBuilder: [ :builder | 
  1011                         [:builder | 
  1021                         builder
  1012                         builder
  1022                             numRargs: 0;
  1013                             numRargs:0;
  1023                             addTemps: #();
  1014                             addTemps:#();
  1024                             pushTemp: #i;
  1015                             pushTemp:#i;
  1025                             returnTop.
  1016                             returnTop. ];
  1026                     ];
  1017                 returnTop;
  1027                     returnTop;
  1018                 ir.
  1028                     ir.
  1019      "
  1029     "
  1020      irBuilder ir
  1030         irBuilder ir
  1021     "
  1031     "
       
  1032 
       
  1033     aCompiledMethod := irBuilder compiledCode.
  1022     aCompiledMethod := irBuilder compiledCode.
  1034     self assert:(aCompiledMethod isKindOf:CompiledMethod).
  1023     self assert:(aCompiledMethod isKindOf:Method).
  1035     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) isKindOf: Block).
  1024     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) 
       
  1025                 isKindOf:Block).
  1036 
  1026 
  1037     "Created: / 11-05-2009 / 21:55:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1027     "Created: / 11-05-2009 / 21:55:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1038 !
  1028 !
  1039 
  1029 
  1040 testBlock_methodTempVar
  1030 testBlock_methodTempVar
  1041     |aCompiledMethod irBuilder|
  1031     |aCompiledMethod irBuilder|
  1042 
  1032 
  1043     irBuilder := (IRBuilder new)
  1033     irBuilder := (IRBuilder new)
  1044                 numRargs:1;
  1034                 numRargs:1;
  1045                 addTemps:#( #self #a);
  1035                 addTemps:#( #self #a );
  1046                 pushLiteral: 22;
  1036                 pushLiteral:22;
  1047                 storeTemp: #a;
  1037                 storeTemp:#a;
  1048                 pushBlockUsingBuilder:[:builder | 
  1038                 pushBlockUsingBuilder:
       
  1039                         [:builder | 
  1049                         builder
  1040                         builder
  1050                             numRargs:0;
  1041                             numRargs:0;
  1051                             pushTemp: #a;
  1042                             pushTemp:#a;
  1052                             returnTop
  1043                             returnTop ];
  1053                     ];
       
  1054                 send:#value;
  1044                 send:#value;
  1055                 returnTop;
  1045                 returnTop;
  1056                 ir.
  1046                 ir.
  1057     "
  1047      "
  1058         irBuilder ir
  1048      irBuilder ir
  1059     "
  1049     "
  1060 
       
  1061     aCompiledMethod := irBuilder compiledCode.
  1050     aCompiledMethod := irBuilder compiledCode.
  1062     self assert:(aCompiledMethod isKindOf:CompiledMethod).
  1051     self assert:(aCompiledMethod isKindOf:Method).
  1063     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
  1052     self assert:((aCompiledMethod valueWithReceiver:1 arguments:#()) = 22).
  1064 
  1053 
  1065     "Created: / 30-03-2009 / 23:05:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1054     "Created: / 30-03-2009 / 23:05:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1066     "Modified: / 01-04-2009 / 19:43:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1055     "Modified: / 01-04-2009 / 19:43:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1067 ! !
  1056 ! !