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 ! windows arm - X18 is non-volatile https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-160
31 : nv-regs ( -- seq ) { X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 } ;
33 ! callee-save = non-volatile aka call-preserved
35 ! x30 is the link register (used to return from subroutines)
36 ! x29 is the frame register
37 ! x19 to x29 are callee-saved
38 ! x18 is the 'platform register', used for some operating-system-specific special purpose,
39 ! or an additional caller-saved register
40 ! x16 and x17 are the Intra-Procedure-call scratch register
41 ! x9 to x15: used to hold local variables (caller saved)
42 ! x8: used to hold indirect return value address
43 ! x0 to x7: used to hold argument values passed to a subroutine, and also hold
44 ! results returned from a subroutine
47 ! https://en.wikichip.org/wiki/arm/aarch64
48 ! Generally, X0 through X18 (volatile, can corrupt) while X19-X29 must be preserved (non-volatile)
49 ! Volatile registers' content may change over a subroutine call
50 ! non-volatile register is a type of register with contents that must be preserved over subroutine calls
51 ! Register Role Requirement
52 ! X0 - X7 Parameter/result registers Can Corrupt (volatile)
53 ! X8 Indirect result location register (volatile)
54 ! X9 - X15 Temporary registers (volatile)
55 ! X16 - X17 Intra-procedure call temporary (volatile)
56 ! x16 - syscall reg with SVC instructioin
57 ! X18 Platform register, otherwise temporary, DONT USE (volatile)
59 ! X19 - X29 Callee-saved register Must preserve (non-volatile)
60 ! X29 - frame pointer register, must always be valid
61 ! X30 Link Register LR Can Corrupt
62 ! X31 Stack Pointer SP
63 ! 16-byte stack alignment
65 ! stack walking - {fp, lr} pairs if compiled with frame pointers enabled
67 : arg1 ( -- reg ) X0 ;
68 : arg2 ( -- reg ) X1 ;
69 : arg3 ( -- reg ) X2 ;
70 : arg4 ( -- reg ) X3 ;
73 ! windows arm64: 16 bytes https://devblogs.microsoft.com/oldnewthing/20190111-00/?p=100685
74 ! windows arm32: 8 bytes
76 ! Apple arm64: 128 bytes https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms?language=objc
77 : red-zone-size ( -- n ) 16 ; ! 16 bytes on windows, or 128 bytes on linux? or 0?
79 ! no red zone on x86/x64 windows
82 ! https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/build/arm64-windows-abi-conventions.md
84 : shift-arg ( -- reg ) X1 ;
85 : div-arg ( -- reg ) X0 ;
86 : mod-arg ( -- reg ) X2 ;
88 ! caller-saved registers X9-X15
89 ! callee-saved registers X19-X29
90 : temp0 ( -- reg ) X9 ;
91 : temp1 ( -- reg ) X10 ;
92 : temp2 ( -- reg ) X11 ;
93 : temp3 ( -- reg ) X12 ;
96 ! : pic-tail-reg ( -- reg ) RBX ;
97 : return-reg ( -- reg ) X0 ;
98 : stack-reg ( -- reg ) SP ;
99 ! https://developer.arm.com/documentation/dui0801/a/Overview-of-AArch64-state/Link-registers
100 : link-reg ( -- reg ) X30 ; ! LR
101 ! : stack-frame-reg ( -- reg ) X29 ; ! FP
102 : vm-reg ( -- reg ) X28 ;
103 : ds-reg ( -- reg ) X27 ;
104 : rs-reg ( -- reg ) X26 ;
105 ! : ctx-reg ( -- reg ) R12 ;
106 ! : fixnum>slot@ ( -- ) temp0 1 SAR ;
107 ! : rex-length ( -- n ) 1 ;
109 ! rc-absolute-cell is just CONSTANT: 0
110 : jit-call ( name -- )
112 f rc-absolute-cell rel-dlsym
114 ! RAX 0 MOV f rc-absolute-cell rel-dlsym
117 :: jit-call-1arg ( arg1s name -- )
123 :: jit-call-2arg ( arg1s arg2s name -- )
132 ! pic-tail-reg 5 [RIP+] LEA
133 ! 0 JMP f rc-relative rel-word-pic-tail
134 ] JIT-WORD-JUMP jit-define
137 ! no-op on x86-64. in factor contexts vm-reg always contains the
141 : jit-load-context ( -- ) ;
142 ! ctx-reg vm-reg vm-context-offset [+] MOV ;
144 : jit-save-context ( -- ) ;
146 ! The reason for -8 I think is because we are anticipating a CALL
147 ! instruction. After the call instruction, the contexts frame_top
148 ! will point to the origin jump address.
150 ! ctx-reg context-callstack-top-offset [+] R11 MOV
151 ! ctx-reg context-datastack-offset [+] ds-reg MOV
152 ! ctx-reg context-retainstack-offset [+] rs-reg MOV ;
154 ! ctx-reg must already have been loaded
155 : jit-restore-context ( -- ) ;
156 ! ds-reg ctx-reg context-datastack-offset [+] MOV
157 ! rs-reg ctx-reg context-retainstack-offset [+] MOV ;
162 ! ! ctx-reg is preserved across the call because it is non-volatile
165 ! ! call the primitive
167 ! RAX 0 MOV f f rc-absolute-cell rel-dlsym
169 ! jit-restore-context
170 ] JIT-PRIMITIVE jit-define
173 : jit-jump-quot ( -- )
174 quot-entry-point-offset arg1 ADR
176 ! arg1 quot-entry-point-offset [+] JMP ;
178 : jit-call-quot ( -- )
179 quot-entry-point-offset arg1 ADR
181 ! arg1 quot-entry-point-offset [+] CALL ;
183 : signal-handler-save-regs ( -- regs ) { } ;
184 ! { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 } ;
188 ! temp2 0 MOV f rc-absolute-cell rel-literal
190 ] PIC-CHECK-TUPLE jit-define
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 ;
203 1 bootstrap-cells rs-reg rs-reg ADDi64
204 -1 bootstrap-cells ds-reg rs-reg LDR-post
205 1 bootstrap-cells rs-reg rs-reg ADDi64
206 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
209 1 bootstrap-cells ds-reg ds-reg ADDi64
210 -1 bootstrap-cells rs-reg ds-reg LDR-post
211 1 bootstrap-cells ds-reg ds-reg ADDi64
212 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
215 1 bootstrap-cells rs-reg rs-reg ADDi64
216 -1 bootstrap-cells ds-reg rs-reg LDR-post
217 1 bootstrap-cells rs-reg rs-reg ADDi64
218 -1 bootstrap-cells ds-reg rs-reg LDR-post
219 1 bootstrap-cells rs-reg rs-reg ADDi64
220 -1 bootstrap-cells ds-reg rs-reg LDR-post ;
223 1 bootstrap-cells ds-reg ds-reg ADDi64
224 -1 bootstrap-cells rs-reg ds-reg LDR-post
225 1 bootstrap-cells ds-reg ds-reg ADDi64
226 -1 bootstrap-cells rs-reg ds-reg LDR-post
227 1 bootstrap-cells ds-reg ds-reg ADDi64
228 -1 bootstrap-cells rs-reg ds-reg LDR-post ;
231 : jit-switch-context ( reg -- ) drop ;
232 ! ! Push a bogus return address so the GC can track this frame back
236 ! ! Make the new context the current one
238 ! vm-reg vm-context-offset [+] ctx-reg MOV
240 ! ! Load new stack pointer
241 ! RSP ctx-reg context-callstack-top-offset [+] MOV
243 ! ! Load new ds, rs registers
244 ! jit-restore-context
246 ! ctx-reg jit-update-tib ;
248 : jit-pop-context-and-param ( -- ) ;
250 ! arg1 arg1 alien-offset [+] MOV
251 ! arg2 ds-reg -8 [+] MOV
254 : jit-push-param ( -- ) ;
256 ! ds-reg [] arg2 MOV ;
258 : jit-set-context ( -- ) ;
259 ! jit-pop-context-and-param
261 ! arg1 jit-switch-context
265 : jit-pop-quot-and-param ( -- ) ;
267 ! arg2 ds-reg -8 [+] MOV
270 : jit-start-context ( -- ) ;
271 ! Create the new context in return-reg. Have to save context
272 ! twice, first before calling new_context() which may GC,
273 ! and again after popping the two parameters from the stack.
275 ! vm-reg "new_context" jit-call-1arg
277 ! jit-pop-quot-and-param
279 ! return-reg jit-switch-context
283 : jit-delete-current-context ( -- ) ;
284 ! vm-reg "delete_context" jit-call-1arg ;
288 ! 0 CALL f rc-relative rel-word
296 ! 0 [RIP+] EAX MOV rc-relative rel-safepoint
297 ] JIT-SAFEPOINT jit-define
299 ! # All arm.64 subprimitives
315 ! Rn Rd MOVr64 ! comment
317 vm-reg "begin_callback" jit-call-1arg
319 return-reg arg1 MOVr64 ! arg1 is return
322 vm-reg "end_callback" jit-call-1arg
324 } define-sub-primitives
329 ! { (set-context) [ jit-set-context ] }
330 ! { (set-context-and-delete) [
331 ! jit-delete-current-context
334 ! { (start-context) [ jit-start-context ] }
335 ! { (start-context-and-delete) [ jit-start-context-and-delete ] }
341 ! ! vm-reg "begin_callback" jit-call-1arg
343 ! ! ! call the quotation
344 ! ! arg1 return-reg MOV
347 ! ! vm-reg "end_callback" jit-call-1arg
366 ! ! vm-reg "begin_callback" jit-call-1arg
368 ! ! return-reg arg1 MOVr64 ! arg1 is return
371 ! ! vm-reg "end_callback" jit-call-1arg
376 ! { unwind-native-frames [ ] }
379 ! { fixnum+ [ [ ADD ] "overflow_fixnum_add" jit-overflow ] }
380 ! { fixnum- [ [ SUB ] "overflow_fixnum_subtract" jit-overflow ] }
385 ! RBX ds-reg 8 [+] MOV
386 ! RBX tag-bits get SAR
393 ! arg1 tag-bits get SAR
396 ! "overflow_fixnum_multiply" jit-call
411 ! RSP [] arg1 16-bit-version-of MOV
416 ! ! Load callstack object
418 ! ds-reg bootstrap-cell SUB
419 ! ! Get ctx->callstack_bottom
421 ! arg1 ctx-reg context-callstack-bottom-offset [+] MOV
422 ! ! Get top of callstack object -- 'src' for memcpy
423 ! arg2 arg4 callstack-top-offset [+] LEA
424 ! ! Get callstack length, in bytes --- 'len' for memcpy
425 ! arg3 arg4 callstack-length-offset [+] MOV
426 ! arg3 tag-bits get SHR
427 ! ! Compute new stack pointer -- 'dst' for memcpy
429 ! ! Install new stack pointer
431 ! ! Call memcpy; arguments are now in the correct registers
432 ! ! Create register shadow area for Win64
434 ! "factor_memcpy" jit-call
435 ! ! Tear down register shadow area
437 ! ! Return with new callstack
440 ! } define-sub-primitives
444 ! C to Factor entry point
446 ! ! Optimizing compiler's side of callback accesses
447 ! ! arguments that are on the stack via the frame pointer.
448 ! ! On x86-32 fastcall, and x86-64, some arguments are passed
449 ! ! in registers, and so the only registers that are safe for
450 ! ! use here are frame-reg, nv-reg and vm-reg.
452 ! frame-reg stack-reg MOV
454 ! ! Save all non-volatile registers
455 ! nv-regs [ PUSH ] each
459 ! ! Load VM into vm-reg
460 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
463 ! nv-reg vm-reg vm-context-offset [+] MOV
466 ! ! Switch over to the spare context
467 ! nv-reg vm-reg vm-spare-context-offset [+] MOV
468 ! vm-reg vm-context-offset [+] nv-reg MOV
470 ! ! Save C callstack pointer
471 ! nv-reg context-callstack-save-offset [+] stack-reg MOV
473 ! ! Load Factor stack pointers
474 ! stack-reg nv-reg context-callstack-bottom-offset [+] MOV
475 ! nv-reg jit-update-tib
478 ! rs-reg nv-reg context-retainstack-offset [+] MOV
479 ! ds-reg nv-reg context-datastack-offset [+] MOV
481 ! ! Call into Factor code
482 ! link-reg 0 MOV f rc-absolute-cell rel-word
485 ! ! Load VM into vm-reg; only needed on x86-32, but doesn't
487 ! vm-reg 0 MOV 0 rc-absolute-cell rel-vm
489 ! ! Load C callstack pointer
490 ! nv-reg vm-reg vm-context-offset [+] MOV
491 ! stack-reg nv-reg context-callstack-save-offset [+] MOV
495 ! vm-reg vm-context-offset [+] nv-reg MOV
497 ! ! Restore non-volatile registers
500 ! nv-regs <reversed> [ POP ] each
504 ! ! Callbacks which return structs, or use stdcall/fastcall/thiscall,
505 ! ! need a parameter here.
507 ! ! See the comment for M\ x86.32 stack-cleanup in cpu.x86.32
508 ! 0xffff RET f rc-absolute-2 rel-untagged
509 ] CALLBACK-STUB jit-define
513 ! temp0 0 MOV f rc-absolute-cell rel-literal
514 ! ! increment datastack pointer
515 ! ds-reg bootstrap-cell ADD
516 ! ! store literal on datastack
517 ! ds-reg [] temp0 MOV
518 ] JIT-PUSH-LITERAL jit-define
521 ! 0 CALL f rc-relative rel-word-pic
522 ] JIT-WORD-CALL jit-define
524 ! The *-signal-handler subprimitives are special-cased in vm/quotations.cpp
525 ! not to trigger generation of a stack frame, so they can
526 ! peform their own prolog/epilog preserving registers.
528 ! It is important that the total is 192/64 and that it matches the
529 ! constants in vm/cpu-x86.*.hpp
530 : jit-signal-handler-prolog ( -- ) ;
531 ! ! Return address already on stack -> 8/4 bytes.
533 ! ! Push all registers. 15 regs/120 bytes on 64bit, 7 regs/28 bytes
534 ! ! on 32bit -> 128/32 bytes.
535 ! signal-handler-save-regs [ PUSH ] each
537 ! ! Push flags -> 136/36 bytes
540 ! ! Register parameter area 32 bytes, unused on platforms other than
541 ! ! windows 64 bit, but including it doesn't hurt. Plus
542 ! ! alignment. LEA used so we don't dirty flags -> 192/64 bytes.
543 ! stack-reg stack-reg 7 bootstrap-cells neg [+] LEA
547 : jit-signal-handler-epilog ( -- ) ;
548 ! stack-reg stack-reg 7 bootstrap-cells [+] LEA
550 ! signal-handler-save-regs reverse [ POP ] each ;
554 ! temp0 ds-reg [] MOV
556 ! ds-reg bootstrap-cell SUB
557 ! ! compare boolean with f
558 ! temp0 \ f type-number CMP
559 ! ! jump to true branch if not equal
560 ! 0 JNE f rc-relative rel-word
561 ! ! jump to false branch if equal
562 ! 0 JMP f rc-relative rel-word
568 ! 0 CALL f rc-relative rel-word
574 ! 0 CALL f rc-relative rel-word
576 ] JIT-2DIP jit-define
580 ! 0 CALL f rc-relative rel-word
582 ] JIT-3DIP jit-define
586 ! temp0 ds-reg [] MOV
588 ! ds-reg bootstrap-cell SUB
590 ! [ temp0 word-entry-point-offset [+] CALL ]
591 ! [ temp0 word-entry-point-offset [+] JMP ]
592 ! \ (execute) define-combinator-primitive
595 ! temp0 ds-reg [] MOV
596 ! ds-reg bootstrap-cell SUB
597 ! temp0 word-entry-point-offset [+] JMP
598 ] JIT-EXECUTE jit-define
601 ! stack-reg stack-framrcee-size bootstrap-cell - SUB
602 stack-frame-size bootstrap-cell - stack-reg stack-reg SUBi64
603 ] JIT-PROLOG jit-define
606 ! stack-reg stack-frame-size bootstrap-cell - ADD
607 ] JIT-EPILOG jit-define
611 ] JIT-RETURN jit-define
613 ! ! ! Polymorphic inline caches
615 ! The PIC stubs are not permitted to touch pic-tail-reg.
617 ! Load a value from a stack position
619 ! temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
620 ] PIC-LOAD jit-define
623 ! temp1/32 tag-mask get AND
628 ! temp1/32 tag-mask get AND
629 ! temp1/32 tuple type-number CMP
631 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
633 ] PIC-TUPLE jit-define
636 ! temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
637 ] PIC-CHECK-TAG jit-define
640 ! 0 JE f rc-relative rel-word
643 ! ! ! Megamorphic caches
648 ! temp1/32 tag-mask get AND
649 ! temp1/32 tag-bits get SHL
650 ! temp1/32 tuple type-number tag-fixnum CMP
652 ! [ temp1 temp0 tuple-class-offset [+] MOV ]
655 ! temp0 0 MOV f rc-absolute-cell rel-literal
656 ! ! key = hashcode(class)
658 ! bootstrap-cell 4 = [ temp2 1 SHR ] when
659 ! ! key &= cache.length - 1
660 ! temp2 mega-cache-size get 1 - bootstrap-cell * AND
661 ! ! cache += array-start-offset
662 ! temp0 array-start-offset ADD
665 ! ! if(get(cache) == class)
669 ! ! megamorphic_cache_hits++
670 ! temp1 0 MOV rc-absolute-cell rel-megamorphic-cache-hits
672 ! ! goto get(cache + bootstrap-cell)
673 ! temp0 temp0 bootstrap-cell [+] MOV
674 ! temp0 word-entry-point-offset [+] JMP
675 ! ! fall-through on miss
677 ] MEGA-LOOKUP jit-define
680 : jit-compare ( insn -- ) drop ;
682 ! temp3 0 MOV t rc-absolute-cell rel-literal
684 ! temp1 \ f type-number MOV
686 ! temp0 ds-reg [] MOV
687 ! ! adjust stack pointer
688 ! ds-reg bootstrap-cell SUB
689 ! ! compare with second value
690 ! ds-reg [] temp0 CMP
692 ! [ temp1 temp3 ] dip execute( dst src -- )
694 ! ds-reg [] temp1 MOV ;
697 : jit-math ( insn -- ) drop ;
698 ! ! load second input
699 ! temp0 ds-reg [] MOV
701 ! ds-reg bootstrap-cell SUB
703 ! [ ds-reg [] temp0 ] dip execute( dst src -- ) ;
705 : jit-fixnum-/mod ( -- ) ;
706 ! ! load second parameter
707 ! temp1 ds-reg [] MOV
708 ! ! load first parameter
709 ! div-arg ds-reg bootstrap-cell neg [+] MOV
711 ! mod-arg div-arg MOV
713 ! mod-arg bootstrap-cell-bits 1 - SAR
717 ! # Rest of arm64 subprimitives
722 ! { fixnum+fast [ \ ADD jit-math ] }
725 ! { fixnum-bitand [ \ AND jit-math ] }
730 ! ds-reg [] tag-mask get XOR
732 ! { fixnum-bitor [ \ OR jit-math ] }
733 ! { fixnum-bitxor [ \ XOR jit-math ] }
734 ! { fixnum-shift-fast [
736 ! shift-arg ds-reg [] MOV
737 ! ! untag shift count
738 ! shift-arg tag-bits get SAR
739 ! ! adjust stack pointer
740 ! ds-reg bootstrap-cell SUB
742 ! temp3 ds-reg [] MOV
745 ! ! compute positive shift value in temp2
748 ! ! compute negative shift value in temp3
750 ! temp3 tag-mask get bitnot AND
752 ! ! if shift count was negative, move temp0 to temp2
755 ! ds-reg [] temp2 MOV
760 ! temp0 ds-reg [] MOV
761 ! ds-reg bootstrap-cell SUB
763 ! temp0 tag-mask get TEST
764 ! temp0 \ f type-number MOV
765 ! temp1 1 tag-fixnum MOV
767 ! ds-reg [] temp0 MOV
769 ! { eq? [ \ CMOVE jit-compare ] }
770 ! { fixnum> [ \ CMOVG jit-compare ] }
771 ! { fixnum>= [ \ CMOVGE jit-compare ] }
772 ! { fixnum< [ \ CMOVL jit-compare ] }
773 ! { fixnum<= [ \ CMOVLE jit-compare ] }
778 ! ! adjust stack pointer
779 ! ds-reg bootstrap-cell SUB
781 ! ds-reg [] mod-arg MOV
785 ! ! adjust stack pointer
786 ! ds-reg bootstrap-cell SUB
788 ! div-arg tag-bits get SHL
790 ! ds-reg [] div-arg MOV
792 ! { fixnum/mod-fast [
795 ! div-arg tag-bits get SHL
797 ! ds-reg [] mod-arg MOV
798 ! ds-reg bootstrap-cell neg [+] div-arg MOV
803 ! ! load second input
804 ! temp0 ds-reg [] MOV
806 ! ds-reg bootstrap-cell SUB
808 ! temp1 ds-reg [] MOV
809 ! ! untag second input
810 ! temp0 tag-bits get SAR
814 ! ds-reg [] temp0 MOV
818 ! { fixnum-fast [ \ SUB jit-math ] }
823 ! temp0 ds-reg [] MOV
824 ! ! adjust stack pointer
825 ! ds-reg bootstrap-cell SUB
826 ! ! turn local number into offset
828 ! ! decrement retain stack pointer
832 ! ! load local number
833 ! temp0 ds-reg [] MOV
834 ! ! turn local number into offset
837 ! temp0 rs-reg temp0 [+] MOV
839 ! ds-reg [] temp0 MOV
841 ! { load-local [ jit->r ] }
846 ! temp0 ds-reg [] MOV
847 ! ! adjust stack pointer
848 ! ds-reg bootstrap-cell SUB
850 ! temp1 ds-reg [] MOV
851 ! ! turn slot number into offset
854 ! temp1 tag-bits get SHR
855 ! temp1 tag-bits get SHL
857 ! temp0 temp1 temp0 [+] MOV
859 ! ds-reg [] temp0 MOV
861 ! { string-nth-fast [
862 ! ! load string index from stack
863 ! temp0 ds-reg bootstrap-cell neg [+] MOV
864 ! temp0 tag-bits get SHR
865 ! ! load string from stack
866 ! temp1 ds-reg [] MOV
868 ! temp0 8-bit-version-of temp0 temp1 string-offset [++] MOV
869 ! temp0 temp0 8-bit-version-of MOVZX
870 ! temp0 tag-bits get SHL
871 ! ! store character to stack
872 ! ds-reg bootstrap-cell SUB
873 ! ds-reg [] temp0 MOV
877 ! temp0 ds-reg [] MOV
879 ! temp0/32 tag-mask get AND
881 ! temp0/32 tag-bits get SHL
883 ! ds-reg [] temp0 MOV
889 ! { drop [ ds-reg bootstrap-cell SUB ] }
890 ! { 2drop [ ds-reg 2 bootstrap-cells SUB ] }
891 ! { 3drop [ ds-reg 3 bootstrap-cells SUB ] }
892 ! { 4drop [ ds-reg 4 bootstrap-cells SUB ] }
896 ! temp0 ds-reg [] MOV
897 ! ds-reg bootstrap-cell ADD
898 ! ds-reg [] temp0 MOV
901 ! temp0 ds-reg [] MOV
902 ! temp1 ds-reg bootstrap-cell neg [+] MOV
903 ! ds-reg 2 bootstrap-cells ADD
904 ! ds-reg [] temp0 MOV
905 ! ds-reg bootstrap-cell neg [+] temp1 MOV
908 ! temp0 ds-reg [] MOV
909 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
910 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
911 ! ds-reg 3 bootstrap-cells ADD
912 ! ds-reg [] temp0 MOV
913 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
914 ! ds-reg -2 bootstrap-cells [+] temp3 MOV
917 ! temp0 ds-reg [] MOV
918 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
919 ! temp2 ds-reg -2 bootstrap-cells [+] MOV
920 ! temp3 ds-reg -3 bootstrap-cells [+] MOV
921 ! ds-reg 4 bootstrap-cells ADD
922 ! ds-reg [] temp0 MOV
923 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
924 ! ds-reg -2 bootstrap-cells [+] temp2 MOV
925 ! ds-reg -3 bootstrap-cells [+] temp3 MOV
928 ! temp0 ds-reg [] MOV
929 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
930 ! ds-reg [] temp1 MOV
931 ! ds-reg bootstrap-cell ADD
932 ! ds-reg [] temp0 MOV
935 ! ! ### Misc shufflers
937 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
938 ! ds-reg bootstrap-cell ADD
939 ! ds-reg [] temp0 MOV
942 ! temp0 ds-reg -2 bootstrap-cells [+] MOV
943 ! ds-reg bootstrap-cell ADD
944 ! ds-reg [] temp0 MOV
949 ! temp0 ds-reg [] MOV
950 ! ds-reg bootstrap-cell SUB
951 ! ds-reg [] temp0 MOV
954 ! temp0 ds-reg [] MOV
955 ! ds-reg 2 bootstrap-cells SUB
956 ! ds-reg [] temp0 MOV
961 ! temp0 ds-reg [] MOV
962 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
963 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
964 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
965 ! ds-reg -1 bootstrap-cells [+] temp3 MOV
966 ! ds-reg [] temp1 MOV
969 ! temp0 ds-reg [] MOV
970 ! temp1 ds-reg -1 bootstrap-cells [+] MOV
971 ! temp3 ds-reg -2 bootstrap-cells [+] MOV
972 ! ds-reg -2 bootstrap-cells [+] temp1 MOV
973 ! ds-reg -1 bootstrap-cells [+] temp0 MOV
974 ! ds-reg [] temp3 MOV
977 ! temp0 ds-reg [] MOV
978 ! temp1 ds-reg bootstrap-cell neg [+] MOV
979 ! ds-reg bootstrap-cell neg [+] temp0 MOV
980 ! ds-reg [] temp1 MOV
983 ! temp0 ds-reg -1 bootstrap-cells [+] MOV
984 ! temp1 ds-reg -2 bootstrap-cells [+] MOV
985 ! ds-reg -2 bootstrap-cells [+] temp0 MOV
986 ! ds-reg -1 bootstrap-cells [+] temp1 MOV
989 ! ! ## Signal handling
990 ! { leaf-signal-handler [
991 ! jit-signal-handler-prolog
993 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
995 ! jit-signal-handler-epilog
996 ! ! Pop the fake leaf frame along with our return address
997 ! leaf-stack-frame-size bootstrap-cell - RET
1000 ! jit-signal-handler-prolog
1002 ! temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
1004 ! jit-signal-handler-epilog
1007 } define-sub-primitives
1009 [ "bootstrap.arm.64" forget-vocab ] with-compilation-unit