summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2024-01-29 16:17:12 -0500
committerGitHub <noreply@github.com>2024-01-29 16:17:12 -0500
commitbc10b958d2cc45b61e23c41d0aa892cbb82efafd (patch)
treeb65b523d1a10d4afca094686d69d2a3a8ad19156
parent32bbf4750097f7b3358e06e9d8efd81a2089d139 (diff)
YJIT: print warning when disasm options used without a dev build (#9744)
* YJIT: print warning when disasm options used without a dev build I was confused for a few minutes the other way then --yjit-dump-disasm printed nothing, so I figured this would be useful for end-users (and future me). * Fix lone extraneous space
-rw-r--r--yjit/src/options.rs30
1 files changed, 20 insertions, 10 deletions
diff --git a/yjit/src/options.rs b/yjit/src/options.rs
index 5a60bc8f49..9a146512bb 100644
--- a/yjit/src/options.rs
+++ b/yjit/src/options.rs
@@ -228,21 +228,31 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
_ => return None,
},
- ("dump-disasm", _) => match opt_val {
- "" => unsafe { OPTIONS.dump_disasm = Some(DumpDisasm::Stdout) },
- directory => {
- let path = format!("{directory}/yjit_{}.log", std::process::id());
- match File::options().create(true).append(true).open(&path) {
- Ok(_) => {
- eprintln!("YJIT disasm dump: {path}");
- unsafe { OPTIONS.dump_disasm = Some(DumpDisasm::File(path)) }
+ ("dump-disasm", _) => {
+ if !cfg!(feature = "disasm") {
+ eprintln!("WARNING: the {} option is only available when YJIT is built in dev mode, i.e. ./configure --enable-yjit=dev", opt_name);
+ }
+
+ match opt_val {
+ "" => unsafe { OPTIONS.dump_disasm = Some(DumpDisasm::Stdout) },
+ directory => {
+ let path = format!("{directory}/yjit_{}.log", std::process::id());
+ match File::options().create(true).append(true).open(&path) {
+ Ok(_) => {
+ eprintln!("YJIT disasm dump: {path}");
+ unsafe { OPTIONS.dump_disasm = Some(DumpDisasm::File(path)) }
+ }
+ Err(err) => eprintln!("Failed to create {path}: {err}"),
}
- Err(err) => eprintln!("Failed to create {path}: {err}"),
}
}
- },
+ },
("dump-iseq-disasm", _) => unsafe {
+ if !cfg!(feature = "disasm") {
+ eprintln!("WARNING: the {} option is only available when YJIT is built in dev mode, i.e. ./configure --enable-yjit=dev", opt_name);
+ }
+
OPTIONS.dump_iseq_disasm = Some(opt_val.to_string());
},