diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-02 21:13:03 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-02 21:13:03 +0300 |
commit | d8f9699debd435da5e1aef22c94c47154be4e2be (patch) | |
tree | 3c01f1844a4832378f1fd288821200abcdfc3988 /src | |
parent | a9b21a1d5c55939cf3db1f3d5c857760601adb3b (diff) | |
download | ejit-d8f9699debd435da5e1aef22c94c47154be4e2be.tar.gz ejit-d8f9699debd435da5e1aef22c94c47154be4e2be.zip |
fix big endian compilation
+ Code used some assumptions about type aliasing that might not hold for
all systems
Diffstat (limited to 'src')
-rw-r--r-- | src/ejit.c | 6 | ||||
-rw-r--r-- | src/interp.c | 13 |
2 files changed, 17 insertions, 2 deletions
@@ -1726,6 +1726,10 @@ struct ejit_arg ejit_run_func(struct ejit_func *f, size_t argc, struct ejit_arg }; case EJIT_UINT64: + return (struct ejit_arg){ + .u64 = ejit_run_func_l(f, argc, args), + .type = f->rtype + }; case EJIT_INT64: return (struct ejit_arg){ .i64 = ejit_run_func_l(f, argc, args), @@ -1734,7 +1738,7 @@ struct ejit_arg ejit_run_func(struct ejit_func *f, size_t argc, struct ejit_arg default: return (struct ejit_arg){ - .i64 = ejit_run_func_i(f, argc, args), + .l = ejit_run_func_i(f, argc, args), .type = f->rtype }; } diff --git a/src/interp.c b/src/interp.c index 2d9b7c7..049498a 100644 --- a/src/interp.c +++ b/src/interp.c @@ -984,7 +984,18 @@ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg pa DISPATCH(); DO(PARAM); - gpr[i.r2] = params[i.r0].u64; + switch (i.r1) { + case EJIT_INT8: gpr[i.r2] = params[i.r0].i8; break; + case EJIT_INT16: gpr[i.r2] = params[i.r0].i16; break; + case EJIT_INT32: gpr[i.r2] = params[i.r0].i32; break; + case EJIT_INT64: gpr[i.r2] = params[i.r0].i64; break; + case EJIT_UINT8: gpr[i.r2] = params[i.r0].u8; break; + case EJIT_UINT16: gpr[i.r2] = params[i.r0].u16; break; + case EJIT_UINT32: gpr[i.r2] = params[i.r0].u32; break; + case EJIT_UINT64: gpr[i.r2] = params[i.r0].u64; break; + case EJIT_POINTER: gpr[i.r2] = (int64_t)params[i.r0].p; break; + default: abort(); + } DISPATCH(); DO(PARAM_F); |