c1/DragonFly__C1BackendTests.st
changeset 38 ce82ecc2ca57
parent 37 ec41dca68283
equal deleted inserted replaced
37:ec41dca68283 38:ce82ecc2ca57
   111     self assert:ctx numVars == 0.
   111     self assert:ctx numVars == 0.
   112     self assert:ctx numTemps == 0.
   112     self assert:ctx numTemps == 0.
   113 
   113 
   114     "Created: / 24-06-2016 / 00:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   114     "Created: / 24-06-2016 / 00:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   115     "Modified: / 25-07-2016 / 19:01:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   115     "Modified: / 25-07-2016 / 19:01:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   116 !
       
   117 
       
   118 test_thisContext_02
       
   119     | method  compiler  ctx |
       
   120 
       
   121     method := JavaMethod new.
       
   122     method numberOfArgs:0.
       
   123     method numberOfVars:0.
       
   124     method stackSize:0.
       
   125     method setAccessFlags: JavaConstants ACC_PUBLIC.
       
   126     compiler := C1CompilerBackend new.
       
   127     compiler method:method.
       
   128     compiler prepare.
       
   129     compiler emitPrologue.
       
   130     compiler emitReturn:(compiler 
       
   131                 emitSend:#returnSenderContext
       
   132                 to:(compiler loadLiteral:self)
       
   133                 with:#()).
       
   134     compiler emitEpilogue.
       
   135     compiler finish.
       
   136     self assert:method code notNil.
       
   137     ctx := method 
       
   138             valueWithReceiver:self
       
   139             arguments:#()
       
   140             selector:testSelector.
       
   141     self assert:ctx isJavaContext.
       
   142     self assert:ctx receiver == self.
       
   143     self assert:ctx selector == testSelector.
       
   144     self assert:ctx method == method.
       
   145     self assert:ctx numArgs == 0.
       
   146     self assert:ctx numVars == 0.
       
   147     self assert:ctx numTemps == 0.
       
   148 
       
   149     "Created: / 07-08-2016 / 21:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   116 ! !
   150 ! !
   117 
   151 
   118 !C1BackendTests methodsFor:'tests - building blocks'!
   152 !C1BackendTests methodsFor:'tests - building blocks'!
   119 
   153 
   120 test_emitReturn_01
   154 test_emitReturn_01