Yet Another Ruby JIT!

Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
This commit is contained in:
Jose Narvaez 2021-03-06 23:46:56 +00:00 committed by Alan Wu
parent 7f7e79d802
commit 4e2eb7695e
36 changed files with 1312 additions and 1320 deletions

28
ruby.c
View file

@ -59,7 +59,7 @@
#include "internal/process.h"
#include "internal/variable.h"
#include "mjit.h"
#include "ujit.h"
#include "yjit.h"
#include "ruby/encoding.h"
#include "ruby/thread.h"
#include "ruby/util.h"
@ -105,7 +105,7 @@ void rb_warning_category_update(unsigned int mask, unsigned int bits);
SEP \
X(jit) \
SEP \
X(ujit)
X(yjit)
/* END OF FEATURES */
#define EACH_DEBUG_FEATURES(X, SEP) \
X(frozen_string_literal) \
@ -189,7 +189,7 @@ struct ruby_cmdline_options {
#if USE_MJIT
struct mjit_options mjit;
#endif
struct rb_ujit_options ujit;
struct rb_yjit_options yjit;
int sflag, xflag;
unsigned int warning: 1;
@ -234,7 +234,7 @@ cmdline_options_init(ruby_cmdline_options_t *opt)
#ifdef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */
opt->features.set |= FEATURE_BIT(jit);
#endif
opt->features.set |= FEATURE_BIT(ujit);
opt->features.set |= FEATURE_BIT(yjit);
return opt;
}
@ -333,7 +333,7 @@ usage(const char *name, int help, int highlight, int columns)
M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
M("frozen-string-literal", "", "freeze all string literals (default: disabled)"),
M("jit", "", "JIT compiler (default: disabled)"),
M("ujit", "", "in-process JIT compiler (default: enabled)"),
M("yjit", "", "in-process JIT compiler (default: enabled)"),
};
static const struct message warn_categories[] = {
M("deprecated", "", "deprecated features"),
@ -1031,20 +1031,20 @@ set_option_encoding_once(const char *type, VALUE *name, const char *e, long elen
opt_match(s, l, name) && (*(s) ? 1 : (rb_raise(rb_eRuntimeError, "--jit-" name " needs an argument"), 0))
static void
setup_ujit_options(const char *s, struct rb_ujit_options *ujit_opt)
setup_yjit_options(const char *s, struct rb_yjit_options *yjit_opt)
{
if (*s != '-') return;
const size_t l = strlen(++s);
if (opt_match_arg(s, l, "call-threshold")) {
ujit_opt->call_threshold = atoi(s + 1);
yjit_opt->call_threshold = atoi(s + 1);
}
else if (opt_match_noarg(s, l, "stats")) {
ujit_opt->gen_stats = true;
yjit_opt->gen_stats = true;
}
else {
rb_raise(rb_eRuntimeError,
"invalid ujit option `%s' (--help will show valid ujit options)", s);
"invalid yjit option `%s' (--help will show valid yjit options)", s);
}
}
@ -1461,9 +1461,9 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
rb_warn("MJIT support is disabled.");
#endif
}
else if (strncmp("ujit", s, 4) == 0) {
FEATURE_SET(opt->features, FEATURE_BIT(ujit));
setup_ujit_options(s + 4, &opt->ujit);
else if (strncmp("yjit", s, 4) == 0) {
FEATURE_SET(opt->features, FEATURE_BIT(yjit));
setup_yjit_options(s + 4, &opt->yjit);
}
else if (strcmp("yydebug", s) == 0) {
if (envopt) goto noenvopt_long;
@ -1825,8 +1825,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
*/
rb_warning("-K is specified; it is for 1.8 compatibility and may cause odd behavior");
if (opt->features.set & FEATURE_BIT(ujit))
rb_ujit_init(&opt->ujit);
if (opt->features.set & FEATURE_BIT(yjit))
rb_yjit_init(&opt->yjit);
#if USE_MJIT
if (opt->features.set & FEATURE_BIT(jit)) {
opt->mjit.on = TRUE; /* set mjit.on for ruby_show_version() API and check to call mjit_init() */