summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-09-19 16:34:03 +0900
committerGitHub <noreply@github.com>2022-09-19 16:34:03 +0900
commit5883bc7c0791de2ce5e8b22175aef07705f0c618 (patch)
tree2866c5492ca87e91574840df1f605cb158916d6c /yjit
parentae07336529ee0955bb08b12eb69a90aa9ab4b9f9 (diff)
YJIT: Check if the processor supports --yjit-stats (#6401)
* YJIT: Add asm comment for incr_counter * YJIT: Check if the processor supports --yjit-stats
Notes
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs1
-rw-r--r--yjit/src/options.rs11
2 files changed, 11 insertions, 1 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index ef7c3386a2..a61795f5d4 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -209,6 +209,7 @@ macro_rules! gen_counter_incr {
let ptr = ptr_to_counter!($counter_name);
// Load the pointer into a register
+ $asm.comment(&format!("increment counter {}", stringify!($counter_name)));
let ptr_reg = $asm.load(Opnd::const_ptr(ptr as *const u8));
let counter_opnd = Opnd::mem(64, ptr_reg, 0);
diff --git a/yjit/src/options.rs b/yjit/src/options.rs
index f73dca67de..cad7bf332a 100644
--- a/yjit/src/options.rs
+++ b/yjit/src/options.rs
@@ -151,7 +151,16 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
("greedy-versioning", "") => unsafe { OPTIONS.greedy_versioning = true },
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
- ("stats", "") => unsafe { OPTIONS.gen_stats = true },
+ ("stats", "") => {
+ // Insn::IncrCounter uses ldaddal, which works only on ARMv8.1+.
+ #[cfg(target_arch = "aarch64")]
+ if !std::arch::is_aarch64_feature_detected!("lse") {
+ eprintln!("Your processor does not support --yjit-stats. Aborting.");
+ std::process::exit(1);
+ }
+
+ unsafe { OPTIONS.gen_stats = true }
+ },
("trace-exits", "") => unsafe { OPTIONS.gen_trace_exits = true; OPTIONS.gen_stats = true },
("dump-insns", "") => unsafe { OPTIONS.dump_insns = true },
("verify-ctx", "") => unsafe { OPTIONS.verify_ctx = true },