arm.64


Vocabulary
system

Definition


Methods

M:: arm.64 %alien-assembly
( varargs? reg-inputs stack-inputs reg-outputs dead-outputs cleanup stack-size quot -- )
stack-inputs [ first3 %store-stack-param ] each reg-inputs
[ first3 %store-reg-param ] each varargs?
[ reg-inputs %prepare-var-args ] when
quot ( -- ) call-effect reg-outputs
[ first3 %load-reg-param ] each ;






M:: arm.64 %allot ( ALLOT size class NURSERY -- )
ALLOT VM "nursery" vm offset-of [+] LDR
temp ALLOT size data-alignment get align ADD
temp VM "nursery" vm offset-of [+] STR
temp class type-number tag-header MOV temp ALLOT [] STR
ALLOT dup class type-number ADD ;



M:: arm.64 %box ( DST SRC func rep gc-map -- )
rep reg-class-of f param-regs at first SRC rep %copy
rep int-rep? arg2 arg1 ? VM MOV func f gc-map %c-invoke
DST int-rep %load-return ;



M:: arm.64 %box-alien ( DST SRC TEMP -- )
<label> :> end DST \ f type-number MOV SRC end CBZ
DST 5 cells alien TEMP %allot temp \ f type-number MOV
temp DST 1 alien@ STR temp DST 2 alien@ STR SRC DST 3 alien@
STR SRC DST 4 alien@ STR end resolve-label ;


















M:: arm.64 %check-nursery-branch
( label size cc TEMP1 TEMP2 -- )
"nursery" vm offset-of :> offset TEMP1 VM offset [+] LDR
TEMP1 TEMP1 size ADD TEMP2 VM offset 2 cells + [+] LDR
TEMP1 TEMP2 CMP cc
{ { cc<= [ label BLE ] } { cc/<= [ label BGT ] } } case ;






















































M:: arm.64 %save-context ( TEMP1 TEMP2 -- )
TEMP1 %context TEMP2 SP MOV
TEMP2 TEMP1 "callstack-top" context offset-of [+] STR
DS TEMP1 "datastack" context offset-of [+] STR
RS TEMP1 "retainstack" context offset-of [+] STR ;






M:: arm.64 %unbox ( DST SRC func rep -- )
arg1 SRC tagged-rep %copy arg2 VM MOV func f f %c-invoke
DST rep %load-return ;






























M: arm.64 machine-registers
{
{
int-regs
{
X0
X1
X2
X3
X4
X5
X6
X7
X8
X10
X11
X12
X13
X14
X15
}
}
{
float-regs
{
V0
V1
V2
V3
V4
V5
V6
V7
V16
V17
V18
V19
V20
V21
V22
V23
V24
V25
V26
V27
V28
V29
V30
}
}
} ;



M: arm.64 param-regs
drop {
{ int-regs { X0 X1 X2 X3 X4 X5 X6 X7 } }
{ float-regs { V0 V1 V2 V3 V4 V5 V6 V7 } }
} ;