1 ! Copyright (C) 2020 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: bootstrap.image.private compiler.codegen.relocation
4 compiler.constants compiler.units cpu.arm.assembler
5 cpu.arm.assembler.opcodes generic.single.private
6 kernel kernel.private layouts locals.backend
7 math math.private memory namespaces sequences slots.private
8 strings.private threads.private vocabs ;
9 IN: bootstrap.assembler.arm
16 ! https://docs.microsoft.com/en-us/cpp/build/arm64-exception-handling?view=vs-2019
18 ! x0 Volatile Parameter/scratch register 1, result register
19 ! x1-x7 Volatile Parameter/scratch register 2-8
20 ! x8-x15 Volatile Scratch registers
21 ! x16-x17 Volatile Intra-procedure-call scratch registers
22 ! x18 Non-volatile Platform register: in kernel mode, points to KPCR for the current processor;
23 ! in user mode, points to TEB
24 ! x19-x28 Non-volatile Scratch registers
25 ! x29/fp Non-volatile Frame pointer
26 ! x30/lr Non-volatile Link registers
28 : stack-frame-size ( -- n ) 4 bootstrap-cells ;
29 : volatile-regs ( -- seq ) { X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 } ;
30 : nv-regs ( -- seq ) { X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 } ;
32 ! callee-save = non-volatile aka call-preserved
34 ! x30 is the link register (used to return from subroutines)
35 ! x29 is the frame register
36 ! x19 to x29 are callee-saved
37 ! x18 is the 'platform register', used for some operating-system-specific special purpose,
38 ! or an additional caller-saved register
39 ! x16 and x17 are the Intra-Procedure-call scratch register
40 ! x9 to x15: used to hold local variables (caller saved)
41 ! x8: used to hold indirect return value address
42 ! x0 to x7: used to hold argument values passed to a subroutine, and also hold
43 ! results returned from a subroutine
46 ! https://en.wikichip.org/wiki/arm/aarch64
47 ! Generally, X0 through X18 can corrupt while X19-X29 must be preserved
48 ! Register Role Requirement
49 ! X0 - X7 Parameter/result registers Can Corrupt
50 ! X8 Indirect result location register
51 ! X9 - X15 Temporary registers
52 ! X16 - X17 Intra-procedure call temporary
53 ! X18 Platform register, otherwise temporary, DONT USE
55 ! X19 - X29 Callee-saved register Must preserve
56 ! X29 - frame pointer register, must always be valid
57 ! X30 Link Register Can Corrupt
58 ! 16-byte stack alignment
60 : arg1 ( -- reg ) X0 ;
61 : arg2 ( -- reg ) X1 ;
62 : arg3 ( -- reg ) X2 ;
63 : arg4 ( -- reg ) X3 ;
64 : red-zone-size ( -- n ) 128 ;
66 : shift-arg ( -- reg ) X1 ;
67 : div-arg ( -- reg ) X0 ;
68 : mod-arg ( -- reg ) X2 ;
70 ! caller-saved registers X9-X15
71 ! callee-saved registers X19-X29
72 : temp0 ( -- reg ) X9 ;
73 : temp1 ( -- reg ) X10 ;
74 : temp2 ( -- reg ) X11 ;
75 : temp3 ( -- reg ) X12 ;
79 ! : pic-tail-reg ( -- reg ) RBX ;
80 : return-reg ( -- reg ) X0 ;
81 ! : nv-reg ( -- reg ) RBX ;
82 ! : stack-reg ( -- reg ) RSP ;
83 ! : frame-reg ( -- reg ) RBP ;
84 ! : link-reg ( -- reg ) R11 ;
85 ! : ctx-reg ( -- reg ) R12 ;
86 : vm-reg ( -- reg ) X7 ;
87 : ds-reg ( -- reg ) X5 ;
88 : rs-reg ( -- reg ) X6 ;
89 ! : fixnum>slot@ ( -- ) temp0 1 SAR ;
90 ! : rex-length ( -- n ) 1 ;
92 ! rc-absolute-cell is just CONSTANT: 0
93 : jit-call ( name -- )
95 f rc-absolute-cell rel-dlsym
97 ! RAX 0 MOV f rc-absolute-cell rel-dlsym
100 :: jit-call-1arg ( arg1s name -- )
106 :: jit-call-2arg ( arg1s arg2s name -- )
115 ! pic-tail-reg 5 [RIP+] LEA
116 ! 0 JMP f rc-relative rel-word-pic-tail
117 ] JIT-WORD-JUMP jit-define
120 ! no-op on x86-64. in factor contexts vm-reg always contains the
124 : jit-load-context ( -- ) ;
125 ! ctx-reg vm-reg vm-context-offset [+] MOV ;
127 : jit-save-context ( -- ) ;
129 ! The reason for -8 I think is because we are anticipating a CALL
130 ! instruction. After the call instruction, the contexts frame_top
131 ! will point to the origin jump address.
133 ! ctx-reg context-callstack-top-offset [+] R11 MOV
134 ! ctx-reg context-datastack-offset [+] ds-reg MOV
135 ! ctx-reg context-retainstack-offset [+] rs-reg MOV ;
137 ! ctx-reg must already have been loaded
138 : jit-restore-context ( -- ) ;
139 ! ds-reg ctx-reg context-datastack-offset [+] MOV
140 ! rs-reg ctx-reg context-retainstack-offset [+] MOV ;
144 ! ! ctx-reg is preserved across the call because it is non-volatile
147 ! ! call the primitive
149 ! RAX 0 MOV f f rc-absolute-cell rel-dlsym
151 ! jit-restore-context
152 ] JIT-PRIMITIVE jit-define
155 : jit-jump-quot ( -- ) ;
156 ! arg1 quot-entry-point-offset [+] JMP ;
158 : jit-call-quot ( -- )
159 quot-entry-point-offset arg1 ADR
162 ! arg1 quot-entry-point-offset [+] CALL ;
164 : signal-handler-save-regs ( -- regs ) { } ;
165 ! { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 } ;
169 ! temp2 0 MOV f rc-absolute-cell rel-literal
171 ] PIC-CHECK-TUPLE jit-define
176 1 bootstrap-cells rs-reg rs-reg ADDi64
177 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
180 1 bootstrap-cells ds-reg ds-reg ADDi64
181 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
184 1 bootstrap-cells rs-reg rs-reg ADDi64
185 -1 bootstrap-cells ds-reg rs-reg LDR-post
186 1 bootstrap-cells rs-reg rs-reg ADDi64
187 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
190 1 bootstrap-cells ds-reg ds-reg ADDi64
191 -1 bootstrap-cells rs-reg ds-reg LDR-post
192 1 bootstrap-cells ds-reg ds-reg ADDi64
193 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
196 1 bootstrap-cells rs-reg rs-reg ADDi64
197 -1 bootstrap-cells ds-reg rs-reg LDR-post
198 1 bootstrap-cells rs-reg rs-reg ADDi64
199 -1 bootstrap-cells ds-reg rs-reg LDR-post
200 1 bootstrap-cells rs-reg rs-reg ADDi64
201 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
204 1 bootstrap-cells ds-reg ds-reg ADDi64
205 -1 bootstrap-cells rs-reg ds-reg LDR-post
206 1 bootstrap-cells ds-reg ds-reg ADDi64
207 -1 bootstrap-cells rs-reg ds-reg LDR-post
208 1 bootstrap-cells ds-reg ds-reg ADDi64
209 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
212 : jit-switch-context ( reg -- ) drop ;
213 ! ! Push a bogus return address so the GC can track this frame back
217 ! ! Make the new context the current one
219 ! vm-reg vm-context-offset [+] ctx-reg MOV
221 ! ! Load new stack pointer
222 ! RSP ctx-reg context-callstack-top-offset [+] MOV
224 ! ! Load new ds, rs registers
225 ! jit-restore-context
227 ! ctx-reg jit-update-tib ;
229 : jit-pop-context-and-param ( -- ) ;
231 ! arg1 arg1 alien-offset [+] MOV
232 ! arg2 ds-reg -8 [+] MOV
235 : jit-push-param ( -- ) ;
237 ! ds-reg [] arg2 MOV ;
239 : jit-set-context ( -- ) ;
240 ! jit-pop-context-and-param
242 ! arg1 jit-switch-context
246 : jit-pop-quot-and-param ( -- ) ;
248 ! arg2 ds-reg -8 [+] MOV
251 : jit-start-context ( -- ) ;
252 ! Create the new context in return-reg. Have to save context
253 ! twice, first before calling new_context() which may GC,
254 ! and again after popping the two parameters from the stack.
256 ! vm-reg "new_context" jit-call-1arg
258 ! jit-pop-quot-and-param
260 ! return-reg jit-switch-context
264 : jit-delete-current-context ( -- ) ;
265 ! vm-reg "delete_context" jit-call-1arg ;
269 ! 0 CALL f rc-relative rel-word
277 ! 0 [RIP+] EAX MOV rc-relative rel-safepoint
278 ] JIT-SAFEPOINT jit-define
280 ! # All arm.64 subprimitives
284 ! { (set-context) [ jit-set-context ] }
285 ! { (set-context-and-delete) [
286 ! jit-delete-current-context
289 ! { (start-context) [ jit-start-context ] }
290 ! { (start-context-and-delete) [ jit-start-context-and-delete ] }
296 ! vm-reg "begin_callback" jit-call-1arg
298 ! ! call the quotation
299 ! arg1 return-reg MOV
302 ! vm-reg "end_callback" jit-call-1arg
321 ! vm-reg "begin_callback" jit-call-1arg
323 ! return-reg arg1 MOVr64 ! arg1 is return
326 ! vm-reg "end_callback" jit-call-1arg
331 ! { unwind-native-frames [ ] }
334 ! { fixnum+ [ [ ADD ] "overflow_fixnum_add" jit-overflow ] }
335 ! { fixnum- [ [ SUB ] "overflow_fixnum_subtract" jit-overflow ] }
340 ! RBX ds-reg 8 [+] MOV
341 ! RBX tag-bits get SAR
348 ! arg1 tag-bits get SAR
351 ! "overflow_fixnum_multiply" jit-call
366 ! RSP [] arg1 16-bit-version-of MOV
371 ! ! Load callstack object
373 ! ds-reg bootstrap-cell SUB
374 ! ! Get ctx->callstack_bottom
376 ! arg1 ctx-reg context-callstack-bottom-offset [+] MOV
377 ! ! Get top of callstack object -- 'src' for memcpy
378 ! arg2 arg4 callstack-top-offset [+] LEA
379 ! ! Get callstack length, in bytes --- 'len' for memcpy
380 ! arg3 arg4 callstack-length-offset [+] MOV
381 ! arg3 tag-bits get SHR
382 ! ! Compute new stack pointer -- 'dst' for memcpy
384 ! ! Install new stack pointer
386 ! ! Call memcpy; arguments are now in the correct registers
387 ! ! Create register shadow area for Win64
389 ! "factor_memcpy" jit-call
390 ! ! Tear down register shadow area
392 ! ! Return with new callstack
395 } define-sub-primitives
399 ! C to Factor entry point
401 ! ! Optimizing compiler's side of callback accesses
402 ! ! arguments that are on the stack via the frame pointer.
403 ! ! On x86-32 fastcall, and x86-64, some arguments are passed
404 ! ! in registers, and so the only registers that are safe for
405 ! ! use here are frame-reg, nv-reg and vm-reg.
407 ! frame-reg stack-reg MOV
409 ! ! Save all non-volatile registers
410 ! nv-regs [ PUSH ] each
414 ! ! Load VM into vm-reg
415 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
418 ! nv-reg vm-reg vm-context-offset [+] MOV
421 ! ! Switch over to the spare context
422 ! nv-reg vm-reg vm-spare-context-offset [+] MOV
423 ! vm-reg vm-context-offset [+] nv-reg MOV
425 ! ! Save C callstack pointer
426 ! nv-reg context-callstack-save-offset [+] stack-reg MOV
428 ! ! Load Factor stack pointers
429 ! stack-reg nv-reg context-callstack-bottom-offset [+] MOV
430 ! nv-reg jit-update-tib
433 ! rs-reg nv-reg context-retainstack-offset [+] MOV
434 ! ds-reg nv-reg context-datastack-offset [+] MOV
436 ! ! Call into Factor code
437 ! link-reg 0 MOV f rc-absolute-cell rel-word
440 ! ! Load VM into vm-reg; only needed on x86-32, but doesn't
442 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
444 ! ! Load C callstack pointer
445 ! nv-reg vm-reg vm-context-offset [+] MOV
446 ! stack-reg nv-reg context-callstack-save-offset [+] MOV
450 ! vm-reg vm-context-offset [+] nv-reg MOV
452 ! ! Restore non-volatile registers
455 ! nv-regs <reversed> [ POP ] each
459 ! ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
460 ! ! need a parameter here.
462 ! ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
463 ! 0xffff RET f rc-absolute-2 rel-untagged
464 ] CALLBACK-STUB jit-define
468 ! temp0 0 MOV f rc-absolute-cell rel-literal
469 ! ! increment datastack pointer
470 ! ds-reg bootstrap-cell ADD
471 ! ! store literal on datastack
472 ! ds-reg [] temp0 MOV
473 ] JIT-PUSH-LITERAL jit-define
476 ! 0 CALL f rc-relative rel-word-pic
477 ] JIT-WORD-CALL jit-define
479 ! The *-signal-handler subprimitives are special-cased in vm/quotations.cpp
480 ! not to trigger generation of a stack frame, so they can
481 ! peform their own prolog/epilog preserving registers.
483 ! It is important that the total is 192/64 and that it matches the
484 ! constants in vm/cpu-x86.*.hpp
485 : jit-signal-handler-prolog ( -- ) ;
486 ! ! Return address already on stack -> 8/4 bytes.
488 ! ! Push all registers. 15 regs/120 bytes on 64bit, 7 regs/28 bytes
489 ! ! on 32bit -> 128/32 bytes.
490 ! signal-handler-save-regs [ PUSH ] each
492 ! ! Push flags -> 136/36 bytes
495 ! ! Register parameter area 32 bytes, unused on platforms other than
496 ! ! windows 64 bit, but including it doesn't hurt. Plus
497 ! ! alignment. LEA used so we don't dirty flags -> 192/64 bytes.
498 ! stack-reg stack-reg 7 bootstrap-cells neg [+] LEA
502 : jit-signal-handler-epilog ( -- ) ;
503 ! stack-reg stack-reg 7 bootstrap-cells [+] LEA
505 ! signal-handler-save-regs reverse [ POP ] each ;
509 ! temp0 ds-reg [] MOV
511 ! ds-reg bootstrap-cell SUB
512 ! ! compare boolean with f
513 ! temp0 \ f type-number CMP
514 ! ! jump to true branch if not equal
515 ! 0 JNE f rc-relative rel-word
516 ! ! jump to false branch if equal
517 ! 0 JMP f rc-relative rel-word
523 ! 0 CALL f rc-relative rel-word
529 ! 0 CALL f rc-relative rel-word
531 ] JIT-2DIP jit-define
535 ! 0 CALL f rc-relative rel-word
537 ] JIT-3DIP jit-define
541 ! temp0 ds-reg [] MOV
543 ! ds-reg bootstrap-cell SUB
545 ! [ temp0 word-entry-point-offset [+] CALL ]
546 ! [ temp0 word-entry-point-offset [+] JMP ]
547 ! \ (execute) define-combinator-primitive
550 ! temp0 ds-reg [] MOV
551 ! ds-reg bootstrap-cell SUB
552 ! temp0 word-entry-point-offset [+] JMP
553 ] JIT-EXECUTE jit-define
556 ! stack-reg stack-frame-size bootstrap-cell - SUB
557 ] JIT-PROLOG jit-define
560 ! stack-reg stack-frame-size bootstrap-cell - ADD
561 ] JIT-EPILOG jit-define
565 ] JIT-RETURN jit-define
567 ! ! ! Polymorphic inline caches
569 ! The PIC stubs are not permitted to touch pic-tail-reg.
571 ! Load a value from a stack position
573 ! temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
574 ] PIC-LOAD jit-define
577 ! temp1/32 tag-mask get AND
582 ! temp1/32 tag-mask get AND
583 ! temp1/32 tuple type-number CMP
585 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
587 ] PIC-TUPLE jit-define
590 ! temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
591 ] PIC-CHECK-TAG jit-define
594 ! 0 JE f rc-relative rel-word
597 ! ! ! Megamorphic caches
602 ! temp1/32 tag-mask get AND
603 ! temp1/32 tag-bits get SHL
604 ! temp1/32 tuple type-number tag-fixnum CMP
606 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
609 ! temp0 0 MOV f rc-absolute-cell rel-literal
610 ! ! key = hashcode(class)
612 ! bootstrap-cell 4 = [ temp2 1 SHR ] when
613 ! ! key &= cache.length - 1
614 ! temp2 mega-cache-size get 1 - bootstrap-cell * AND
615 ! ! cache += array-start-offset
616 ! temp0 array-start-offset ADD
619 ! ! if(get(cache) == class)
623 ! ! megamorphic_cache_hits++
624 ! temp1 0 MOV rc-absolute-cell rel-megamorphic-cache-hits
626 ! ! goto get(cache + bootstrap-cell)
627 ! temp0 temp0 bootstrap-cell [+] MOV
628 ! temp0 word-entry-point-offset [+] JMP
629 ! ! fall-through on miss
631 ] MEGA-LOOKUP jit-define
634 : jit-compare ( insn -- ) drop ;
636 ! temp3 0 MOV t rc-absolute-cell rel-literal
638 ! temp1 \ f type-number MOV
640 ! temp0 ds-reg [] MOV
641 ! ! adjust stack pointer
642 ! ds-reg bootstrap-cell SUB
643 ! ! compare with second value
644 ! ds-reg [] temp0 CMP
646 ! [ temp1 temp3 ] dip execute( dst src -- )
648 ! ds-reg [] temp1 MOV ;
651 : jit-math ( insn -- ) drop ;
652 ! ! load second input
653 ! temp0 ds-reg [] MOV
655 ! ds-reg bootstrap-cell SUB
657 ! [ ds-reg [] temp0 ] dip execute( dst src -- ) ;
659 : jit-fixnum-/mod ( -- ) ;
660 ! ! load second parameter
661 ! temp1 ds-reg [] MOV
662 ! ! load first parameter
663 ! div-arg ds-reg bootstrap-cell neg [+] MOV
665 ! mod-arg div-arg MOV
667 ! mod-arg bootstrap-cell-bits 1 - SAR
671 ! # Rest of arm64 subprimitives
676 ! { fixnum+fast [ \ ADD jit-math ] }
679 ! { fixnum-bitand [ \ AND jit-math ] }
684 ! ds-reg [] tag-mask get XOR
686 ! { fixnum-bitor [ \ OR jit-math ] }
687 ! { fixnum-bitxor [ \ XOR jit-math ] }
688 ! { fixnum-shift-fast [
690 ! shift-arg ds-reg [] MOV
691 ! ! untag shift count
692 ! shift-arg tag-bits get SAR
693 ! ! adjust stack pointer
694 ! ds-reg bootstrap-cell SUB
696 ! temp3 ds-reg [] MOV
699 ! ! compute positive shift value in temp2
702 ! ! compute negative shift value in temp3
704 ! temp3 tag-mask get bitnot AND
706 ! ! if shift count was negative, move temp0 to temp2
709 ! ds-reg [] temp2 MOV
714 ! temp0 ds-reg [] MOV
715 ! ds-reg bootstrap-cell SUB
717 ! temp0 tag-mask get TEST
718 ! temp0 \ f type-number MOV
719 ! temp1 1 tag-fixnum MOV
721 ! ds-reg [] temp0 MOV
723 ! { eq? [ \ CMOVE jit-compare ] }
724 ! { fixnum> [ \ CMOVG jit-compare ] }
725 ! { fixnum>= [ \ CMOVGE jit-compare ] }
726 ! { fixnum< [ \ CMOVL jit-compare ] }
727 ! { fixnum<= [ \ CMOVLE jit-compare ] }
732 ! ! adjust stack pointer
733 ! ds-reg bootstrap-cell SUB
735 ! ds-reg [] mod-arg MOV
739 ! ! adjust stack pointer
740 ! ds-reg bootstrap-cell SUB
742 ! div-arg tag-bits get SHL
744 ! ds-reg [] div-arg MOV
746 ! { fixnum/mod-fast [
749 ! div-arg tag-bits get SHL
751 ! ds-reg [] mod-arg MOV
752 ! ds-reg bootstrap-cell neg [+] div-arg MOV
757 ! ! load second input
758 ! temp0 ds-reg [] MOV
760 ! ds-reg bootstrap-cell SUB
762 ! temp1 ds-reg [] MOV
763 ! ! untag second input
764 ! temp0 tag-bits get SAR
768 ! ds-reg [] temp0 MOV
772 ! { fixnum-fast [ \ SUB jit-math ] }
777 ! temp0 ds-reg [] MOV
778 ! ! adjust stack pointer
779 ! ds-reg bootstrap-cell SUB
780 ! ! turn local number into offset
782 ! ! decrement retain stack pointer
786 ! ! load local number
787 ! temp0 ds-reg [] MOV
788 ! ! turn local number into offset
791 ! temp0 rs-reg temp0 [+] MOV
793 ! ds-reg [] temp0 MOV
795 ! { load-local [ jit->r ] }
800 ! temp0 ds-reg [] MOV
801 ! ! adjust stack pointer
802 ! ds-reg bootstrap-cell SUB
804 ! temp1 ds-reg [] MOV
805 ! ! turn slot number into offset
808 ! temp1 tag-bits get SHR
809 ! temp1 tag-bits get SHL
811 ! temp0 temp1 temp0 [+] MOV
813 ! ds-reg [] temp0 MOV
815 ! { string-nth-fast [
816 ! ! load string index from stack
817 ! temp0 ds-reg bootstrap-cell neg [+] MOV
818 ! temp0 tag-bits get SHR
819 ! ! load string from stack
820 ! temp1 ds-reg [] MOV
822 ! temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
823 ! temp0 temp0 8-bit-version-of MOVZX
824 ! temp0 tag-bits get SHL
825 ! ! store character to stack
826 ! ds-reg bootstrap-cell SUB
827 ! ds-reg [] temp0 MOV
831 ! temp0 ds-reg [] MOV
833 ! temp0/32 tag-mask get AND
835 ! temp0/32 tag-bits get SHL
837 ! ds-reg [] temp0 MOV
843 ! { drop [ ds-reg bootstrap-cell SUB ] }
844 ! { 2drop [ ds-reg 2 bootstrap-cells SUB ] }
845 ! { 3drop [ ds-reg 3 bootstrap-cells SUB ] }
846 ! { 4drop [ ds-reg 4 bootstrap-cells SUB ] }
850 ! temp0 ds-reg [] MOV
851 ! ds-reg bootstrap-cell ADD
852 ! ds-reg [] temp0 MOV
855 ! temp0 ds-reg [] MOV
856 ! temp1 ds-reg bootstrap-cell neg [+] MOV
857 ! ds-reg 2 bootstrap-cells ADD
858 ! ds-reg [] temp0 MOV
859 ! ds-reg bootstrap-cell neg [+] temp1 MOV
862 ! temp0 ds-reg [] MOV
863 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
864 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
865 ! ds-reg 3 bootstrap-cells ADD
866 ! ds-reg [] temp0 MOV
867 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
868 ! ds-reg -2 bootstrap-cells [+] temp3 MOV
871 ! temp0 ds-reg [] MOV
872 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
873 ! temp2 ds-reg -2 bootstrap-cells [+] MOV
874 ! temp3 ds-reg -3 bootstrap-cells [+] MOV
875 ! ds-reg 4 bootstrap-cells ADD
876 ! ds-reg [] temp0 MOV
877 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
878 ! ds-reg -2 bootstrap-cells [+] temp2 MOV
879 ! ds-reg -3 bootstrap-cells [+] temp3 MOV
882 ! temp0 ds-reg [] MOV
883 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
884 ! ds-reg [] temp1 MOV
885 ! ds-reg bootstrap-cell ADD
886 ! ds-reg [] temp0 MOV
889 ! ! ### Misc shufflers
891 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
892 ! ds-reg bootstrap-cell ADD
893 ! ds-reg [] temp0 MOV
896 ! temp0 ds-reg -2 bootstrap-cells [+] MOV
897 ! ds-reg bootstrap-cell ADD
898 ! ds-reg [] temp0 MOV
903 ! temp0 ds-reg [] MOV
904 ! ds-reg bootstrap-cell SUB
905 ! ds-reg [] temp0 MOV
908 ! temp0 ds-reg [] MOV
909 ! ds-reg 2 bootstrap-cells SUB
910 ! ds-reg [] temp0 MOV
915 ! temp0 ds-reg [] MOV
916 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
917 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
918 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
919 ! ds-reg -1 bootstrap-cells [+] temp3 MOV
920 ! ds-reg [] temp1 MOV
923 ! temp0 ds-reg [] MOV
924 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
925 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
926 ! ds-reg -2 bootstrap-cells [+] temp1 MOV
927 ! ds-reg -1 bootstrap-cells [+] temp0 MOV
928 ! ds-reg [] temp3 MOV
931 ! temp0 ds-reg [] MOV
932 ! temp1 ds-reg bootstrap-cell neg [+] MOV
933 ! ds-reg bootstrap-cell neg [+] temp0 MOV
934 ! ds-reg [] temp1 MOV
937 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
938 ! temp1 ds-reg -2 bootstrap-cells [+] MOV
939 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
940 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
943 ! ! ## Signal handling
944 ! { leaf-signal-handler [
945 ! jit-signal-handler-prolog
947 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
949 ! jit-signal-handler-epilog
950 ! ! Pop the fake leaf frame along with our return address
951 ! leaf-stack-frame-size bootstrap-cell - RET
954 ! jit-signal-handler-prolog
956 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
958 ! jit-signal-handler-epilog
961 } define-sub-primitives
963 [ "bootstrap.arm.64" forget-vocab ] with-compilation-unit