diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-10-22 17:40:09 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-10-22 17:43:44 +0300 |
commit | 7f7b22674ed8e9633cd0e47662508c3641e9f967 (patch) | |
tree | 6e692c9ec8f6cb0672f626d5be54601ec23aef63 /src/common.h | |
parent | 60a53db87421667a268f60b58c5a02eebb289d6b (diff) | |
download | ejit-7f7b22674ed8e9633cd0e47662508c3641e9f967.tar.gz ejit-7f7b22674ed8e9633cd0e47662508c3641e9f967.zip |
use type-specific vectors instead of generic ones
+ An attempt at speeding up function calls in the interpreted mode
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/common.h b/src/common.h index b7038d8..eb91409 100644 --- a/src/common.h +++ b/src/common.h @@ -1,7 +1,23 @@ #ifndef EJIT_COMMON_H #define EJIT_COMMON_H +#include <ejit/ejit.h> #include <stdbool.h> + +#define VEC_TYPE struct ejit_arg +#define VEC_NAME args +#include "vec.h" + +#define VEC_TYPE int64_t +#define VEC_NAME gprs +#include "vec.h" + +#define VEC_TYPE double +#define VEC_NAME fprs +#include "vec.h" + +#define VEC_TYPE size_t +#define VEC_NAME labels #include "vec.h" enum ejit_opcode { @@ -228,9 +244,13 @@ struct ejit_insn { }; }; +#define VEC_TYPE struct ejit_insn +#define VEC_NAME insns +#include "vec.h" + struct ejit_func { - struct vec insns; - struct vec labels; + struct insns insns; + struct labels labels; enum ejit_type rtype; size_t gpr; @@ -247,9 +267,9 @@ union interp_ret { }; struct interp_state { - struct vec gprs; - struct vec fprs; - struct vec args; + struct gprs gprs; + struct fprs fprs; + struct args args; }; union interp_ret ejit_interp(struct ejit_func *f, size_t argc, @@ -258,7 +278,10 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, void ***labels_wb); int64_t ejit_run_interp(struct ejit_func *f, size_t argc, - struct ejit_arg args[argc], struct interp_state *state); + struct ejit_arg args[static argc], struct interp_state *state); + +double ejit_run_interp_f(struct ejit_func *f, size_t argc, + struct ejit_arg args[static argc], struct interp_state *state); bool ejit_compile(struct ejit_func *f, bool use_64); |