summaryrefslogtreecommitdiff
path: root/ujit.h
blob: 04c8dcae291b023e19930785e5c04d1da8c92ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// This file contains definitions uJIT exposes to the CRuby codebase
//

#ifndef UJIT_H
#define UJIT_H 1

#include "stddef.h"
#include "stdint.h"
#include "stdbool.h"
#include "method.h"

#ifdef _WIN32
#define PLATFORM_SUPPORTED_P 0
#else
#define PLATFORM_SUPPORTED_P 1
#endif

#ifndef UJIT_CHECK_MODE
#define UJIT_CHECK_MODE 0
#endif

// >= 1: print when output code invalidation happens
// >= 2: dump list of instructions when regions compile
#ifndef UJIT_DUMP_MODE
#define UJIT_DUMP_MODE 0
#endif

#ifndef rb_iseq_t
typedef struct rb_iseq_struct rb_iseq_t;
#define rb_iseq_t rb_iseq_t
#endif

RUBY_SYMBOL_EXPORT_BEGIN
RUBY_EXTERN bool rb_ujit_enabled;
RUBY_SYMBOL_EXPORT_END

static inline
bool rb_ujit_enabled_p(void)
{
    return rb_ujit_enabled;
}

// Threshold==1 means compile on first execution
#define UJIT_CALL_THRESHOLD (2u)

void rb_ujit_method_lookup_change(VALUE cme_or_cc);
void rb_ujit_compile_iseq(const rb_iseq_t *iseq);
void rb_ujit_init(void);

#endif // #ifndef UJIT_H