summaryrefslogtreecommitdiff
path: root/ujit_iface.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-02-23 15:22:20 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:30 -0400
commit0710bec01e405af596fa3e8e29ba38bb8176e39d (patch)
tree5917722657fa3a9ee00efb76bd4fd8ebd5a1586e /ujit_iface.c
parent58657b33e751ec0718f539bc9fa62f0ffa02801f (diff)
Implement --ujit-call-threshold
Diffstat (limited to 'ujit_iface.c')
-rw-r--r--ujit_iface.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/ujit_iface.c b/ujit_iface.c
index b9368b2fe1..9893c73467 100644
--- a/ujit_iface.c
+++ b/ujit_iface.c
@@ -24,12 +24,12 @@ VALUE cUjitBlock;
VALUE cUjitDisasm;
VALUE cUjitDisasmInsn;
-bool rb_ujit_enabled;
-
+#if RUBY_DEBUG
static int64_t vm_insns_count = 0;
int64_t rb_ujit_exec_insns_count = 0;
static int64_t exit_op_count[VM_INSTRUCTION_SIZE] = { 0 };
int64_t rb_compiled_iseq_count = 0;
+#endif
// Machine code blocks (executable memory)
extern codeblock_t *cb;
@@ -627,6 +627,16 @@ rb_ujit_iseq_free(const struct rb_iseq_constant_body *body)
rb_darray_free(body->ujit_blocks);
}
+bool rb_ujit_enabled_p(void)
+{
+ return rb_ujit_opts.ujit_enabled;
+}
+
+unsigned rb_ujit_call_threshold(void)
+{
+ return rb_ujit_opts.call_threshold;
+}
+
void
rb_ujit_init(struct rb_ujit_options *options)
{
@@ -636,8 +646,12 @@ rb_ujit_init(struct rb_ujit_options *options)
}
rb_ujit_opts = *options;
+ rb_ujit_opts.ujit_enabled = true;
- rb_ujit_enabled = true;
+ // Normalize options
+ if (rb_ujit_opts.call_threshold < 1) {
+ rb_ujit_opts.call_threshold = 10;
+ }
ujit_init_core();
ujit_init_codegen();