81
81
`defarg(5,`r6')')dnl
85
* Used by NBIF_SAVE_RESCHED_ARGS to save argument
86
* registers in locations preserved by C.
87
* May be registers or process-private memory locations.
88
* Must not be C caller-save registers.
89
* Must not overlap with any Erlang global registers.
92
85
* Used in nbif_stack_trap_ra to preserve the return value.
93
86
* Must be a C callee-save register.
175
166
`/* #define NBIF_RET_5 'NBIF_RET(5)` */'
178
dnl NBIF_SAVE_RESCHED_ARGS(ARITY)
179
dnl Used in the expensive_bif_interface_{1,2,3}() macros to copy
180
dnl caller-save argument registers to non-volatile locations.
181
dnl Currently, 1 <= ARITY <= 3, so this simply moves the arguments
182
dnl to C callee-save registers.
184
define(NBIF_MIN,`ifelse(eval($1 > $2),0,$1,$2)')dnl
185
define(NBIF_SVA_1,`ifelse(eval($1 < NR_ARG_REGS),0,,`mov TEMP_ARG$1,ARG$1; ')')dnl
186
define(NBIF_SVA_N,`ifelse(eval($1 >= 0),0,,`NBIF_SVA_N(eval($1-1))NBIF_SVA_1($1)')')dnl
187
define(NBIF_SAVE_RESCHED_ARGS,`NBIF_SVA_N(eval(NBIF_MIN($1,NR_ARG_REGS)-1))')dnl
188
`/* #define NBIF_SAVE_RESCHED_ARGS_1 'NBIF_SAVE_RESCHED_ARGS(1)` */'
189
`/* #define NBIF_SAVE_RESCHED_ARGS_2 'NBIF_SAVE_RESCHED_ARGS(2)` */'
190
`/* #define NBIF_SAVE_RESCHED_ARGS_3 'NBIF_SAVE_RESCHED_ARGS(3)` */'
193
169
dnl QUICK_CALL_RET(CFUN,ARITY)
194
170
dnl Used in nocons_nofail and noproc primop interfaces to optimise
195
171
dnl SAVE_CONTEXT_QUICK; bl CFUN; RESTORE_CONTEXT_QUICK; NBIF_RET(ARITY).