aboutsummaryrefslogtreecommitdiff
path: root/src/compile/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile/compile.c')
-rw-r--r--src/compile/compile.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/compile/compile.c b/src/compile/compile.c
index 490bc43..c979305 100644
--- a/src/compile/compile.c
+++ b/src/compile/compile.c
@@ -19,6 +19,27 @@ struct reloc_helper {
#define VEC_NAME addrs
#include "../vec.h"
+/* skip assertions since we know they must be valid due to type checking earlier */
+static long checked_run_i(struct ejit_func *f, size_t argc, struct ejit_arg args[argc])
+{
+ return ejit_run(f, argc, args, true, NULL).i;
+}
+
+static int64_t checked_run_l(struct ejit_func *f, size_t argc, struct ejit_arg args[argc])
+{
+ return ejit_run(f, argc, args, true, NULL).i;
+}
+
+static float checked_run_f(struct ejit_func *f, size_t argc, struct ejit_arg args[argc])
+{
+ return ejit_run(f, argc, args, true, NULL).f;
+}
+
+static double checked_run_d(struct ejit_func *f, size_t argc, struct ejit_arg args[argc])
+{
+ return ejit_run(f, argc, args, true, NULL).f;
+}
+
static void *alloc_arena(size_t size, bool im_scawed)
{
return mmap(NULL, size,
@@ -2217,15 +2238,15 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
case CALLI_L:
#if __WORDSIZE == 64
- call = ejit_run_func_l; goto calli;
+ call = checked_run_l; goto calli;
#else
assert(0 && "trying to compile calli_l on 32bit arch");
break;
#endif
- case CALLI_F: { call = ejit_run_func_f; goto calli; }
- case CALLI_D: { call = ejit_run_func_d; goto calli; }
- case CALLI_I: { call = ejit_run_func_i; goto calli;
+ case CALLI_F: { call = checked_run_f; goto calli; }
+ case CALLI_D: { call = checked_run_d; goto calli; }
+ case CALLI_I: { call = checked_run_i; goto calli;
calli:
save_caller_save_regs(f, j);
@@ -2425,7 +2446,7 @@ static size_t align_up(size_t a, size_t n)
bool ejit_compile(struct ejit_func *f, bool use_64, bool im_scawed)
{
(void)use_64;
-#if __WORDSIZE == 32
+#if __WORDSIZE != 64
/* can't compile 64bit code on 32bit systems, give up early */
if (use_64)
return false;