1 ! Copyright (C) 2005, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs sequences kernel combinators make math
4 math.order math.ranges system namespaces locals layouts words
5 alien alien.accessors alien.c-types literals cpu.architecture
6 cpu.ppc.assembler cpu.ppc.assembler.backend compiler.cfg.registers
7 compiler.cfg.instructions compiler.cfg.comparisons
8 compiler.codegen.fixup compiler.cfg.intrinsics
9 compiler.cfg.stack-frame compiler.cfg.build-stack-frame
10 compiler.units compiler.constants compiler.codegen vm ;
11 FROM: cpu.ppc.assembler => B ;
14 ! PowerPC register assignments:
15 ! r2-r12: integer vregs
17 ! r30: integer scratch
21 ! Add some methods to the assembler that are useful to us
22 M: label (B) [ 0 ] 2dip (B) rc-relative-ppc-3 label-fixup ;
23 M: label BC [ 0 BC ] dip rc-relative-ppc-2 label-fixup ;
25 enable-float-intrinsics
28 \ ##integer>float t frame-required? set-word-prop
29 \ ##float>integer t frame-required? set-word-prop
32 : %load-vm-addr ( reg -- )
33 0 swap LOAD32 rc-absolute-ppc-2/2 rt-vm rel-fixup ;
35 : %load-vm-field-addr ( reg symbol -- )
36 [ drop %load-vm-addr ]
37 [ [ dup ] dip vm-field-offset ADDI ] 2bi ;
39 M: ppc %vm-field-ptr ( dst field -- ) %load-vm-field-addr ;
41 M: ppc machine-registers
43 { int-regs $[ 2 12 [a,b] 15 29 [a,b] append ] }
44 { float-regs $[ 0 29 [a,b] ] }
47 CONSTANT: scratch-reg 30
48 CONSTANT: fp-scratch-reg 30
50 M: ppc two-operand? f ;
52 M: ppc %load-immediate ( reg n -- ) swap LOAD ;
54 M: ppc %load-reference ( reg obj -- )
55 [ 0 swap LOAD32 ] [ rc-absolute-ppc-2/2 rel-immediate ] bi* ;
57 M: ppc %alien-global ( register symbol dll -- )
58 [ 0 swap LOAD32 ] 2dip rc-absolute-ppc-2/2 rel-dlsym ;
63 GENERIC: loc-reg ( loc -- reg )
65 M: ds-loc loc-reg drop ds-reg ;
66 M: rs-loc loc-reg drop rs-reg ;
68 : loc>operand ( loc -- reg n )
69 [ loc-reg ] [ n>> cells neg ] bi ; inline
71 M: ppc %peek loc>operand LWZ ;
72 M: ppc %replace loc>operand STW ;
74 :: (%inc) ( n reg -- ) reg reg n cells ADDI ; inline
76 M: ppc %inc-d ( n -- ) ds-reg (%inc) ;
77 M: ppc %inc-r ( n -- ) rs-reg (%inc) ;
79 HOOK: reserved-area-size os ( -- n )
81 ! The start of the stack frame contains the size of this frame
82 ! as well as the currently executing XT
83 : factor-area-size ( -- n ) 2 cells ; foldable
84 : next-save ( n -- i ) cell - ;
85 : xt-save ( n -- i ) 2 cells - ;
87 ! Next, we have the spill area as well as the FFI parameter area.
88 ! It is safe for them to overlap, since basic blocks with FFI calls
89 ! will never spill -- indeed, basic blocks with FFI calls do not
90 ! use vregs at all, and the FFI call is a stack analysis sync point.
91 ! In the future this will change and the stack frame logic will
92 ! need to be untangled somewhat.
94 : param@ ( n -- x ) reserved-area-size + ; inline
96 : param-save-size ( -- n ) 8 cells ; foldable
99 reserved-area-size param-save-size + + ; inline
101 : spill@ ( n -- offset )
102 spill-offset local@ ;
104 ! Some FP intrinsics need a temporary scratch area in the stack
105 ! frame, 8 bytes in size. This is in the param-save area so it
106 ! does not overlap with spill slots.
107 : scratch@ ( n -- offset )
111 : gc-root@ ( n -- offset )
112 gc-root-offset local@ ;
114 ! Finally we have the linkage area
115 HOOK: lr-save os ( -- n )
117 M: ppc stack-frame-size ( stack-frame -- i )
124 M: ppc %call ( word -- ) 0 BL rc-relative-ppc-3 rel-word-pic ;
126 M: ppc %jump ( word -- )
127 0 6 LOAD32 8 rc-absolute-ppc-2/2 rel-here
128 0 B rc-relative-ppc-3 rel-word-pic-tail ;
130 M: ppc %jump-label ( label -- ) B ;
131 M: ppc %return ( -- ) BLR ;
133 M:: ppc %dispatch ( src temp -- )
135 4 cells rc-absolute-ppc-2/2 rel-here
140 :: (%slot) ( obj slot tag temp -- reg offset )
142 temp tag neg ; inline
144 : (%slot-imm) ( obj slot tag -- reg offset )
145 [ cells ] dip - ; inline
147 M: ppc %slot ( dst obj slot tag temp -- ) (%slot) LWZ ;
148 M: ppc %slot-imm ( dst obj slot tag -- ) (%slot-imm) LWZ ;
149 M: ppc %set-slot ( src obj slot tag temp -- ) (%slot) STW ;
150 M: ppc %set-slot-imm ( src obj slot tag -- ) (%slot-imm) STW ;
152 M:: ppc %string-nth ( dst src index temp -- )
156 dst temp string-offset LBZ
159 temp src string-aux-offset LWZ
162 temp temp byte-array-offset LHZ
168 M:: ppc %set-string-nth-fast ( ch obj index temp -- )
170 ch temp string-offset STB ;
173 M: ppc %add-imm ADDI ;
174 M: ppc %sub swap SUBF ;
175 M: ppc %sub-imm SUBI ;
177 M: ppc %mul-imm MULLI ;
179 M: ppc %and-imm ANDI ;
183 M: ppc %xor-imm XORI ;
185 M: ppc %shl-imm swapd SLWI ;
187 M: ppc %shr-imm swapd SRWI ;
189 M: ppc %sar-imm SRAWI ;
192 :: overflow-template ( label dst src1 src2 insn -- )
195 dst src2 src1 insn call
198 M: ppc %fixnum-add ( label dst src1 src2 -- )
199 [ ADDO. ] overflow-template ;
201 M: ppc %fixnum-sub ( label dst src1 src2 -- )
202 [ SUBFO. ] overflow-template ;
204 M: ppc %fixnum-mul ( label dst src1 src2 -- )
205 [ MULLWO. ] overflow-template ;
207 : bignum@ ( n -- offset ) cells bignum tag-number - ; inline
209 M:: ppc %integer>bignum ( dst src temp -- )
212 dst 0 >bignum %load-reference
213 ! Is it zero? Then just go to the end and return this zero
217 dst 4 cells bignum temp %allot
220 temp dst 1 bignum@ STW
223 temp temp cell-bits 1 - SRAWI
226 temp dst 2 bignum@ STW
227 ! Make negative value positive
233 temp dst 3 bignum@ STW
237 M:: ppc %bignum>integer ( dst src temp -- )
240 temp src 1 bignum@ LWZ
241 ! if the length is 1, its just the sign and nothing else,
244 0 temp 1 tag-fixnum CMPI
247 dst src 3 bignum@ LWZ
249 temp src 2 bignum@ LWZ
250 ! branchless arithmetic: we want to turn 0 into 1,
255 ! multiply value by sign
260 M: ppc %add-float FADD ;
261 M: ppc %sub-float FSUB ;
262 M: ppc %mul-float FMUL ;
263 M: ppc %div-float FDIV ;
265 M:: ppc %integer>float ( dst src -- )
266 HEX: 4330 scratch-reg LIS
267 scratch-reg 1 0 scratch@ STW
269 scratch-reg dup HEX: 8000 XORIS
270 scratch-reg 1 4 scratch@ STW
272 scratch-reg 4503601774854144.0 %load-reference
273 fp-scratch-reg scratch-reg float-offset LFD
274 dst dst fp-scratch-reg FSUB ;
276 M:: ppc %float>integer ( dst src -- )
277 fp-scratch-reg src FCTIWZ
278 fp-scratch-reg 1 0 scratch@ STFD
279 dst 1 4 scratch@ LWZ ;
281 M: ppc %copy ( dst src rep -- )
284 { double-rep [ FMR ] }
287 M: ppc %unbox-float ( dst src -- ) float-offset LFD ;
289 M:: ppc %box-float ( dst src temp -- )
290 dst 16 float temp %allot
291 src dst float-offset STFD ;
293 : float-function-param ( i spill-slot -- )
294 [ float-regs param-regs nth 1 ] [ n>> spill@ ] bi* LFD ;
296 : float-function-return ( reg -- )
297 float-regs return-reg 2dup = [ 2drop ] [ FMR ] if ;
299 M:: ppc %unary-float-function ( dst src func -- )
300 0 src float-function-param
302 dst float-function-return ;
304 M:: ppc %binary-float-function ( dst src1 src2 func -- )
305 0 src1 float-function-param
306 1 src2 float-function-param
308 dst float-function-return ;
310 ! Internal format is always double-precision on PowerPC
311 M: ppc %single>double-float FMR ;
313 M: ppc %double>single-float FMR ;
315 M: ppc %unbox-alien ( dst src -- )
318 M:: ppc %unbox-any-c-ptr ( dst src temp -- )
320 { "is-byte-array" "end" "start" } [ define-label ] each
321 ! Address is computed in dst
323 ! Load object into scratch-reg
325 ! We come back here with displaced aliens
326 "start" resolve-label
328 0 scratch-reg \ f tag-number CMPI
331 ! Is the object an alien?
332 0 scratch-reg header-offset LWZ
333 0 0 alien type-number tag-fixnum CMPI
334 "is-byte-array" get BNE
335 ! If so, load the offset
336 0 scratch-reg alien-offset LWZ
337 ! Add it to address being computed
339 ! Now recurse on the underlying alien
340 scratch-reg scratch-reg underlying-alien-offset LWZ
342 "is-byte-array" resolve-label
343 ! Add byte array address to address being computed
344 dst dst scratch-reg ADD
345 ! Add an offset to start of byte array's data area
346 dst dst byte-array-offset ADDI
350 : alien@ ( n -- n' ) cells object tag-number - ;
352 :: %allot-alien ( dst displacement base temp -- )
353 dst 4 cells alien temp %allot
354 temp \ f tag-number %load-immediate
355 ! Store underlying-alien slot
356 base dst 1 alien@ STW
358 temp dst 2 alien@ STW
360 displacement dst 3 alien@ STW ;
362 M:: ppc %box-alien ( dst src temp -- )
365 dst \ f tag-number %load-immediate
368 dst src temp temp %allot-alien
372 M:: ppc %box-displaced-alien ( dst displacement base displacement' base' base-class -- )
376 "simple-case" define-label
377 ! If displacement is zero, return the base
379 0 displacement 0 CMPI
381 ! Quickly use displacement' before its needed for real, as allot temporary
382 displacement' :> temp
383 dst 4 cells alien temp %allot
384 ! If base is already a displaced alien, unpack it
385 0 base \ f tag-number CMPI
386 "simple-case" get BEQ
387 temp base header-offset LWZ
388 0 temp alien type-number tag-fixnum CMPI
389 "simple-case" get BNE
390 ! displacement += base.displacement
391 temp base 3 alien@ LWZ
392 displacement' displacement temp ADD
394 base' base 1 alien@ LWZ
396 "simple-case" resolve-label
397 displacement' displacement MR
399 "alloc" resolve-label
400 ! Store underlying-alien slot
401 base' dst 1 alien@ STW
403 displacement' dst 3 alien@ STW
404 ! Store expired slot (its ok to clobber displacement')
405 temp \ f tag-number %load-immediate
406 temp dst 2 alien@ STW
410 M: ppc %alien-unsigned-1 0 LBZ ;
411 M: ppc %alien-unsigned-2 0 LHZ ;
413 M: ppc %alien-signed-1 dupd 0 LBZ dup EXTSB ;
414 M: ppc %alien-signed-2 0 LHA ;
416 M: ppc %alien-cell 0 LWZ ;
418 M: ppc %alien-float 0 LFS ;
419 M: ppc %alien-double 0 LFD ;
421 M: ppc %set-alien-integer-1 swap 0 STB ;
422 M: ppc %set-alien-integer-2 swap 0 STH ;
424 M: ppc %set-alien-cell swap 0 STW ;
426 M: ppc %set-alien-float swap 0 STFS ;
427 M: ppc %set-alien-double swap 0 STFD ;
429 : load-zone-ptr ( reg -- )
430 "nursery" %load-vm-field-addr ;
432 : load-allot-ptr ( nursery-ptr allot-ptr -- )
433 [ drop load-zone-ptr ] [ swap 4 LWZ ] 2bi ;
435 :: inc-allot-ptr ( nursery-ptr allot-ptr n -- )
436 scratch-reg allot-ptr n 8 align ADDI
437 scratch-reg nursery-ptr 4 STW ;
439 :: store-header ( dst class -- )
440 class type-number tag-fixnum scratch-reg LI
441 scratch-reg dst 0 STW ;
443 : store-tagged ( dst tag -- )
444 dupd tag-number ORI ;
446 M:: ppc %allot ( dst size class nursery-ptr -- )
447 nursery-ptr dst load-allot-ptr
448 nursery-ptr dst size inc-allot-ptr
449 dst class store-header
450 dst class store-tagged ;
452 : load-cards-offset ( dst -- )
453 [ "cards_offset" %load-vm-field-addr ] [ dup 0 LWZ ] bi ;
455 : load-decks-offset ( dst -- )
456 [ "decks_offset" %load-vm-field-addr ] [ dup 0 LWZ ] bi ;
458 M:: ppc %write-barrier ( src card# table -- )
459 card-mark scratch-reg LI
462 table load-cards-offset
463 src card# card-bits SRWI
464 table scratch-reg card# STBX
467 table load-decks-offset
468 src card# deck-bits SRWI
469 table scratch-reg card# STBX ;
471 M:: ppc %check-nursery ( label temp1 temp2 -- )
474 temp2 temp2 3 cells LWZ
475 ! add ALLOT_BUFFER_ZONE to here
476 temp1 temp1 1024 ADDI
481 M:: ppc %save-gc-root ( gc-root register -- )
482 register 1 gc-root gc-root@ STW ;
484 M:: ppc %load-gc-root ( gc-root register -- )
485 register 1 gc-root gc-root@ LWZ ;
487 M:: ppc %call-gc ( gc-root-count -- )
488 3 1 gc-root-base local@ ADDI
490 "inline_gc" f %alien-invoke ;
492 M: ppc %prologue ( n -- )
493 0 11 LOAD32 rc-absolute-ppc-2/2 rel-this
496 [ [ 1 1 ] dip neg ADDI ]
497 [ [ 11 1 ] dip xt-save STW ]
499 [ [ 11 1 ] dip next-save STW ]
500 [ [ 0 1 ] dip lr-save + STW ]
503 M: ppc %epilogue ( n -- )
504 #! At the end of each word that calls a subroutine, we store
505 #! the previous link register value in r0 by popping it off
506 #! the stack, set the link register to the contents of r0,
507 #! and jump to the link register.
508 [ [ 0 1 ] dip lr-save + LWZ ]
509 [ [ 1 1 ] dip ADDI ] bi
512 :: (%boolean) ( dst temp branch1 branch2 -- )
514 dst \ f tag-number %load-immediate
515 "end" get branch1 execute( label -- )
516 branch2 [ "end" get branch2 execute( label -- ) ] when
517 dst \ t %load-reference
518 "end" get resolve-label ; inline
520 :: %boolean ( dst cc temp -- )
521 cc negate-cc order-cc {
522 { cc< [ dst temp \ BLT f (%boolean) ] }
523 { cc<= [ dst temp \ BLE f (%boolean) ] }
524 { cc> [ dst temp \ BGT f (%boolean) ] }
525 { cc>= [ dst temp \ BGE f (%boolean) ] }
526 { cc= [ dst temp \ BEQ f (%boolean) ] }
527 { cc/= [ dst temp \ BNE f (%boolean) ] }
530 : (%compare) ( src1 src2 -- ) [ 0 ] dip CMP ; inline
531 : (%compare-imm) ( src1 src2 -- ) [ 0 ] 2dip CMPI ; inline
532 : (%compare-float-unordered) ( src1 src2 -- ) [ 0 ] dip FCMPU ; inline
533 : (%compare-float-ordered) ( src1 src2 -- ) [ 0 ] dip FCMPO ; inline
535 :: (%compare-float) ( src1 src2 cc compare -- branch1 branch2 )
537 { cc< [ src1 src2 \ compare execute( a b -- ) \ BLT f ] }
538 { cc<= [ src1 src2 \ compare execute( a b -- ) \ BLT \ BEQ ] }
539 { cc> [ src1 src2 \ compare execute( a b -- ) \ BGT f ] }
540 { cc>= [ src1 src2 \ compare execute( a b -- ) \ BGT \ BEQ ] }
541 { cc= [ src1 src2 \ compare execute( a b -- ) \ BEQ f ] }
542 { cc<> [ src1 src2 \ compare execute( a b -- ) \ BLT \ BGT ] }
543 { cc<>= [ src1 src2 \ compare execute( a b -- ) \ BNO f ] }
544 { cc/< [ src1 src2 \ compare execute( a b -- ) \ BGE f ] }
545 { cc/<= [ src1 src2 \ compare execute( a b -- ) \ BGT \ BO ] }
546 { cc/> [ src1 src2 \ compare execute( a b -- ) \ BLE f ] }
547 { cc/>= [ src1 src2 \ compare execute( a b -- ) \ BLT \ BO ] }
548 { cc/= [ src1 src2 \ compare execute( a b -- ) \ BNE f ] }
549 { cc/<> [ src1 src2 \ compare execute( a b -- ) \ BEQ \ BO ] }
550 { cc/<>= [ src1 src2 \ compare execute( a b -- ) \ BO f ] }
553 M: ppc %compare [ (%compare) ] 2dip %boolean ;
555 M: ppc %compare-imm [ (%compare-imm) ] 2dip %boolean ;
557 M:: ppc %compare-float-ordered ( dst src1 src2 cc temp -- )
558 src1 src2 cc negate-cc \ (%compare-float-ordered) (%compare-float) :> branch2 :> branch1
559 dst temp branch1 branch2 (%boolean) ;
561 M:: ppc %compare-float-unordered ( dst src1 src2 cc temp -- )
562 src1 src2 cc negate-cc \ (%compare-float-unordered) (%compare-float) :> branch2 :> branch1
563 dst temp branch1 branch2 (%boolean) ;
565 :: %branch ( label cc -- )
567 { cc< [ label BLT ] }
568 { cc<= [ label BLE ] }
569 { cc> [ label BGT ] }
570 { cc>= [ label BGE ] }
571 { cc= [ label BEQ ] }
572 { cc/= [ label BNE ] }
575 M:: ppc %compare-branch ( label src1 src2 cc -- )
579 M:: ppc %compare-imm-branch ( label src1 src2 cc -- )
580 src1 src2 (%compare-imm)
583 :: (%branch) ( label branch1 branch2 -- )
584 label branch1 execute( label -- )
585 branch2 [ label branch2 execute( label -- ) ] when ; inline
587 M:: ppc %compare-float-ordered-branch ( label src1 src2 cc -- )
588 src1 src2 cc \ (%compare-float-ordered) (%compare-float) :> branch2 :> branch1
589 label branch1 branch2 (%branch) ;
591 M:: ppc %compare-float-unordered-branch ( label src1 src2 cc -- )
592 src1 src2 cc \ (%compare-float-unordered) (%compare-float) :> branch2 :> branch1
593 label branch1 branch2 (%branch) ;
595 : load-from-frame ( dst n rep -- )
597 { int-rep [ [ 1 ] dip LWZ ] }
598 { float-rep [ [ 1 ] dip LFS ] }
599 { double-rep [ [ 1 ] dip LFD ] }
600 { stack-params [ [ 0 1 ] dip LWZ [ 0 1 ] dip param@ STW ] }
603 : next-param@ ( n -- x ) param@ stack-frame get total-size>> + ;
605 : store-to-frame ( src n rep -- )
607 { int-rep [ [ 1 ] dip STW ] }
608 { float-rep [ [ 1 ] dip STFS ] }
609 { double-rep [ [ 1 ] dip STFD ] }
610 { stack-params [ [ [ 0 1 ] dip next-param@ LWZ 0 1 ] dip STW ] }
613 M: ppc %spill ( src rep n -- )
614 swap [ spill@ ] dip store-to-frame ;
616 M: ppc %reload ( dst rep n -- )
617 swap [ spill@ ] dip load-from-frame ;
621 M: int-regs return-reg drop 3 ;
622 M: int-regs param-regs drop { 3 4 5 6 7 8 9 10 } ;
623 M: float-regs return-reg drop 1 ;
625 M:: ppc %save-param-reg ( stack reg rep -- )
626 reg stack local@ rep store-to-frame ;
628 M:: ppc %load-param-reg ( stack reg rep -- )
629 reg stack local@ rep load-from-frame ;
631 M: ppc %prepare-unbox ( -- )
632 ! First parameter is top of stack
634 ds-reg dup cell SUBI ;
636 M: ppc %unbox ( n rep func -- )
637 ! Value must be in r3
640 ! Store the return value on the C stack
641 over [ [ reg-class-of return-reg ] keep %save-param-reg ] [ 2drop ] if ;
643 M: ppc %unbox-long-long ( n func -- )
644 ! Value must be in r3:r4
647 ! Store the return value on the C stack
649 [ [ 3 1 ] dip local@ STW ]
650 [ [ 4 1 ] dip cell + local@ STW ] bi
653 M: ppc %unbox-large-struct ( n c-type -- )
654 ! Value must be in r3
655 ! Compute destination address and load struct size
656 [ [ 4 1 ] dip local@ ADDI ] [ heap-size 5 LI ] bi*
658 "to_value_struct" f %alien-invoke ;
660 M: ppc %box ( n rep func -- )
661 ! If the source is a stack location, load it into freg #0.
662 ! If the source is f, then we assume the value is already in
664 [ over [ 0 over reg-class-of param-reg swap %load-param-reg ] [ 2drop ] if ] dip
667 M: ppc %box-long-long ( n func -- )
670 [ [ 3 1 ] dip local@ LWZ ]
671 [ [ 4 1 ] dip cell + local@ LWZ ] bi
673 ] dip f %alien-invoke ;
675 : struct-return@ ( n -- n )
676 [ stack-frame get params>> ] unless* local@ ;
678 M: ppc %prepare-box-struct ( -- )
679 #! Compute target address for value struct return
680 3 1 f struct-return@ ADDI
683 M: ppc %box-large-struct ( n c-type -- )
684 ! If n = f, then we're boxing a returned struct
685 ! Compute destination address and load struct size
686 [ [ 3 1 ] dip struct-return@ ADDI ] [ heap-size 4 LI ] bi*
688 "box_value_struct" f %alien-invoke ;
690 M:: ppc %save-context ( temp1 temp2 callback-allowed? -- )
691 #! Save Factor stack pointers in case the C code calls a
692 #! callback which does a GC, which must reliably trace
694 temp1 "stack_chain" %load-vm-field-addr
702 M: ppc %alien-invoke ( symbol dll -- )
703 [ 11 ] 2dip %alien-global 11 MTLR BLRL ;
705 M: ppc %alien-callback ( quot -- )
706 3 swap %load-reference "c_to_factor" f %alien-invoke ;
708 M: ppc %prepare-alien-indirect ( -- )
709 "unbox_alien" f %alien-invoke
712 M: ppc %alien-indirect ( -- )
715 M: ppc %callback-value ( ctype -- )
716 ! Save top of data stack
719 ! Restore data/call/retain stacks
720 "unnest_stacks" f %alien-invoke
721 ! Restore top of data stack
723 ! Unbox former top of data stack to return registers
726 M: ppc small-enough? ( n -- ? ) -32768 32767 between? ;
728 M: ppc return-struct-in-registers? ( c-type -- ? )
729 c-type return-in-registers?>> ;
731 M: ppc %box-small-struct ( c-type -- )
732 #! Box a <= 16-byte struct returned in r3:r4:r5:r6
734 "box_medium_struct" f %alien-invoke ;
736 : %unbox-struct-1 ( -- )
737 ! Alien must be in r3.
738 "alien_offset" f %alien-invoke
741 : %unbox-struct-2 ( -- )
742 ! Alien must be in r3.
743 "alien_offset" f %alien-invoke
747 : %unbox-struct-4 ( -- )
748 ! Alien must be in r3.
749 "alien_offset" f %alien-invoke
755 M: ppc %unbox-small-struct ( size -- )
756 #! Alien must be in EAX.
757 heap-size cell align cell /i {
758 { 1 [ %unbox-struct-1 ] }
759 { 2 [ %unbox-struct-2 ] }
760 { 4 [ %unbox-struct-4 ] }
763 enable-float-functions
768 { [ os macosx? ] [ "cpu.ppc.macosx" require ] }
769 { [ os linux? ] [ "cpu.ppc.linux" require ] }
772 "complex-double" c-type t >>return-in-registers? drop
776 [ alien-unsigned-4 c-bool> ] >>getter
777 [ [ >c-bool ] 2dip set-alien-unsigned-4 ] >>setter
780 "box_boolean" >>boxer
781 "to_boolean" >>unboxer
782 "bool" define-primitive-type
783 ] with-compilation-unit