cpu.ppc: remove use of with-scope in favor of locals.

db4
John Benediktsson 2015-06-15 09:11:03 -07:00
parent 255b60ef8d
commit c44aaf58be
1 changed files with 58 additions and 64 deletions

View File

@ -527,25 +527,23 @@ M: ppc %unbox-alien ( dst src -- )
! else // Assume (src & tag_mask) == BYTE_ARRAY_TYPE ! else // Assume (src & tag_mask) == BYTE_ARRAY_TYPE
! dst = ((byte_array*)src) + 1; ! dst = ((byte_array*)src) + 1;
M:: ppc %unbox-any-c-ptr ( dst src -- ) M:: ppc %unbox-any-c-ptr ( dst src -- )
[ <label> :> end
"end" define-label ! Is the object f?
! Is the object f? dst 0 LI
dst 0 LI 0 src \ f type-number %compare-cell-imm
0 src \ f type-number %compare-cell-imm 0 end BEQ
0 "end" get BEQ
! Is the object an alien? ! Is the object an alien?
dst src tag-mask get ANDI. dst src tag-mask get ANDI.
! Assume unboxing a byte-array. ! Assume unboxing a byte-array.
0 dst alien type-number %compare-cell-imm 0 dst alien type-number %compare-cell-imm
dst src byte-array-offset ADDI dst src byte-array-offset ADDI
0 "end" get BNE 0 end BNE
! Unbox the alien. ! Unbox the alien.
scratch-reg alien-offset LI scratch-reg alien-offset LI
dst src scratch-reg %load-cell-x dst src scratch-reg %load-cell-x
"end" resolve-label end resolve-label ;
] with-scope ;
! Be very careful with this. It cannot be used as an immediate ! Be very careful with this. It cannot be used as an immediate
! offset to a load or store. ! offset to a load or store.
@ -562,25 +560,23 @@ M:: ppc %unbox-any-c-ptr ( dst src -- )
! dst->address = src; ! dst->address = src;
! } ! }
M:: ppc %box-alien ( dst src temp -- ) M:: ppc %box-alien ( dst src temp -- )
[ <label> :> f-label
"f" define-label
! Is the object f? ! Is the object f?
dst \ f type-number LI dst \ f type-number LI
0 src 0 %compare-cell-imm 0 src 0 %compare-cell-imm
0 "f" get BEQ 0 f-label BEQ
! Allocate and initialize an alien object. ! Allocate and initialize an alien object.
dst 5 cells alien temp %allot dst 5 cells alien temp %allot
temp \ f type-number LI temp \ f type-number LI
scratch-reg dst %clear-tag-bits scratch-reg dst %clear-tag-bits
temp scratch-reg 1 cells %store-cell temp scratch-reg 1 cells %store-cell
temp scratch-reg 2 cells %store-cell temp scratch-reg 2 cells %store-cell
src scratch-reg 3 cells %store-cell src scratch-reg 3 cells %store-cell
src scratch-reg 4 cells %store-cell src scratch-reg 4 cells %store-cell
"f" resolve-label f-label resolve-label ;
] with-scope ;
! dst->base = base; ! dst->base = base;
! dst->displacement = displacement; ! dst->displacement = displacement;
@ -629,26 +625,26 @@ M:: ppc %box-alien ( dst src temp -- )
! box_displaced_alien_alien(dst, displacement, base, temp); ! box_displaced_alien_alien(dst, displacement, base, temp);
! else ! else
! box_displaced_alien_byte_array(dst, displacement, base, temp); ! box_displaced_alien_byte_array(dst, displacement, base, temp);
:: box-displaced-alien/dynamic ( dst displacement base temp -- ) :: box-displaced-alien/dynamic ( dst displacement base temp end -- )
"not-f" define-label <label> :> not-f
"not-alien" define-label <label> :> not-alien
! Is base f? ! Is base f?
0 base \ f type-number %compare-cell-imm 0 base \ f type-number %compare-cell-imm
0 "not-f" get BNE 0 not-f BNE
dst displacement base box-displaced-alien/f dst displacement base box-displaced-alien/f
"end" get B end B
! Is base an alien? ! Is base an alien?
"not-f" resolve-label not-f resolve-label
temp base tag-mask get ANDI. temp base tag-mask get ANDI.
0 temp alien type-number %compare-cell-imm 0 temp alien type-number %compare-cell-imm
0 "not-alien" get BNE 0 not-alien BNE
dst displacement base temp box-displaced-alien/alien dst displacement base temp box-displaced-alien/alien
"end" get B end B
! Assume base is a byte array. ! Assume base is a byte array.
"not-alien" resolve-label not-alien resolve-label
dst displacement base temp box-displaced-alien/byte-array ; dst displacement base temp box-displaced-alien/byte-array ;
! if (displacement == 0) ! if (displacement == 0)
@ -666,33 +662,31 @@ M:: ppc %box-alien ( dst src temp -- )
! box_displaced_alien_dynamic(dst, displacement, base, temp); ! box_displaced_alien_dynamic(dst, displacement, base, temp);
! } ! }
M:: ppc %box-displaced-alien ( dst displacement base temp base-class -- ) M:: ppc %box-displaced-alien ( dst displacement base temp base-class -- )
[ <label> :> end
"end" define-label
! If displacement is zero, return the base. ! If displacement is zero, return the base.
dst base MR dst base MR
0 displacement 0 %compare-cell-imm 0 displacement 0 %compare-cell-imm
0 "end" get BEQ 0 end BEQ
! Displacement is non-zero, we're going to be allocating a new ! Displacement is non-zero, we're going to be allocating a new
! object ! object
dst 5 cells alien temp %allot dst 5 cells alien temp %allot
! Set expired to f ! Set expired to f
temp \ f type-number %load-immediate temp \ f type-number %load-immediate
scratch-reg 2 alien@ LI scratch-reg 2 alien@ LI
temp dst scratch-reg %store-cell-x temp dst scratch-reg %store-cell-x
dst displacement base temp dst displacement base temp
{ {
{ [ base-class \ f class<= ] [ drop box-displaced-alien/f ] } { [ base-class \ f class<= ] [ drop box-displaced-alien/f ] }
{ [ base-class \ alien class<= ] [ box-displaced-alien/alien ] } { [ base-class \ alien class<= ] [ box-displaced-alien/alien ] }
{ [ base-class \ byte-array class<= ] [ box-displaced-alien/byte-array ] } { [ base-class \ byte-array class<= ] [ box-displaced-alien/byte-array ] }
[ box-displaced-alien/dynamic ] [ end box-displaced-alien/dynamic ]
} cond } cond
"end" resolve-label end resolve-label ;
] with-scope ;
M:: ppc.32 %convert-integer ( dst src c-type -- ) M:: ppc.32 %convert-integer ( dst src c-type -- )
c-type { c-type {