summaryrefslogtreecommitdiff
path: root/yjit.h
diff options
context:
space:
mode:
authorJose Narvaez <goyox86@gmail.com>2021-03-06 23:46:56 +0000
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:31 -0400
commit4e2eb7695e9b45cb5d2ae757bdb5c2043d78be78 (patch)
tree71e02cd04b191b9ce66801b67736cf69d831bd0b /yjit.h
parent7f7e79d80221949f93c7ded7cbd8d26afd3dea1d (diff)
downloadruby-4e2eb7695e9b45cb5d2ae757bdb5c2043d78be78.tar.gz
Yet Another Ruby JIT!
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
Diffstat (limited to 'yjit.h')
-rw-r--r--yjit.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/yjit.h b/yjit.h
new file mode 100644
index 0000000000..f2dfb31142
--- /dev/null
+++ b/yjit.h
@@ -0,0 +1,61 @@
+//
+// This file contains definitions YJIT exposes to the CRuby codebase
+//
+
+#ifndef YJIT_H
+#define YJIT_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 YJIT_CHECK_MODE
+#define YJIT_CHECK_MODE 0
+#endif
+
+// >= 1: print when output code invalidation happens
+// >= 2: dump list of instructions when regions compile
+#ifndef YJIT_DUMP_MODE
+#define YJIT_DUMP_MODE 0
+#endif
+
+#ifndef rb_iseq_t
+typedef struct rb_iseq_struct rb_iseq_t;
+#define rb_iseq_t rb_iseq_t
+#endif
+
+struct rb_yjit_options {
+ bool yjit_enabled;
+
+ // Number of method calls after which to start generating code
+ // Threshold==1 means compile on first execution
+ unsigned call_threshold;
+
+ // Capture and print out stats
+ bool gen_stats;
+};
+
+RUBY_SYMBOL_EXPORT_BEGIN
+bool rb_yjit_enabled_p(void);
+unsigned rb_yjit_call_threshold(void);
+RUBY_SYMBOL_EXPORT_END
+
+void rb_yjit_collect_vm_usage_insn(int insn);
+void rb_yjit_method_lookup_change(VALUE cme_or_cc);
+void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec);
+void rb_yjit_init(struct rb_yjit_options *options);
+void rb_yjit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_operators bop);
+void rb_yjit_constant_state_changed(void);
+void rb_yjit_iseq_mark(const struct rb_iseq_constant_body *body);
+void rb_yjit_iseq_update_references(const struct rb_iseq_constant_body *body);
+void rb_yjit_iseq_free(const struct rb_iseq_constant_body *body);
+void rb_yjit_before_ractor_spawn(void);
+
+#endif // #ifndef YJIT_H