- IRTempStore
changed: #version_SVN
- IRAccess
changed: #version_SVN
- IRMethod
changed: #version_SVN
- IRPrinter
changed: #version_SVN
- IRTempRead
changed: #version_SVN
- IRLiteralVariableRead
changed: #version_SVN
- IRLine
changed: #version_SVN
- IRClosure
changed: #version_SVN
- IRFunction
changed: #version_SVN
- IRDup
changed: #version_SVN
- IRTranslator
changed: #version_SVN
- IRInterpreter
changed: #version_SVN
- IRBuilder
changed: #version_SVN
- IRBytecodeGenerator
changed: #version_SVN
- IRJumpOverBlock
changed: #version_SVN
- IRBlockReturnTop
changed: #version_SVN
- IRSequence
changed: #version_SVN
- IRDecompiler
changed: #version_SVN
- IRInstVarStore
changed: #version_SVN
- cvut_stx_goodies_newcompiler
added:
#excludedFromPreRequisites
#extensionsVersion_SVN
#svnRepositoryUrlString
changed:
#preRequisites
#svnRevisionNr
#version_SVN
- IRLiteralVariableAccess
changed: #version_SVN
- IRTransformTest
changed: #version_SVN
- IRStackCount
changed: #version_SVN
- IRInstVarAccess
changed: #version_SVN
- IRLiteralVariableStore
changed: #version_SVN
- IRBuilderTest
changed: #version_SVN
- IRInstruction
changed: #version_SVN
- IRTempAccess
changed: #version_SVN
- IRConstant
changed: #version_SVN
- IRSend
changed: #version_SVN
- IRInstVarRead
changed: #version_SVN
- IRPop
changed: #version_SVN
- IRReturn
changed: #version_SVN
- IRJump
changed: #version_SVN
- IRJumpIf
changed: #version_SVN
- extensions
...
"{ Package: 'cvut:stx/goodies/newcompiler' }"
TestCase subclass:#IRTransformTest
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'NewCompiler-IR-Tests'
!
!IRTransformTest methodsFor:'testing'!
testAdd
|iRMethod aCompiledMethod|
iRMethod := (IRBuilder new)
numRargs:1;
addTemps:#( #self );
pushLiteral:1;
returnTop;
ir.
(iRMethod allSequences last) last delete.
(iRMethod allSequences last) last delete.
(iRMethod allSequences last) add:(IRInstruction pushLiteral:2).
(iRMethod allSequences last) add:(IRInstruction returnTop).
aCompiledMethod := iRMethod compiledCode.
self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
!
testAddBefore
|iRMethod aCompiledMethod ret|
iRMethod := (IRBuilder new)
numRargs:1;
addTemps:#( #self );
pushLiteral:1;
returnTop;
ir.
(iRMethod allSequences last) last delete.
(iRMethod allSequences last) last delete.
ret := (IRInstruction returnTop).
(iRMethod allSequences last) add:ret.
(iRMethod allSequences last) add:(IRInstruction pushLiteral:2) before:ret.
aCompiledMethod := iRMethod compiledCode.
self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
!
testAddIntructions
| iRMethod aCompiledMethod |
iRMethod := IRBuilder new
numRargs: 1;
addTemps: #(self); "receiver and args declarations"
pushLiteral: 1;
returnTop;
ir.
(iRMethod allSequences last) last delete.
(iRMethod allSequences last) last delete.
(iRMethod allSequences last)
addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)}.
aCompiledMethod := iRMethod compiledCode.
self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
"Modified: / 30-03-2009 / 19:40:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
testAddIntructionsBefore
| iRMethod aCompiledMethod push |
iRMethod := IRBuilder new
numRargs: 1;
addTemps: #(self); "receiver and args declarations"
pushLiteral: 1;
returnTop;
ir.
push := (iRMethod allSequences last) at: (iRMethod allSequences size - 1) .
(iRMethod allSequences last)
addInstructions: {(IRInstruction pushLiteral: 2). (IRInstruction returnTop)} before: push.
aCompiledMethod := iRMethod compiledCode.
self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
"Modified: / 30-03-2009 / 19:40:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
testAddIntructionsBeforeFromLList
|iRMethod aCompiledMethod push llist col|
iRMethod := (IRBuilder new)
numRargs:1;
addTemps:#( #self );
pushLiteral:1;
returnTop;
ir.
push := (iRMethod allSequences last) at:(iRMethod allSequences size - 1).
llist := LinkedList new.
llist add:(IRInstruction pushLiteral:2).
llist add:(IRInstruction returnTop).
col := llist asOrderedCollection.
(iRMethod allSequences last) addInstructions:col before:push.
aCompiledMethod := iRMethod compiledCode.
self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
!
testDelete
|iRMethod aCompiledMethod|
iRMethod := (IRBuilder new)
numRargs:1;
addTemps:#( #self );
pushLiteral:1;
pushLiteral:2;
returnTop;
ir.
((iRMethod allSequences last)
detect:[:each | each isConstant:[:c | c == 2 ] ]) delete.
aCompiledMethod := iRMethod compiledCode.
self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 1 ].
!
testReplace
|iRMethod aCompiledMethod|
iRMethod := (IRBuilder new)
numRargs:1;
addTemps:#( #self );
pushLiteral:1;
returnTop;
ir.
(iRMethod allSequences last at:1)
replaceWith:(IRInstruction pushLiteral:2).
aCompiledMethod := iRMethod compiledCode.
self should:[ (aCompiledMethod valueWithReceiver:nil arguments:#()) = 2 ].
!
testReplaceInstr
| iRMethod aCompiledMethod |
iRMethod := IRBuilder new
numRargs: 1;
addTemps: #(self); "receiver and args declarations"
pushLiteral: 1;
returnTop;
ir.
(iRMethod allSequences last at: 1)
replaceWithInstructions: {(IRInstruction pushLiteral: 2)}.
aCompiledMethod := iRMethod compiledCode.
self should: [(aCompiledMethod valueWithReceiver: nil arguments: #() ) = 2].
"Modified: / 30-03-2009 / 19:40:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!IRTransformTest class methodsFor:'documentation'!
version
^ '$Id$'
!
version_CVS
^ '§Header: /cvs/stx/cvut/stx/goodies/newcompiler/IRTransformTest.st,v 1.3 2009/10/08 11:56:52 fm Exp §'
!
version_SVN
^ '$Id:: $'
! !