diff options
Diffstat (limited to 'mjit_c.c')
-rw-r--r-- | mjit_c.c | 43 |
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 |