builtin.h: avoid copy&paste

Instead of doubling the invokebuiltin logic here and there, use the same
insns.def definition for both MJIT/non-JIT situations.
This commit is contained in:
卜部昌平 2020-07-12 14:53:54 +09:00
parent 802bcd3ec8
commit 7e536b3be2
Notes: git 2020-07-13 08:56:51 +09:00
4 changed files with 24 additions and 38 deletions

View file

@ -80,20 +80,4 @@ struct builtin_binary {
size_t bin_size;
};
// mjit
RBIMPL_ATTR_MAYBE_UNUSED()
static void
mjit_invokebuiltin_default_compiler(FILE *f, const struct rb_builtin_function *bf, long index)
{
if (index >= 0) {
fprintf(f, "val = vm_invoke_builtin(ec, GET_CFP(), %p, STACK_ADDR_FROM_TOP(%d));\n",
(const void *)bf, bf->argc);
}
else {
fprintf(f, "val = vm_invoke_builtin_delegate(ec, GET_CFP(), %p, %ld);\n",
(const void *)bf, index);
}
}
#endif // BUILTIN_H_INCLUDED