Allow specifying arbitrary MJIT flags by --jit-debug

This is a secret feature for me. It's only for testing and any behavior
with this flag override is unsupported.

I needed this because I sometimes want to add debug options but do not
want to disable optimizations, for using Linux perf.
This commit is contained in:
Takashi Kokubun 2019-12-01 00:56:27 -08:00
parent bdc62dfc8e
commit a19d625e66
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
5 changed files with 48 additions and 3 deletions

5
ruby.c
View file

@ -298,7 +298,7 @@ usage(const char *name, int help)
};
static const struct message mjit_options[] = {
M("--jit-warnings", "", "Enable printing JIT warnings"),
M("--jit-debug", "", "Enable JIT debugging (very slow)"),
M("--jit-debug", "", "Enable JIT debugging (very slow), or add cflags if specified"),
M("--jit-wait", "", "Wait until JIT compilation is finished everytime (for testing)"),
M("--jit-save-temps", "", "Save JIT temporary files in $TMP or /tmp (for testing)"),
M("--jit-verbose=num", "", "Print JIT logs of level num or less to stderr (default: 0)"),
@ -969,6 +969,9 @@ setup_mjit_options(const char *s, struct mjit_options *mjit_opt)
else if (strcmp(s, "-warnings") == 0) {
mjit_opt->warnings = 1;
}
else if (strncmp(s, "-debug=", 7) == 0) {
mjit_opt->debug_flags = strdup(s + 7);
}
else if (strcmp(s, "-debug") == 0) {
mjit_opt->debug = 1;
}