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
55 ! X19 - X29 Callee-saved register Must preserve
56 ! X30 Link Register Can Corrupt
58 : arg1 ( -- reg ) X0 ;
59 : arg2 ( -- reg ) X1 ;
60 : arg3 ( -- reg ) X2 ;
61 : arg4 ( -- reg ) X3 ;
62 : red-zone-size ( -- n ) 16 ;
64 : shift-arg ( -- reg ) X1 ;
65 : div-arg ( -- reg ) X0 ;
66 : mod-arg ( -- reg ) X2 ;
68 ! caller-saved registers X9-X15
69 ! callee-saved registers X19-X29
70 : temp0 ( -- reg ) X9 ;
71 : temp1 ( -- reg ) X10 ;
72 : temp2 ( -- reg ) X11 ;
73 : temp3 ( -- reg ) X12 ;
77 ! : pic-tail-reg ( -- reg ) RBX ;
78 ! : return-reg ( -- reg ) RAX ;
79 ! : nv-reg ( -- reg ) RBX ;
80 ! : stack-reg ( -- reg ) RSP ;
81 ! : frame-reg ( -- reg ) RBP ;
82 ! : link-reg ( -- reg ) R11 ;
83 ! : ctx-reg ( -- reg ) R12 ;
84 ! : vm-reg ( -- reg ) R13 ;
85 : ds-reg ( -- reg ) X5 ;
86 : rs-reg ( -- reg ) X6 ;
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 ! arg1 quot-entry-point-offset [+] JMP ;
156 : jit-call-quot ( -- ) ;
157 ! arg1 quot-entry-point-offset [+] CALL ;
159 : signal-handler-save-regs ( -- regs ) { } ;
160 ! { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 } ;
164 ! temp2 0 MOV f rc-absolute-cell rel-literal
166 ] PIC-CHECK-TUPLE jit-define
171 1 bootstrap-cells rs-reg rs-reg ADDi64
172 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
175 1 bootstrap-cells ds-reg ds-reg ADDi64
176 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
179 1 bootstrap-cells rs-reg rs-reg ADDi64
180 -1 bootstrap-cells ds-reg rs-reg LDR-post
181 1 bootstrap-cells rs-reg rs-reg ADDi64
182 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
185 1 bootstrap-cells ds-reg ds-reg ADDi64
186 -1 bootstrap-cells rs-reg ds-reg LDR-post
187 1 bootstrap-cells ds-reg ds-reg ADDi64
188 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
191 1 bootstrap-cells rs-reg rs-reg ADDi64
192 -1 bootstrap-cells ds-reg rs-reg LDR-post
193 1 bootstrap-cells rs-reg rs-reg ADDi64
194 -1 bootstrap-cells ds-reg rs-reg LDR-post
195 1 bootstrap-cells rs-reg rs-reg ADDi64
196 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
199 1 bootstrap-cells ds-reg ds-reg ADDi64
200 -1 bootstrap-cells rs-reg ds-reg LDR-post
201 1 bootstrap-cells ds-reg ds-reg ADDi64
202 -1 bootstrap-cells rs-reg ds-reg LDR-post
203 1 bootstrap-cells ds-reg ds-reg ADDi64
204 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
207 : jit-switch-context ( reg -- ) drop ;
208 ! ! Push a bogus return address so the GC can track this frame back
212 ! ! Make the new context the current one
214 ! vm-reg vm-context-offset [+] ctx-reg MOV
216 ! ! Load new stack pointer
217 ! RSP ctx-reg context-callstack-top-offset [+] MOV
219 ! ! Load new ds, rs registers
220 ! jit-restore-context
222 ! ctx-reg jit-update-tib ;
224 : jit-pop-context-and-param ( -- ) ;
226 ! arg1 arg1 alien-offset [+] MOV
227 ! arg2 ds-reg -8 [+] MOV
230 : jit-push-param ( -- ) ;
232 ! ds-reg [] arg2 MOV ;
234 : jit-set-context ( -- ) ;
235 ! jit-pop-context-and-param
237 ! arg1 jit-switch-context
241 : jit-pop-quot-and-param ( -- ) ;
243 ! arg2 ds-reg -8 [+] MOV
246 : jit-start-context ( -- ) ;
247 ! Create the new context in return-reg. Have to save context
248 ! twice, first before calling new_context() which may GC,
249 ! and again after popping the two parameters from the stack.
251 ! vm-reg "new_context" jit-call-1arg
253 ! jit-pop-quot-and-param
255 ! return-reg jit-switch-context
259 : jit-delete-current-context ( -- ) ;
260 ! vm-reg "delete_context" jit-call-1arg ;
264 ! 0 CALL f rc-relative rel-word
272 ! 0 [RIP+] EAX MOV rc-relative rel-safepoint
273 ] JIT-SAFEPOINT jit-define
275 ! # All arm.64 subprimitives
279 ! { (set-context) [ jit-set-context ] }
280 ! { (set-context-and-delete) [
281 ! jit-delete-current-context
284 ! { (start-context) [ jit-start-context ] }
285 ! { (start-context-and-delete) [ jit-start-context-and-delete ] }
290 ! vm-reg "begin_callback" jit-call-1arg
292 ! ! call the quotation
293 ! arg1 return-reg MOV
296 ! vm-reg "end_callback" jit-call-1arg
301 ! { unwind-native-frames [ ] }
304 ! { fixnum+ [ [ ADD ] "overflow_fixnum_add" jit-overflow ] }
305 ! { fixnum- [ [ SUB ] "overflow_fixnum_subtract" jit-overflow ] }
310 ! RBX ds-reg 8 [+] MOV
311 ! RBX tag-bits get SAR
318 ! arg1 tag-bits get SAR
321 ! "overflow_fixnum_multiply" jit-call
336 ! RSP [] arg1 16-bit-version-of MOV
341 ! ! Load callstack object
343 ! ds-reg bootstrap-cell SUB
344 ! ! Get ctx->callstack_bottom
346 ! arg1 ctx-reg context-callstack-bottom-offset [+] MOV
347 ! ! Get top of callstack object -- 'src' for memcpy
348 ! arg2 arg4 callstack-top-offset [+] LEA
349 ! ! Get callstack length, in bytes --- 'len' for memcpy
350 ! arg3 arg4 callstack-length-offset [+] MOV
351 ! arg3 tag-bits get SHR
352 ! ! Compute new stack pointer -- 'dst' for memcpy
354 ! ! Install new stack pointer
356 ! ! Call memcpy; arguments are now in the correct registers
357 ! ! Create register shadow area for Win64
359 ! "factor_memcpy" jit-call
360 ! ! Tear down register shadow area
362 ! ! Return with new callstack
365 } define-sub-primitives
369 ! C to Factor entry point
371 ! ! Optimizing compiler's side of callback accesses
372 ! ! arguments that are on the stack via the frame pointer.
373 ! ! On x86-32 fastcall, and x86-64, some arguments are passed
374 ! ! in registers, and so the only registers that are safe for
375 ! ! use here are frame-reg, nv-reg and vm-reg.
377 ! frame-reg stack-reg MOV
379 ! ! Save all non-volatile registers
380 ! nv-regs [ PUSH ] each
384 ! ! Load VM into vm-reg
385 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
388 ! nv-reg vm-reg vm-context-offset [+] MOV
391 ! ! Switch over to the spare context
392 ! nv-reg vm-reg vm-spare-context-offset [+] MOV
393 ! vm-reg vm-context-offset [+] nv-reg MOV
395 ! ! Save C callstack pointer
396 ! nv-reg context-callstack-save-offset [+] stack-reg MOV
398 ! ! Load Factor stack pointers
399 ! stack-reg nv-reg context-callstack-bottom-offset [+] MOV
400 ! nv-reg jit-update-tib
403 ! rs-reg nv-reg context-retainstack-offset [+] MOV
404 ! ds-reg nv-reg context-datastack-offset [+] MOV
406 ! ! Call into Factor code
407 ! link-reg 0 MOV f rc-absolute-cell rel-word
410 ! ! Load VM into vm-reg; only needed on x86-32, but doesn't
412 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
414 ! ! Load C callstack pointer
415 ! nv-reg vm-reg vm-context-offset [+] MOV
416 ! stack-reg nv-reg context-callstack-save-offset [+] MOV
420 ! vm-reg vm-context-offset [+] nv-reg MOV
422 ! ! Restore non-volatile registers
425 ! nv-regs <reversed> [ POP ] each
429 ! ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
430 ! ! need a parameter here.
432 ! ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
433 ! 0xffff RET f rc-absolute-2 rel-untagged
434 ] CALLBACK-STUB jit-define
438 ! temp0 0 MOV f rc-absolute-cell rel-literal
439 ! ! increment datastack pointer
440 ! ds-reg bootstrap-cell ADD
441 ! ! store literal on datastack
442 ! ds-reg [] temp0 MOV
443 ] JIT-PUSH-LITERAL jit-define
446 ! 0 CALL f rc-relative rel-word-pic
447 ] JIT-WORD-CALL jit-define
449 ! The *-signal-handler subprimitives are special-cased in vm/quotations.cpp
450 ! not to trigger generation of a stack frame, so they can
451 ! peform their own prolog/epilog preserving registers.
453 ! It is important that the total is 192/64 and that it matches the
454 ! constants in vm/cpu-x86.*.hpp
455 : jit-signal-handler-prolog ( -- ) ;
456 ! ! Return address already on stack -> 8/4 bytes.
458 ! ! Push all registers. 15 regs/120 bytes on 64bit, 7 regs/28 bytes
459 ! ! on 32bit -> 128/32 bytes.
460 ! signal-handler-save-regs [ PUSH ] each
462 ! ! Push flags -> 136/36 bytes
465 ! ! Register parameter area 32 bytes, unused on platforms other than
466 ! ! windows 64 bit, but including it doesn't hurt. Plus
467 ! ! alignment. LEA used so we don't dirty flags -> 192/64 bytes.
468 ! stack-reg stack-reg 7 bootstrap-cells neg [+] LEA
472 : jit-signal-handler-epilog ( -- ) ;
473 ! stack-reg stack-reg 7 bootstrap-cells [+] LEA
475 ! signal-handler-save-regs reverse [ POP ] each ;
479 ! temp0 ds-reg [] MOV
481 ! ds-reg bootstrap-cell SUB
482 ! ! compare boolean with f
483 ! temp0 \ f type-number CMP
484 ! ! jump to true branch if not equal
485 ! 0 JNE f rc-relative rel-word
486 ! ! jump to false branch if equal
487 ! 0 JMP f rc-relative rel-word
493 ! 0 CALL f rc-relative rel-word
499 ! 0 CALL f rc-relative rel-word
501 ] JIT-2DIP jit-define
505 ! 0 CALL f rc-relative rel-word
507 ] JIT-3DIP jit-define
511 ! temp0 ds-reg [] MOV
513 ! ds-reg bootstrap-cell SUB
515 ! [ temp0 word-entry-point-offset [+] CALL ]
516 ! [ temp0 word-entry-point-offset [+] JMP ]
517 ! \ (execute) define-combinator-primitive
520 ! temp0 ds-reg [] MOV
521 ! ds-reg bootstrap-cell SUB
522 ! temp0 word-entry-point-offset [+] JMP
523 ] JIT-EXECUTE jit-define
526 ! stack-reg stack-frame-size bootstrap-cell - SUB
527 ] JIT-PROLOG jit-define
530 ! stack-reg stack-frame-size bootstrap-cell - ADD
531 ] JIT-EPILOG jit-define
535 ] JIT-RETURN jit-define
537 ! ! ! Polymorphic inline caches
539 ! The PIC stubs are not permitted to touch pic-tail-reg.
541 ! Load a value from a stack position
543 ! temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
544 ] PIC-LOAD jit-define
547 ! temp1/32 tag-mask get AND
552 ! temp1/32 tag-mask get AND
553 ! temp1/32 tuple type-number CMP
555 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
557 ] PIC-TUPLE jit-define
560 ! temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
561 ] PIC-CHECK-TAG jit-define
563 [ 0 JE f rc-relative rel-word ] PIC-HIT jit-define
565 ! ! ! Megamorphic caches
570 ! temp1/32 tag-mask get AND
571 ! temp1/32 tag-bits get SHL
572 ! temp1/32 tuple type-number tag-fixnum CMP
574 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
577 ! temp0 0 MOV f rc-absolute-cell rel-literal
578 ! ! key = hashcode(class)
580 ! bootstrap-cell 4 = [ temp2 1 SHR ] when
581 ! ! key &= cache.length - 1
582 ! temp2 mega-cache-size get 1 - bootstrap-cell * AND
583 ! ! cache += array-start-offset
584 ! temp0 array-start-offset ADD
587 ! ! if(get(cache) == class)
591 ! ! megamorphic_cache_hits++
592 ! temp1 0 MOV rc-absolute-cell rel-megamorphic-cache-hits
594 ! ! goto get(cache + bootstrap-cell)
595 ! temp0 temp0 bootstrap-cell [+] MOV
596 ! temp0 word-entry-point-offset [+] JMP
597 ! ! fall-through on miss
599 ] MEGA-LOOKUP jit-define
602 : jit-compare ( insn -- ) drop ;
604 ! temp3 0 MOV t rc-absolute-cell rel-literal
606 ! temp1 \ f type-number MOV
608 ! temp0 ds-reg [] MOV
609 ! ! adjust stack pointer
610 ! ds-reg bootstrap-cell SUB
611 ! ! compare with second value
612 ! ds-reg [] temp0 CMP
614 ! [ temp1 temp3 ] dip execute( dst src -- )
616 ! ds-reg [] temp1 MOV ;
619 : jit-math ( insn -- ) drop ;
620 ! ! load second input
621 ! temp0 ds-reg [] MOV
623 ! ds-reg bootstrap-cell SUB
625 ! [ ds-reg [] temp0 ] dip execute( dst src -- ) ;
627 : jit-fixnum-/mod ( -- ) ;
628 ! ! load second parameter
629 ! temp1 ds-reg [] MOV
630 ! ! load first parameter
631 ! div-arg ds-reg bootstrap-cell neg [+] MOV
633 ! mod-arg div-arg MOV
635 ! mod-arg bootstrap-cell-bits 1 - SAR
639 ! # Rest of arm64 subprimitives
644 ! { fixnum+fast [ \ ADD jit-math ] }
647 ! { fixnum-bitand [ \ AND jit-math ] }
652 ! ds-reg [] tag-mask get XOR
654 ! { fixnum-bitor [ \ OR jit-math ] }
655 ! { fixnum-bitxor [ \ XOR jit-math ] }
656 ! { fixnum-shift-fast [
658 ! shift-arg ds-reg [] MOV
659 ! ! untag shift count
660 ! shift-arg tag-bits get SAR
661 ! ! adjust stack pointer
662 ! ds-reg bootstrap-cell SUB
664 ! temp3 ds-reg [] MOV
667 ! ! compute positive shift value in temp2
670 ! ! compute negative shift value in temp3
672 ! temp3 tag-mask get bitnot AND
674 ! ! if shift count was negative, move temp0 to temp2
677 ! ds-reg [] temp2 MOV
682 ! temp0 ds-reg [] MOV
683 ! ds-reg bootstrap-cell SUB
685 ! temp0 tag-mask get TEST
686 ! temp0 \ f type-number MOV
687 ! temp1 1 tag-fixnum MOV
689 ! ds-reg [] temp0 MOV
691 ! { eq? [ \ CMOVE jit-compare ] }
692 ! { fixnum> [ \ CMOVG jit-compare ] }
693 ! { fixnum>= [ \ CMOVGE jit-compare ] }
694 ! { fixnum< [ \ CMOVL jit-compare ] }
695 ! { fixnum<= [ \ CMOVLE jit-compare ] }
700 ! ! adjust stack pointer
701 ! ds-reg bootstrap-cell SUB
703 ! ds-reg [] mod-arg MOV
707 ! ! adjust stack pointer
708 ! ds-reg bootstrap-cell SUB
710 ! div-arg tag-bits get SHL
712 ! ds-reg [] div-arg MOV
714 ! { fixnum/mod-fast [
717 ! div-arg tag-bits get SHL
719 ! ds-reg [] mod-arg MOV
720 ! ds-reg bootstrap-cell neg [+] div-arg MOV
725 ! ! load second input
726 ! temp0 ds-reg [] MOV
728 ! ds-reg bootstrap-cell SUB
730 ! temp1 ds-reg [] MOV
731 ! ! untag second input
732 ! temp0 tag-bits get SAR
736 ! ds-reg [] temp0 MOV
740 ! { fixnum-fast [ \ SUB jit-math ] }
745 ! temp0 ds-reg [] MOV
746 ! ! adjust stack pointer
747 ! ds-reg bootstrap-cell SUB
748 ! ! turn local number into offset
750 ! ! decrement retain stack pointer
754 ! ! load local number
755 ! temp0 ds-reg [] MOV
756 ! ! turn local number into offset
759 ! temp0 rs-reg temp0 [+] MOV
761 ! ds-reg [] temp0 MOV
763 ! { load-local [ jit->r ] }
768 ! temp0 ds-reg [] MOV
769 ! ! adjust stack pointer
770 ! ds-reg bootstrap-cell SUB
772 ! temp1 ds-reg [] MOV
773 ! ! turn slot number into offset
776 ! temp1 tag-bits get SHR
777 ! temp1 tag-bits get SHL
779 ! temp0 temp1 temp0 [+] MOV
781 ! ds-reg [] temp0 MOV
783 ! { string-nth-fast [
784 ! ! load string index from stack
785 ! temp0 ds-reg bootstrap-cell neg [+] MOV
786 ! temp0 tag-bits get SHR
787 ! ! load string from stack
788 ! temp1 ds-reg [] MOV
790 ! temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
791 ! temp0 temp0 8-bit-version-of MOVZX
792 ! temp0 tag-bits get SHL
793 ! ! store character to stack
794 ! ds-reg bootstrap-cell SUB
795 ! ds-reg [] temp0 MOV
799 ! temp0 ds-reg [] MOV
801 ! temp0/32 tag-mask get AND
803 ! temp0/32 tag-bits get SHL
805 ! ds-reg [] temp0 MOV
811 ! { drop [ ds-reg bootstrap-cell SUB ] }
812 ! { 2drop [ ds-reg 2 bootstrap-cells SUB ] }
813 ! { 3drop [ ds-reg 3 bootstrap-cells SUB ] }
814 ! { 4drop [ ds-reg 4 bootstrap-cells SUB ] }
818 ! temp0 ds-reg [] MOV
819 ! ds-reg bootstrap-cell ADD
820 ! ds-reg [] temp0 MOV
823 ! temp0 ds-reg [] MOV
824 ! temp1 ds-reg bootstrap-cell neg [+] MOV
825 ! ds-reg 2 bootstrap-cells ADD
826 ! ds-reg [] temp0 MOV
827 ! ds-reg bootstrap-cell neg [+] temp1 MOV
830 ! temp0 ds-reg [] MOV
831 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
832 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
833 ! ds-reg 3 bootstrap-cells ADD
834 ! ds-reg [] temp0 MOV
835 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
836 ! ds-reg -2 bootstrap-cells [+] temp3 MOV
839 ! temp0 ds-reg [] MOV
840 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
841 ! temp2 ds-reg -2 bootstrap-cells [+] MOV
842 ! temp3 ds-reg -3 bootstrap-cells [+] MOV
843 ! ds-reg 4 bootstrap-cells ADD
844 ! ds-reg [] temp0 MOV
845 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
846 ! ds-reg -2 bootstrap-cells [+] temp2 MOV
847 ! ds-reg -3 bootstrap-cells [+] temp3 MOV
850 ! temp0 ds-reg [] MOV
851 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
852 ! ds-reg [] temp1 MOV
853 ! ds-reg bootstrap-cell ADD
854 ! ds-reg [] temp0 MOV
857 ! ! ### Misc shufflers
859 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
860 ! ds-reg bootstrap-cell ADD
861 ! ds-reg [] temp0 MOV
864 ! temp0 ds-reg -2 bootstrap-cells [+] MOV
865 ! ds-reg bootstrap-cell ADD
866 ! ds-reg [] temp0 MOV
871 ! temp0 ds-reg [] MOV
872 ! ds-reg bootstrap-cell SUB
873 ! ds-reg [] temp0 MOV
876 ! temp0 ds-reg [] MOV
877 ! ds-reg 2 bootstrap-cells SUB
878 ! ds-reg [] temp0 MOV
883 ! temp0 ds-reg [] MOV
884 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
885 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
886 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
887 ! ds-reg -1 bootstrap-cells [+] temp3 MOV
888 ! ds-reg [] temp1 MOV
891 ! temp0 ds-reg [] MOV
892 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
893 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
894 ! ds-reg -2 bootstrap-cells [+] temp1 MOV
895 ! ds-reg -1 bootstrap-cells [+] temp0 MOV
896 ! ds-reg [] temp3 MOV
899 ! temp0 ds-reg [] MOV
900 ! temp1 ds-reg bootstrap-cell neg [+] MOV
901 ! ds-reg bootstrap-cell neg [+] temp0 MOV
902 ! ds-reg [] temp1 MOV
905 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
906 ! temp1 ds-reg -2 bootstrap-cells [+] MOV
907 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
908 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
911 ! ! ## Signal handling
912 ! { leaf-signal-handler [
913 ! jit-signal-handler-prolog
915 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
917 ! jit-signal-handler-epilog
918 ! ! Pop the fake leaf frame along with our return address
919 ! leaf-stack-frame-size bootstrap-cell - RET
922 ! jit-signal-handler-prolog
924 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
926 ! jit-signal-handler-epilog
929 } define-sub-primitives
931 [ "bootstrap.arm.64" forget-vocab ] with-compilation-unit