summaryrefslogtreecommitdiff
path: root/ujit_compile.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-09-28 07:03:28 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:24 -0400
commite8c914c2502f6049ebc5bd93e8db0c62dd14400e (patch)
treec9f8f324366e0a44eba7f89aac117306f83c2e72 /ujit_compile.c
parentf3c961f273d3fa305c9ebea57e5d1ff96f241e19 (diff)
Implement the --disable-ujit command line option
Diffstat (limited to 'ujit_compile.c')
-rw-r--r--ujit_compile.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ujit_compile.c b/ujit_compile.c
index be74f5f0e0..9097d78b8a 100644
--- a/ujit_compile.c
+++ b/ujit_compile.c
@@ -182,10 +182,8 @@ https://wiki.osdev.org/System_V_ABI#x86-64
uint8_t *
ujit_compile_insn(rb_iseq_t *iseq, unsigned int insn_idx, unsigned int* next_ujit_idx)
{
- // If not previously done, initialize ujit
- if (!cb)
- {
- ujit_init();
+ if (!cb) {
+ return NULL;
}
// NOTE: if we are ever deployed in production, we
@@ -379,7 +377,14 @@ void gen_setlocal_wc0(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx)
mov(cb, mem_opnd(64, RDX, offs), RCX);
}
-static void ujit_init()
+bool
+rb_ujit_enabled_p(void)
+{
+ return !!cb;
+}
+
+void
+rb_ujit_init(void)
{
// Initialize the code blocks
size_t mem_size = 64 * 1024 * 1024;