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 ) X0 ;
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 ) X7 ;
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 quot-entry-point-offset arg1 ADR
160 ! arg1 quot-entry-point-offset [+] CALL ;
162 : signal-handler-save-regs ( -- regs ) { } ;
163 ! { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 } ;
167 ! temp2 0 MOV f rc-absolute-cell rel-literal
169 ] PIC-CHECK-TUPLE jit-define
174 1 bootstrap-cells rs-reg rs-reg ADDi64
175 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
178 1 bootstrap-cells ds-reg ds-reg ADDi64
179 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
182 1 bootstrap-cells rs-reg rs-reg ADDi64
183 -1 bootstrap-cells ds-reg rs-reg LDR-post
184 1 bootstrap-cells rs-reg rs-reg ADDi64
185 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
188 1 bootstrap-cells ds-reg ds-reg ADDi64
189 -1 bootstrap-cells rs-reg ds-reg LDR-post
190 1 bootstrap-cells ds-reg ds-reg ADDi64
191 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
194 1 bootstrap-cells rs-reg rs-reg ADDi64
195 -1 bootstrap-cells ds-reg rs-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 ;
202 1 bootstrap-cells ds-reg ds-reg ADDi64
203 -1 bootstrap-cells rs-reg ds-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 ;
210 : jit-switch-context ( reg -- ) drop ;
211 ! ! Push a bogus return address so the GC can track this frame back
215 ! ! Make the new context the current one
217 ! vm-reg vm-context-offset [+] ctx-reg MOV
219 ! ! Load new stack pointer
220 ! RSP ctx-reg context-callstack-top-offset [+] MOV
222 ! ! Load new ds, rs registers
223 ! jit-restore-context
225 ! ctx-reg jit-update-tib ;
227 : jit-pop-context-and-param ( -- ) ;
229 ! arg1 arg1 alien-offset [+] MOV
230 ! arg2 ds-reg -8 [+] MOV
233 : jit-push-param ( -- ) ;
235 ! ds-reg [] arg2 MOV ;
237 : jit-set-context ( -- ) ;
238 ! jit-pop-context-and-param
240 ! arg1 jit-switch-context
244 : jit-pop-quot-and-param ( -- ) ;
246 ! arg2 ds-reg -8 [+] MOV
249 : jit-start-context ( -- ) ;
250 ! Create the new context in return-reg. Have to save context
251 ! twice, first before calling new_context() which may GC,
252 ! and again after popping the two parameters from the stack.
254 ! vm-reg "new_context" jit-call-1arg
256 ! jit-pop-quot-and-param
258 ! return-reg jit-switch-context
262 : jit-delete-current-context ( -- ) ;
263 ! vm-reg "delete_context" jit-call-1arg ;
267 ! 0 CALL f rc-relative rel-word
275 ! 0 [RIP+] EAX MOV rc-relative rel-safepoint
276 ] JIT-SAFEPOINT jit-define
278 ! # All arm.64 subprimitives
282 ! { (set-context) [ jit-set-context ] }
283 ! { (set-context-and-delete) [
284 ! jit-delete-current-context
287 ! { (start-context) [ jit-start-context ] }
288 ! { (start-context-and-delete) [ jit-start-context-and-delete ] }
294 ! vm-reg "begin_callback" jit-call-1arg
296 ! ! call the quotation
297 ! arg1 return-reg MOV
300 ! vm-reg "end_callback" jit-call-1arg
319 ! vm-reg "begin_callback" jit-call-1arg
321 ! return-reg arg1 MOVr64 ! arg1 is return
324 ! vm-reg "end_callback" jit-call-1arg
329 ! { unwind-native-frames [ ] }
332 ! { fixnum+ [ [ ADD ] "overflow_fixnum_add" jit-overflow ] }
333 ! { fixnum- [ [ SUB ] "overflow_fixnum_subtract" jit-overflow ] }
338 ! RBX ds-reg 8 [+] MOV
339 ! RBX tag-bits get SAR
346 ! arg1 tag-bits get SAR
349 ! "overflow_fixnum_multiply" jit-call
364 ! RSP [] arg1 16-bit-version-of MOV
369 ! ! Load callstack object
371 ! ds-reg bootstrap-cell SUB
372 ! ! Get ctx->callstack_bottom
374 ! arg1 ctx-reg context-callstack-bottom-offset [+] MOV
375 ! ! Get top of callstack object -- 'src' for memcpy
376 ! arg2 arg4 callstack-top-offset [+] LEA
377 ! ! Get callstack length, in bytes --- 'len' for memcpy
378 ! arg3 arg4 callstack-length-offset [+] MOV
379 ! arg3 tag-bits get SHR
380 ! ! Compute new stack pointer -- 'dst' for memcpy
382 ! ! Install new stack pointer
384 ! ! Call memcpy; arguments are now in the correct registers
385 ! ! Create register shadow area for Win64
387 ! "factor_memcpy" jit-call
388 ! ! Tear down register shadow area
390 ! ! Return with new callstack
393 } define-sub-primitives
397 ! C to Factor entry point
399 ! ! Optimizing compiler's side of callback accesses
400 ! ! arguments that are on the stack via the frame pointer.
401 ! ! On x86-32 fastcall, and x86-64, some arguments are passed
402 ! ! in registers, and so the only registers that are safe for
403 ! ! use here are frame-reg, nv-reg and vm-reg.
405 ! frame-reg stack-reg MOV
407 ! ! Save all non-volatile registers
408 ! nv-regs [ PUSH ] each
412 ! ! Load VM into vm-reg
413 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
416 ! nv-reg vm-reg vm-context-offset [+] MOV
419 ! ! Switch over to the spare context
420 ! nv-reg vm-reg vm-spare-context-offset [+] MOV
421 ! vm-reg vm-context-offset [+] nv-reg MOV
423 ! ! Save C callstack pointer
424 ! nv-reg context-callstack-save-offset [+] stack-reg MOV
426 ! ! Load Factor stack pointers
427 ! stack-reg nv-reg context-callstack-bottom-offset [+] MOV
428 ! nv-reg jit-update-tib
431 ! rs-reg nv-reg context-retainstack-offset [+] MOV
432 ! ds-reg nv-reg context-datastack-offset [+] MOV
434 ! ! Call into Factor code
435 ! link-reg 0 MOV f rc-absolute-cell rel-word
438 ! ! Load VM into vm-reg; only needed on x86-32, but doesn't
440 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
442 ! ! Load C callstack pointer
443 ! nv-reg vm-reg vm-context-offset [+] MOV
444 ! stack-reg nv-reg context-callstack-save-offset [+] MOV
448 ! vm-reg vm-context-offset [+] nv-reg MOV
450 ! ! Restore non-volatile registers
453 ! nv-regs <reversed> [ POP ] each
457 ! ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
458 ! ! need a parameter here.
460 ! ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
461 ! 0xffff RET f rc-absolute-2 rel-untagged
462 ] CALLBACK-STUB jit-define
466 ! temp0 0 MOV f rc-absolute-cell rel-literal
467 ! ! increment datastack pointer
468 ! ds-reg bootstrap-cell ADD
469 ! ! store literal on datastack
470 ! ds-reg [] temp0 MOV
471 ] JIT-PUSH-LITERAL jit-define
474 ! 0 CALL f rc-relative rel-word-pic
475 ] JIT-WORD-CALL jit-define
477 ! The *-signal-handler subprimitives are special-cased in vm/quotations.cpp
478 ! not to trigger generation of a stack frame, so they can
479 ! peform their own prolog/epilog preserving registers.
481 ! It is important that the total is 192/64 and that it matches the
482 ! constants in vm/cpu-x86.*.hpp
483 : jit-signal-handler-prolog ( -- ) ;
484 ! ! Return address already on stack -> 8/4 bytes.
486 ! ! Push all registers. 15 regs/120 bytes on 64bit, 7 regs/28 bytes
487 ! ! on 32bit -> 128/32 bytes.
488 ! signal-handler-save-regs [ PUSH ] each
490 ! ! Push flags -> 136/36 bytes
493 ! ! Register parameter area 32 bytes, unused on platforms other than
494 ! ! windows 64 bit, but including it doesn't hurt. Plus
495 ! ! alignment. LEA used so we don't dirty flags -> 192/64 bytes.
496 ! stack-reg stack-reg 7 bootstrap-cells neg [+] LEA
500 : jit-signal-handler-epilog ( -- ) ;
501 ! stack-reg stack-reg 7 bootstrap-cells [+] LEA
503 ! signal-handler-save-regs reverse [ POP ] each ;
507 ! temp0 ds-reg [] MOV
509 ! ds-reg bootstrap-cell SUB
510 ! ! compare boolean with f
511 ! temp0 \ f type-number CMP
512 ! ! jump to true branch if not equal
513 ! 0 JNE f rc-relative rel-word
514 ! ! jump to false branch if equal
515 ! 0 JMP f rc-relative rel-word
521 ! 0 CALL f rc-relative rel-word
527 ! 0 CALL f rc-relative rel-word
529 ] JIT-2DIP jit-define
533 ! 0 CALL f rc-relative rel-word
535 ] JIT-3DIP jit-define
539 ! temp0 ds-reg [] MOV
541 ! ds-reg bootstrap-cell SUB
543 ! [ temp0 word-entry-point-offset [+] CALL ]
544 ! [ temp0 word-entry-point-offset [+] JMP ]
545 ! \ (execute) define-combinator-primitive
548 ! temp0 ds-reg [] MOV
549 ! ds-reg bootstrap-cell SUB
550 ! temp0 word-entry-point-offset [+] JMP
551 ] JIT-EXECUTE jit-define
554 ! stack-reg stack-frame-size bootstrap-cell - SUB
555 ] JIT-PROLOG jit-define
558 ! stack-reg stack-frame-size bootstrap-cell - ADD
559 ] JIT-EPILOG jit-define
563 ] JIT-RETURN jit-define
565 ! ! ! Polymorphic inline caches
567 ! The PIC stubs are not permitted to touch pic-tail-reg.
569 ! Load a value from a stack position
571 ! temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
572 ] PIC-LOAD jit-define
575 ! temp1/32 tag-mask get AND
580 ! temp1/32 tag-mask get AND
581 ! temp1/32 tuple type-number CMP
583 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
585 ] PIC-TUPLE jit-define
588 ! temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
589 ] PIC-CHECK-TAG jit-define
592 ! 0 JE f rc-relative rel-word
595 ! ! ! Megamorphic caches
600 ! temp1/32 tag-mask get AND
601 ! temp1/32 tag-bits get SHL
602 ! temp1/32 tuple type-number tag-fixnum CMP
604 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
607 ! temp0 0 MOV f rc-absolute-cell rel-literal
608 ! ! key = hashcode(class)
610 ! bootstrap-cell 4 = [ temp2 1 SHR ] when
611 ! ! key &= cache.length - 1
612 ! temp2 mega-cache-size get 1 - bootstrap-cell * AND
613 ! ! cache += array-start-offset
614 ! temp0 array-start-offset ADD
617 ! ! if(get(cache) == class)
621 ! ! megamorphic_cache_hits++
622 ! temp1 0 MOV rc-absolute-cell rel-megamorphic-cache-hits
624 ! ! goto get(cache + bootstrap-cell)
625 ! temp0 temp0 bootstrap-cell [+] MOV
626 ! temp0 word-entry-point-offset [+] JMP
627 ! ! fall-through on miss
629 ] MEGA-LOOKUP jit-define
632 : jit-compare ( insn -- ) drop ;
634 ! temp3 0 MOV t rc-absolute-cell rel-literal
636 ! temp1 \ f type-number MOV
638 ! temp0 ds-reg [] MOV
639 ! ! adjust stack pointer
640 ! ds-reg bootstrap-cell SUB
641 ! ! compare with second value
642 ! ds-reg [] temp0 CMP
644 ! [ temp1 temp3 ] dip execute( dst src -- )
646 ! ds-reg [] temp1 MOV ;
649 : jit-math ( insn -- ) drop ;
650 ! ! load second input
651 ! temp0 ds-reg [] MOV
653 ! ds-reg bootstrap-cell SUB
655 ! [ ds-reg [] temp0 ] dip execute( dst src -- ) ;
657 : jit-fixnum-/mod ( -- ) ;
658 ! ! load second parameter
659 ! temp1 ds-reg [] MOV
660 ! ! load first parameter
661 ! div-arg ds-reg bootstrap-cell neg [+] MOV
663 ! mod-arg div-arg MOV
665 ! mod-arg bootstrap-cell-bits 1 - SAR
669 ! # Rest of arm64 subprimitives
674 ! { fixnum+fast [ \ ADD jit-math ] }
677 ! { fixnum-bitand [ \ AND jit-math ] }
682 ! ds-reg [] tag-mask get XOR
684 ! { fixnum-bitor [ \ OR jit-math ] }
685 ! { fixnum-bitxor [ \ XOR jit-math ] }
686 ! { fixnum-shift-fast [
688 ! shift-arg ds-reg [] MOV
689 ! ! untag shift count
690 ! shift-arg tag-bits get SAR
691 ! ! adjust stack pointer
692 ! ds-reg bootstrap-cell SUB
694 ! temp3 ds-reg [] MOV
697 ! ! compute positive shift value in temp2
700 ! ! compute negative shift value in temp3
702 ! temp3 tag-mask get bitnot AND
704 ! ! if shift count was negative, move temp0 to temp2
707 ! ds-reg [] temp2 MOV
712 ! temp0 ds-reg [] MOV
713 ! ds-reg bootstrap-cell SUB
715 ! temp0 tag-mask get TEST
716 ! temp0 \ f type-number MOV
717 ! temp1 1 tag-fixnum MOV
719 ! ds-reg [] temp0 MOV
721 ! { eq? [ \ CMOVE jit-compare ] }
722 ! { fixnum> [ \ CMOVG jit-compare ] }
723 ! { fixnum>= [ \ CMOVGE jit-compare ] }
724 ! { fixnum< [ \ CMOVL jit-compare ] }
725 ! { fixnum<= [ \ CMOVLE jit-compare ] }
730 ! ! adjust stack pointer
731 ! ds-reg bootstrap-cell SUB
733 ! ds-reg [] mod-arg MOV
737 ! ! adjust stack pointer
738 ! ds-reg bootstrap-cell SUB
740 ! div-arg tag-bits get SHL
742 ! ds-reg [] div-arg MOV
744 ! { fixnum/mod-fast [
747 ! div-arg tag-bits get SHL
749 ! ds-reg [] mod-arg MOV
750 ! ds-reg bootstrap-cell neg [+] div-arg MOV
755 ! ! load second input
756 ! temp0 ds-reg [] MOV
758 ! ds-reg bootstrap-cell SUB
760 ! temp1 ds-reg [] MOV
761 ! ! untag second input
762 ! temp0 tag-bits get SAR
766 ! ds-reg [] temp0 MOV
770 ! { fixnum-fast [ \ SUB jit-math ] }
775 ! temp0 ds-reg [] MOV
776 ! ! adjust stack pointer
777 ! ds-reg bootstrap-cell SUB
778 ! ! turn local number into offset
780 ! ! decrement retain stack pointer
784 ! ! load local number
785 ! temp0 ds-reg [] MOV
786 ! ! turn local number into offset
789 ! temp0 rs-reg temp0 [+] MOV
791 ! ds-reg [] temp0 MOV
793 ! { load-local [ jit->r ] }
798 ! temp0 ds-reg [] MOV
799 ! ! adjust stack pointer
800 ! ds-reg bootstrap-cell SUB
802 ! temp1 ds-reg [] MOV
803 ! ! turn slot number into offset
806 ! temp1 tag-bits get SHR
807 ! temp1 tag-bits get SHL
809 ! temp0 temp1 temp0 [+] MOV
811 ! ds-reg [] temp0 MOV
813 ! { string-nth-fast [
814 ! ! load string index from stack
815 ! temp0 ds-reg bootstrap-cell neg [+] MOV
816 ! temp0 tag-bits get SHR
817 ! ! load string from stack
818 ! temp1 ds-reg [] MOV
820 ! temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
821 ! temp0 temp0 8-bit-version-of MOVZX
822 ! temp0 tag-bits get SHL
823 ! ! store character to stack
824 ! ds-reg bootstrap-cell SUB
825 ! ds-reg [] temp0 MOV
829 ! temp0 ds-reg [] MOV
831 ! temp0/32 tag-mask get AND
833 ! temp0/32 tag-bits get SHL
835 ! ds-reg [] temp0 MOV
841 ! { drop [ ds-reg bootstrap-cell SUB ] }
842 ! { 2drop [ ds-reg 2 bootstrap-cells SUB ] }
843 ! { 3drop [ ds-reg 3 bootstrap-cells SUB ] }
844 ! { 4drop [ ds-reg 4 bootstrap-cells SUB ] }
848 ! temp0 ds-reg [] MOV
849 ! ds-reg bootstrap-cell ADD
850 ! ds-reg [] temp0 MOV
853 ! temp0 ds-reg [] MOV
854 ! temp1 ds-reg bootstrap-cell neg [+] MOV
855 ! ds-reg 2 bootstrap-cells ADD
856 ! ds-reg [] temp0 MOV
857 ! ds-reg bootstrap-cell neg [+] temp1 MOV
860 ! temp0 ds-reg [] MOV
861 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
862 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
863 ! ds-reg 3 bootstrap-cells ADD
864 ! ds-reg [] temp0 MOV
865 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
866 ! ds-reg -2 bootstrap-cells [+] temp3 MOV
869 ! temp0 ds-reg [] MOV
870 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
871 ! temp2 ds-reg -2 bootstrap-cells [+] MOV
872 ! temp3 ds-reg -3 bootstrap-cells [+] MOV
873 ! ds-reg 4 bootstrap-cells ADD
874 ! ds-reg [] temp0 MOV
875 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
876 ! ds-reg -2 bootstrap-cells [+] temp2 MOV
877 ! ds-reg -3 bootstrap-cells [+] temp3 MOV
880 ! temp0 ds-reg [] MOV
881 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
882 ! ds-reg [] temp1 MOV
883 ! ds-reg bootstrap-cell ADD
884 ! ds-reg [] temp0 MOV
887 ! ! ### Misc shufflers
889 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
890 ! ds-reg bootstrap-cell ADD
891 ! ds-reg [] temp0 MOV
894 ! temp0 ds-reg -2 bootstrap-cells [+] MOV
895 ! ds-reg bootstrap-cell ADD
896 ! ds-reg [] temp0 MOV
901 ! temp0 ds-reg [] MOV
902 ! ds-reg bootstrap-cell SUB
903 ! ds-reg [] temp0 MOV
906 ! temp0 ds-reg [] MOV
907 ! ds-reg 2 bootstrap-cells SUB
908 ! ds-reg [] temp0 MOV
913 ! temp0 ds-reg [] MOV
914 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
915 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
916 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
917 ! ds-reg -1 bootstrap-cells [+] temp3 MOV
918 ! ds-reg [] temp1 MOV
921 ! temp0 ds-reg [] MOV
922 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
923 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
924 ! ds-reg -2 bootstrap-cells [+] temp1 MOV
925 ! ds-reg -1 bootstrap-cells [+] temp0 MOV
926 ! ds-reg [] temp3 MOV
929 ! temp0 ds-reg [] MOV
930 ! temp1 ds-reg bootstrap-cell neg [+] MOV
931 ! ds-reg bootstrap-cell neg [+] temp0 MOV
932 ! ds-reg [] temp1 MOV
935 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
936 ! temp1 ds-reg -2 bootstrap-cells [+] MOV
937 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
938 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
941 ! ! ## Signal handling
942 ! { leaf-signal-handler [
943 ! jit-signal-handler-prolog
945 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
947 ! jit-signal-handler-epilog
948 ! ! Pop the fake leaf frame along with our return address
949 ! leaf-stack-frame-size bootstrap-cell - RET
952 ! jit-signal-handler-prolog
954 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
956 ! jit-signal-handler-epilog
959 } define-sub-primitives
961 [ "bootstrap.arm.64" forget-vocab ] with-compilation-unit