170
170
`defarg(5,`r9')')dnl
174
* Used by NBIF_SAVE_RESCHED_ARGS to save argument
175
* registers in locations preserved by C.
176
* May be registers or process-private memory locations.
177
* Must not be C caller-save registers.
178
* Must not overlap with any Erlang global registers.
181
174
* Used in nbif_stack_trap_ra to preserve the return value.
182
175
* Must be a C callee-save register.
262
253
`/* #define NBIF_RET_5 'NBIF_RET(5)` */'
265
dnl NBIF_SAVE_RESCHED_ARGS(ARITY)
266
dnl Used in the expensive_bif_interface_{1,2,3}() macros to copy
267
dnl caller-save argument registers to non-volatile locations.
268
dnl Currently, 1 <= ARITY <= 3, so this simply moves the arguments
269
dnl to C callee-save registers.
271
define(NBIF_MIN,`ifelse(eval($1 > $2),0,$1,$2)')dnl
272
define(NBIF_SVA_1,`ifelse(eval($1 < NR_ARG_REGS),0,,`mr TEMP_ARG$1,ARG$1 SEMI ')')dnl
273
define(NBIF_SVA_N,`ifelse(eval($1 >= 0),0,,`NBIF_SVA_N(eval($1-1))NBIF_SVA_1($1)')')dnl
274
define(NBIF_SAVE_RESCHED_ARGS,`NBIF_SVA_N(eval(NBIF_MIN($1,NR_ARG_REGS)-1))')dnl
275
`/* #define NBIF_SAVE_RESCHED_ARGS_1 'NBIF_SAVE_RESCHED_ARGS(1)` */'
276
`/* #define NBIF_SAVE_RESCHED_ARGS_2 'NBIF_SAVE_RESCHED_ARGS(2)` */'
277
`/* #define NBIF_SAVE_RESCHED_ARGS_3 'NBIF_SAVE_RESCHED_ARGS(3)` */'
280
256
dnl QUICK_CALL_RET(CFUN,ARITY)
281
257
dnl Used in nocons_nofail and noproc primop interfaces to optimise
282
258
dnl SAVE_CONTEXT_QUICK; bl CFUN; RESTORE_CONTEXT_QUICK; NBIF_RET(ARITY).