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 : stack-reg ( -- reg ) SP ;
82 ! : link-reg ( -- reg ) R11 ;
83 ! : ctx-reg ( -- reg ) R12 ;
84 : vm-reg ( -- reg ) X28 ;
85 : ds-reg ( -- reg ) X27 ;
86 : rs-reg ( -- reg ) X26 ;
87 ! : fixnum>slot@ ( -- ) temp0 1 SAR ;
88 ! : rex-length ( -- n ) 1 ;
90 ! rc-absolute-cell is just CONSTANT: 0
91 : jit-call ( name -- )
93 f rc-absolute-cell rel-dlsym
95 ! RAX 0 MOV f rc-absolute-cell rel-dlsym
98 :: jit-call-1arg ( arg1s name -- )
104 :: jit-call-2arg ( arg1s arg2s name -- )
113 ! pic-tail-reg 5 [RIP+] LEA
114 ! 0 JMP f rc-relative rel-word-pic-tail
115 ] JIT-WORD-JUMP jit-define
118 ! no-op on x86-64. in factor contexts vm-reg always contains the
122 : jit-load-context ( -- ) ;
123 ! ctx-reg vm-reg vm-context-offset [+] MOV ;
125 : jit-save-context ( -- ) ;
127 ! The reason for -8 I think is because we are anticipating a CALL
128 ! instruction. After the call instruction, the contexts frame_top
129 ! will point to the origin jump address.
131 ! ctx-reg context-callstack-top-offset [+] R11 MOV
132 ! ctx-reg context-datastack-offset [+] ds-reg MOV
133 ! ctx-reg context-retainstack-offset [+] rs-reg MOV ;
135 ! ctx-reg must already have been loaded
136 : jit-restore-context ( -- ) ;
137 ! ds-reg ctx-reg context-datastack-offset [+] MOV
138 ! rs-reg ctx-reg context-retainstack-offset [+] MOV ;
142 ! ! ctx-reg is preserved across the call because it is non-volatile
145 ! ! call the primitive
147 ! RAX 0 MOV f f rc-absolute-cell rel-dlsym
149 ! jit-restore-context
150 ] JIT-PRIMITIVE jit-define
153 : jit-jump-quot ( -- )
154 quot-entry-point-offset arg1 ADR
156 ! arg1 quot-entry-point-offset [+] JMP ;
158 : jit-call-quot ( -- )
159 quot-entry-point-offset arg1 ADR
161 ! arg1 quot-entry-point-offset [+] CALL ;
163 : signal-handler-save-regs ( -- regs ) { } ;
164 ! { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 } ;
168 ! temp2 0 MOV f rc-absolute-cell rel-literal
170 ] PIC-CHECK-TUPLE jit-define
175 1 bootstrap-cells rs-reg rs-reg ADDi64
176 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
179 1 bootstrap-cells ds-reg ds-reg ADDi64
180 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
183 1 bootstrap-cells rs-reg rs-reg ADDi64
184 -1 bootstrap-cells ds-reg rs-reg LDR-post
185 1 bootstrap-cells rs-reg rs-reg ADDi64
186 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
189 1 bootstrap-cells ds-reg ds-reg ADDi64
190 -1 bootstrap-cells rs-reg ds-reg LDR-post
191 1 bootstrap-cells ds-reg ds-reg ADDi64
192 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
195 1 bootstrap-cells rs-reg rs-reg ADDi64
196 -1 bootstrap-cells ds-reg rs-reg LDR-post
197 1 bootstrap-cells rs-reg rs-reg ADDi64
198 -1 bootstrap-cells ds-reg rs-reg LDR-post
199 1 bootstrap-cells rs-reg rs-reg ADDi64
200 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
203 1 bootstrap-cells ds-reg ds-reg ADDi64
204 -1 bootstrap-cells rs-reg ds-reg LDR-post
205 1 bootstrap-cells ds-reg ds-reg ADDi64
206 -1 bootstrap-cells rs-reg ds-reg LDR-post
207 1 bootstrap-cells ds-reg ds-reg ADDi64
208 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
211 : jit-switch-context ( reg -- ) drop ;
212 ! ! Push a bogus return address so the GC can track this frame back
216 ! ! Make the new context the current one
218 ! vm-reg vm-context-offset [+] ctx-reg MOV
220 ! ! Load new stack pointer
221 ! RSP ctx-reg context-callstack-top-offset [+] MOV
223 ! ! Load new ds, rs registers
224 ! jit-restore-context
226 ! ctx-reg jit-update-tib ;
228 : jit-pop-context-and-param ( -- ) ;
230 ! arg1 arg1 alien-offset [+] MOV
231 ! arg2 ds-reg -8 [+] MOV
234 : jit-push-param ( -- ) ;
236 ! ds-reg [] arg2 MOV ;
238 : jit-set-context ( -- ) ;
239 ! jit-pop-context-and-param
241 ! arg1 jit-switch-context
245 : jit-pop-quot-and-param ( -- ) ;
247 ! arg2 ds-reg -8 [+] MOV
250 : jit-start-context ( -- ) ;
251 ! Create the new context in return-reg. Have to save context
252 ! twice, first before calling new_context() which may GC,
253 ! and again after popping the two parameters from the stack.
255 ! vm-reg "new_context" jit-call-1arg
257 ! jit-pop-quot-and-param
259 ! return-reg jit-switch-context
263 : jit-delete-current-context ( -- ) ;
264 ! vm-reg "delete_context" jit-call-1arg ;
268 ! 0 CALL f rc-relative rel-word
276 ! 0 [RIP+] EAX MOV rc-relative rel-safepoint
277 ] JIT-SAFEPOINT jit-define
279 ! # All arm.64 subprimitives
295 ! Rn Rd MOVr64 ! comment
297 vm-reg "begin_callback" jit-call-1arg
299 return-reg arg1 MOVr64 ! arg1 is return
302 vm-reg "end_callback" jit-call-1arg
304 } define-sub-primitives
309 ! { (set-context) [ jit-set-context ] }
310 ! { (set-context-and-delete) [
311 ! jit-delete-current-context
314 ! { (start-context) [ jit-start-context ] }
315 ! { (start-context-and-delete) [ jit-start-context-and-delete ] }
321 ! ! vm-reg "begin_callback" jit-call-1arg
323 ! ! ! call the quotation
324 ! ! arg1 return-reg MOV
327 ! ! vm-reg "end_callback" jit-call-1arg
346 ! ! vm-reg "begin_callback" jit-call-1arg
348 ! ! return-reg arg1 MOVr64 ! arg1 is return
351 ! ! vm-reg "end_callback" jit-call-1arg
356 ! { unwind-native-frames [ ] }
359 ! { fixnum+ [ [ ADD ] "overflow_fixnum_add" jit-overflow ] }
360 ! { fixnum- [ [ SUB ] "overflow_fixnum_subtract" jit-overflow ] }
365 ! RBX ds-reg 8 [+] MOV
366 ! RBX tag-bits get SAR
373 ! arg1 tag-bits get SAR
376 ! "overflow_fixnum_multiply" jit-call
391 ! RSP [] arg1 16-bit-version-of MOV
396 ! ! Load callstack object
398 ! ds-reg bootstrap-cell SUB
399 ! ! Get ctx->callstack_bottom
401 ! arg1 ctx-reg context-callstack-bottom-offset [+] MOV
402 ! ! Get top of callstack object -- 'src' for memcpy
403 ! arg2 arg4 callstack-top-offset [+] LEA
404 ! ! Get callstack length, in bytes --- 'len' for memcpy
405 ! arg3 arg4 callstack-length-offset [+] MOV
406 ! arg3 tag-bits get SHR
407 ! ! Compute new stack pointer -- 'dst' for memcpy
409 ! ! Install new stack pointer
411 ! ! Call memcpy; arguments are now in the correct registers
412 ! ! Create register shadow area for Win64
414 ! "factor_memcpy" jit-call
415 ! ! Tear down register shadow area
417 ! ! Return with new callstack
420 ! } define-sub-primitives
424 ! C to Factor entry point
426 ! ! Optimizing compiler's side of callback accesses
427 ! ! arguments that are on the stack via the frame pointer.
428 ! ! On x86-32 fastcall, and x86-64, some arguments are passed
429 ! ! in registers, and so the only registers that are safe for
430 ! ! use here are frame-reg, nv-reg and vm-reg.
432 ! frame-reg stack-reg MOV
434 ! ! Save all non-volatile registers
435 ! nv-regs [ PUSH ] each
439 ! ! Load VM into vm-reg
440 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
443 ! nv-reg vm-reg vm-context-offset [+] MOV
446 ! ! Switch over to the spare context
447 ! nv-reg vm-reg vm-spare-context-offset [+] MOV
448 ! vm-reg vm-context-offset [+] nv-reg MOV
450 ! ! Save C callstack pointer
451 ! nv-reg context-callstack-save-offset [+] stack-reg MOV
453 ! ! Load Factor stack pointers
454 ! stack-reg nv-reg context-callstack-bottom-offset [+] MOV
455 ! nv-reg jit-update-tib
458 ! rs-reg nv-reg context-retainstack-offset [+] MOV
459 ! ds-reg nv-reg context-datastack-offset [+] MOV
461 ! ! Call into Factor code
462 ! link-reg 0 MOV f rc-absolute-cell rel-word
465 ! ! Load VM into vm-reg; only needed on x86-32, but doesn't
467 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
469 ! ! Load C callstack pointer
470 ! nv-reg vm-reg vm-context-offset [+] MOV
471 ! stack-reg nv-reg context-callstack-save-offset [+] MOV
475 ! vm-reg vm-context-offset [+] nv-reg MOV
477 ! ! Restore non-volatile registers
480 ! nv-regs <reversed> [ POP ] each
484 ! ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
485 ! ! need a parameter here.
487 ! ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
488 ! 0xffff RET f rc-absolute-2 rel-untagged
489 ] CALLBACK-STUB jit-define
493 ! temp0 0 MOV f rc-absolute-cell rel-literal
494 ! ! increment datastack pointer
495 ! ds-reg bootstrap-cell ADD
496 ! ! store literal on datastack
497 ! ds-reg [] temp0 MOV
498 ] JIT-PUSH-LITERAL jit-define
501 ! 0 CALL f rc-relative rel-word-pic
502 ] JIT-WORD-CALL jit-define
504 ! The *-signal-handler subprimitives are special-cased in vm/quotations.cpp
505 ! not to trigger generation of a stack frame, so they can
506 ! peform their own prolog/epilog preserving registers.
508 ! It is important that the total is 192/64 and that it matches the
509 ! constants in vm/cpu-x86.*.hpp
510 : jit-signal-handler-prolog ( -- ) ;
511 ! ! Return address already on stack -> 8/4 bytes.
513 ! ! Push all registers. 15 regs/120 bytes on 64bit, 7 regs/28 bytes
514 ! ! on 32bit -> 128/32 bytes.
515 ! signal-handler-save-regs [ PUSH ] each
517 ! ! Push flags -> 136/36 bytes
520 ! ! Register parameter area 32 bytes, unused on platforms other than
521 ! ! windows 64 bit, but including it doesn't hurt. Plus
522 ! ! alignment. LEA used so we don't dirty flags -> 192/64 bytes.
523 ! stack-reg stack-reg 7 bootstrap-cells neg [+] LEA
527 : jit-signal-handler-epilog ( -- ) ;
528 ! stack-reg stack-reg 7 bootstrap-cells [+] LEA
530 ! signal-handler-save-regs reverse [ POP ] each ;
534 ! temp0 ds-reg [] MOV
536 ! ds-reg bootstrap-cell SUB
537 ! ! compare boolean with f
538 ! temp0 \ f type-number CMP
539 ! ! jump to true branch if not equal
540 ! 0 JNE f rc-relative rel-word
541 ! ! jump to false branch if equal
542 ! 0 JMP f rc-relative rel-word
548 ! 0 CALL f rc-relative rel-word
554 ! 0 CALL f rc-relative rel-word
556 ] JIT-2DIP jit-define
560 ! 0 CALL f rc-relative rel-word
562 ] JIT-3DIP jit-define
566 ! temp0 ds-reg [] MOV
568 ! ds-reg bootstrap-cell SUB
570 ! [ temp0 word-entry-point-offset [+] CALL ]
571 ! [ temp0 word-entry-point-offset [+] JMP ]
572 ! \ (execute) define-combinator-primitive
575 ! temp0 ds-reg [] MOV
576 ! ds-reg bootstrap-cell SUB
577 ! temp0 word-entry-point-offset [+] JMP
578 ] JIT-EXECUTE jit-define
581 ! stack-reg stack-frame-size bootstrap-cell - SUB
583 ] JIT-PROLOG jit-define
586 ! stack-reg stack-frame-size bootstrap-cell - ADD
587 ] JIT-EPILOG jit-define
591 ] JIT-RETURN jit-define
593 ! ! ! Polymorphic inline caches
595 ! The PIC stubs are not permitted to touch pic-tail-reg.
597 ! Load a value from a stack position
599 ! temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
600 ] PIC-LOAD jit-define
603 ! temp1/32 tag-mask get AND
608 ! temp1/32 tag-mask get AND
609 ! temp1/32 tuple type-number CMP
611 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
613 ] PIC-TUPLE jit-define
616 ! temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
617 ] PIC-CHECK-TAG jit-define
620 ! 0 JE f rc-relative rel-word
623 ! ! ! Megamorphic caches
628 ! temp1/32 tag-mask get AND
629 ! temp1/32 tag-bits get SHL
630 ! temp1/32 tuple type-number tag-fixnum CMP
632 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
635 ! temp0 0 MOV f rc-absolute-cell rel-literal
636 ! ! key = hashcode(class)
638 ! bootstrap-cell 4 = [ temp2 1 SHR ] when
639 ! ! key &= cache.length - 1
640 ! temp2 mega-cache-size get 1 - bootstrap-cell * AND
641 ! ! cache += array-start-offset
642 ! temp0 array-start-offset ADD
645 ! ! if(get(cache) == class)
649 ! ! megamorphic_cache_hits++
650 ! temp1 0 MOV rc-absolute-cell rel-megamorphic-cache-hits
652 ! ! goto get(cache + bootstrap-cell)
653 ! temp0 temp0 bootstrap-cell [+] MOV
654 ! temp0 word-entry-point-offset [+] JMP
655 ! ! fall-through on miss
657 ] MEGA-LOOKUP jit-define
660 : jit-compare ( insn -- ) drop ;
662 ! temp3 0 MOV t rc-absolute-cell rel-literal
664 ! temp1 \ f type-number MOV
666 ! temp0 ds-reg [] MOV
667 ! ! adjust stack pointer
668 ! ds-reg bootstrap-cell SUB
669 ! ! compare with second value
670 ! ds-reg [] temp0 CMP
672 ! [ temp1 temp3 ] dip execute( dst src -- )
674 ! ds-reg [] temp1 MOV ;
677 : jit-math ( insn -- ) drop ;
678 ! ! load second input
679 ! temp0 ds-reg [] MOV
681 ! ds-reg bootstrap-cell SUB
683 ! [ ds-reg [] temp0 ] dip execute( dst src -- ) ;
685 : jit-fixnum-/mod ( -- ) ;
686 ! ! load second parameter
687 ! temp1 ds-reg [] MOV
688 ! ! load first parameter
689 ! div-arg ds-reg bootstrap-cell neg [+] MOV
691 ! mod-arg div-arg MOV
693 ! mod-arg bootstrap-cell-bits 1 - SAR
697 ! # Rest of arm64 subprimitives
702 ! { fixnum+fast [ \ ADD jit-math ] }
705 ! { fixnum-bitand [ \ AND jit-math ] }
710 ! ds-reg [] tag-mask get XOR
712 ! { fixnum-bitor [ \ OR jit-math ] }
713 ! { fixnum-bitxor [ \ XOR jit-math ] }
714 ! { fixnum-shift-fast [
716 ! shift-arg ds-reg [] MOV
717 ! ! untag shift count
718 ! shift-arg tag-bits get SAR
719 ! ! adjust stack pointer
720 ! ds-reg bootstrap-cell SUB
722 ! temp3 ds-reg [] MOV
725 ! ! compute positive shift value in temp2
728 ! ! compute negative shift value in temp3
730 ! temp3 tag-mask get bitnot AND
732 ! ! if shift count was negative, move temp0 to temp2
735 ! ds-reg [] temp2 MOV
740 ! temp0 ds-reg [] MOV
741 ! ds-reg bootstrap-cell SUB
743 ! temp0 tag-mask get TEST
744 ! temp0 \ f type-number MOV
745 ! temp1 1 tag-fixnum MOV
747 ! ds-reg [] temp0 MOV
749 ! { eq? [ \ CMOVE jit-compare ] }
750 ! { fixnum> [ \ CMOVG jit-compare ] }
751 ! { fixnum>= [ \ CMOVGE jit-compare ] }
752 ! { fixnum< [ \ CMOVL jit-compare ] }
753 ! { fixnum<= [ \ CMOVLE jit-compare ] }
758 ! ! adjust stack pointer
759 ! ds-reg bootstrap-cell SUB
761 ! ds-reg [] mod-arg MOV
765 ! ! adjust stack pointer
766 ! ds-reg bootstrap-cell SUB
768 ! div-arg tag-bits get SHL
770 ! ds-reg [] div-arg MOV
772 ! { fixnum/mod-fast [
775 ! div-arg tag-bits get SHL
777 ! ds-reg [] mod-arg MOV
778 ! ds-reg bootstrap-cell neg [+] div-arg MOV
783 ! ! load second input
784 ! temp0 ds-reg [] MOV
786 ! ds-reg bootstrap-cell SUB
788 ! temp1 ds-reg [] MOV
789 ! ! untag second input
790 ! temp0 tag-bits get SAR
794 ! ds-reg [] temp0 MOV
798 ! { fixnum-fast [ \ SUB jit-math ] }
803 ! temp0 ds-reg [] MOV
804 ! ! adjust stack pointer
805 ! ds-reg bootstrap-cell SUB
806 ! ! turn local number into offset
808 ! ! decrement retain stack pointer
812 ! ! load local number
813 ! temp0 ds-reg [] MOV
814 ! ! turn local number into offset
817 ! temp0 rs-reg temp0 [+] MOV
819 ! ds-reg [] temp0 MOV
821 ! { load-local [ jit->r ] }
826 ! temp0 ds-reg [] MOV
827 ! ! adjust stack pointer
828 ! ds-reg bootstrap-cell SUB
830 ! temp1 ds-reg [] MOV
831 ! ! turn slot number into offset
834 ! temp1 tag-bits get SHR
835 ! temp1 tag-bits get SHL
837 ! temp0 temp1 temp0 [+] MOV
839 ! ds-reg [] temp0 MOV
841 ! { string-nth-fast [
842 ! ! load string index from stack
843 ! temp0 ds-reg bootstrap-cell neg [+] MOV
844 ! temp0 tag-bits get SHR
845 ! ! load string from stack
846 ! temp1 ds-reg [] MOV
848 ! temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
849 ! temp0 temp0 8-bit-version-of MOVZX
850 ! temp0 tag-bits get SHL
851 ! ! store character to stack
852 ! ds-reg bootstrap-cell SUB
853 ! ds-reg [] temp0 MOV
857 ! temp0 ds-reg [] MOV
859 ! temp0/32 tag-mask get AND
861 ! temp0/32 tag-bits get SHL
863 ! ds-reg [] temp0 MOV
869 ! { drop [ ds-reg bootstrap-cell SUB ] }
870 ! { 2drop [ ds-reg 2 bootstrap-cells SUB ] }
871 ! { 3drop [ ds-reg 3 bootstrap-cells SUB ] }
872 ! { 4drop [ ds-reg 4 bootstrap-cells SUB ] }
876 ! temp0 ds-reg [] MOV
877 ! ds-reg bootstrap-cell ADD
878 ! ds-reg [] temp0 MOV
881 ! temp0 ds-reg [] MOV
882 ! temp1 ds-reg bootstrap-cell neg [+] MOV
883 ! ds-reg 2 bootstrap-cells ADD
884 ! ds-reg [] temp0 MOV
885 ! ds-reg bootstrap-cell neg [+] temp1 MOV
888 ! temp0 ds-reg [] MOV
889 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
890 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
891 ! ds-reg 3 bootstrap-cells ADD
892 ! ds-reg [] temp0 MOV
893 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
894 ! ds-reg -2 bootstrap-cells [+] temp3 MOV
897 ! temp0 ds-reg [] MOV
898 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
899 ! temp2 ds-reg -2 bootstrap-cells [+] MOV
900 ! temp3 ds-reg -3 bootstrap-cells [+] MOV
901 ! ds-reg 4 bootstrap-cells ADD
902 ! ds-reg [] temp0 MOV
903 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
904 ! ds-reg -2 bootstrap-cells [+] temp2 MOV
905 ! ds-reg -3 bootstrap-cells [+] temp3 MOV
908 ! temp0 ds-reg [] MOV
909 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
910 ! ds-reg [] temp1 MOV
911 ! ds-reg bootstrap-cell ADD
912 ! ds-reg [] temp0 MOV
915 ! ! ### Misc shufflers
917 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
918 ! ds-reg bootstrap-cell ADD
919 ! ds-reg [] temp0 MOV
922 ! temp0 ds-reg -2 bootstrap-cells [+] MOV
923 ! ds-reg bootstrap-cell ADD
924 ! ds-reg [] temp0 MOV
929 ! temp0 ds-reg [] MOV
930 ! ds-reg bootstrap-cell SUB
931 ! ds-reg [] temp0 MOV
934 ! temp0 ds-reg [] MOV
935 ! ds-reg 2 bootstrap-cells SUB
936 ! ds-reg [] temp0 MOV
941 ! temp0 ds-reg [] MOV
942 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
943 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
944 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
945 ! ds-reg -1 bootstrap-cells [+] temp3 MOV
946 ! ds-reg [] temp1 MOV
949 ! temp0 ds-reg [] MOV
950 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
951 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
952 ! ds-reg -2 bootstrap-cells [+] temp1 MOV
953 ! ds-reg -1 bootstrap-cells [+] temp0 MOV
954 ! ds-reg [] temp3 MOV
957 ! temp0 ds-reg [] MOV
958 ! temp1 ds-reg bootstrap-cell neg [+] MOV
959 ! ds-reg bootstrap-cell neg [+] temp0 MOV
960 ! ds-reg [] temp1 MOV
963 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
964 ! temp1 ds-reg -2 bootstrap-cells [+] MOV
965 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
966 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
969 ! ! ## Signal handling
970 ! { leaf-signal-handler [
971 ! jit-signal-handler-prolog
973 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
975 ! jit-signal-handler-epilog
976 ! ! Pop the fake leaf frame along with our return address
977 ! leaf-stack-frame-size bootstrap-cell - RET
980 ! jit-signal-handler-prolog
982 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
984 ! jit-signal-handler-epilog
987 } define-sub-primitives
989 [ "bootstrap.arm.64" forget-vocab ] with-compilation-unit