summaryrefslogtreecommitdiff
path: root/mjit_c.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 21:19:36 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 21:26:59 -0800
commitecc15bc94afc574b6f06478a8625d6364db5c7a9 (patch)
tree36cc57893c83f351c7a074b0039cb78e4b1a2a50 /mjit_c.c
parent9a84971315f39e3fabd382fd35728eb254333fe2 (diff)
MJIT: Rename mjit_compiler.c to mjit_c.c
It's no longer about the compiler logic itself.
Diffstat (limited to 'mjit_c.c')
-rw-r--r--mjit_c.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/mjit_c.c b/mjit_c.c
new file mode 100644
index 0000000000..ebb10b92e2
--- /dev/null
+++ b/mjit_c.c
@@ -0,0 +1,43 @@
+/**********************************************************************
+
+ mjit_c.c - C helpers for MJIT
+
+ Copyright (C) 2017 Takashi Kokubun <takashikkbn@gmail.com>.
+
+**********************************************************************/
+
+#include "ruby/internal/config.h" // defines USE_MJIT
+
+#if USE_MJIT
+
+#include "mjit.h"
+#include "mjit_c.h"
+#include "internal.h"
+#include "internal/compile.h"
+#include "internal/hash.h"
+#include "yjit.h"
+#include "vm_insnhelper.h"
+
+#include "insns.inc"
+#include "insns_info.inc"
+
+#include "mjit_compile_attr.inc"
+
+#if SIZEOF_LONG == SIZEOF_VOIDP
+#define NUM2PTR(x) NUM2ULONG(x)
+#define PTR2NUM(x) ULONG2NUM(x)
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+#define NUM2PTR(x) NUM2ULL(x)
+#define PTR2NUM(x) ULL2NUM(x)
+#endif
+
+// An offsetof implementation that works for unnamed struct and union.
+// Multiplying 8 for compatibility with libclang's offsetof.
+#define OFFSETOF(ptr, member) RB_SIZE2NUM(((char *)&ptr.member - (char*)&ptr) * 8)
+
+#define SIZEOF(type) RB_SIZE2NUM(sizeof(type))
+#define SIGNED_TYPE_P(type) RBOOL((type)(-1) < (type)(1))
+
+#include "mjit_c.rbinc"
+
+#endif // USE_MJIT