aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-07 18:50:34 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-07 18:52:54 +0200
commitba9145b0b7af2a82c62f8dfa28807958af5d0c8d (patch)
tree52e14e07d82d57a305334f1300293d6b0af75aca /include
parent6d00dddef440590eaba9acdc9bbd093653d46519 (diff)
downloadejit-ba9145b0b7af2a82c62f8dfa28807958af5d0c8d.tar.gz
ejit-ba9145b0b7af2a82c62f8dfa28807958af5d0c8d.zip
make code a bit more robust
+ Should be more difficult to make mistakes in the future, ejit can now automatically keep track of how many register slots are used and if 64 bit mode is required. Slight runtime overhead, but not too bad.
Diffstat (limited to 'include')
-rw-r--r--include/ejit/ejit.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/ejit/ejit.h b/include/ejit/ejit.h
index 17fa0fb..aa7cc45 100644
--- a/include/ejit/ejit.h
+++ b/include/ejit/ejit.h
@@ -168,7 +168,7 @@ struct ejit_operand {
enum ejit_type type;
union {
- long r;
+ int64_t r;
double d;
};
};
@@ -178,8 +178,7 @@ struct ejit_func;
struct ejit_func *ejit_create_func(enum ejit_type rtype, size_t argc,
const struct ejit_operand args[argc]);
-void ejit_compile_func(struct ejit_func *f, size_t gpr, size_t fpr,
- bool use_64);
+void ejit_compile_func(struct ejit_func *f);
void ejit_select_compile_func(struct ejit_func *f, size_t gpr, size_t fpr,
bool use_64, bool try_jit);
@@ -532,6 +531,20 @@ static inline void ejit_stxi_ptr(struct ejit_func *s, struct ejit_gpr r0,
double: ejit_stxi_d, \
default: ejit_stxi_ptr)((f), (r0), (r1), (o))
+#define EJIT_STXR(f, t, r0, r1, r2) \
+ _Generic((t)(0), \
+ int8_t: ejit_stxr_8, \
+ uint8_t: ejit_stxr_8, \
+ int16_t: ejit_stxr_16, \
+ uint16_t: ejit_stxr_16, \
+ int32_t: ejit_stxr_32, \
+ uint32_t: ejit_stxr_32, \
+ int64_t: ejit_stxr_64, \
+ uint64_t: ejit_stxr_64, \
+ float: ejit_stxr_f, \
+ double: ejit_stxr_d, \
+ default: ejit_stxi_ptr)((f), (r0), (r1), (r2))
+
void ejit_stxr_8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1,
struct ejit_gpr r2);