diff options
author | Noah Gibbs (and/or Benchmark CI) <noah.gibbs@shopify.com> | 2022-05-25 16:31:38 +0000 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2022-05-26 13:06:47 -0400 |
commit | ba88787087b0d979f806e6b58cfbc3886d942968 (patch) | |
tree | 1ed25c3452df88940c8471c994f4d2c550237ab6 /yjit/src/stats.rs | |
parent | bd472ef36f22de176a886cbe789480e84990b82b (diff) |
Use bindgen to import CRuby constants for YARV instruction bytecodes
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5948
Diffstat (limited to 'yjit/src/stats.rs')
-rw-r--r-- | yjit/src/stats.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index 7fbf132e18..3b7a3f31d9 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -9,7 +9,8 @@ use crate::options::*; use crate::yjit::yjit_enabled_p; // YJIT exit counts for each instruction type -static mut EXIT_OP_COUNT: [u64; VM_INSTRUCTION_SIZE] = [0; VM_INSTRUCTION_SIZE]; +const VM_INSTRUCTION_SIZE_USIZE:usize = VM_INSTRUCTION_SIZE as usize; +static mut EXIT_OP_COUNT: [u64; VM_INSTRUCTION_SIZE_USIZE] = [0; VM_INSTRUCTION_SIZE_USIZE]; // Macro to declare the stat counters macro_rules! make_counters { @@ -218,7 +219,7 @@ fn rb_yjit_gen_stats_dict() -> VALUE { // For each entry in exit_op_count, add a stats entry with key "exit_INSTRUCTION_NAME" // and the value is the count of side exits for that instruction. - for op_idx in 0..VM_INSTRUCTION_SIZE { + for op_idx in 0..VM_INSTRUCTION_SIZE_USIZE { let op_name = insn_name(op_idx); let key_string = "exit_".to_owned() + &op_name; let key = rust_str_to_sym(&key_string); @@ -234,7 +235,7 @@ fn rb_yjit_gen_stats_dict() -> VALUE { #[no_mangle] pub extern "C" fn rb_yjit_reset_stats_bang(_ec: EcPtr, _ruby_self: VALUE) -> VALUE { unsafe { - EXIT_OP_COUNT = [0; VM_INSTRUCTION_SIZE]; + EXIT_OP_COUNT = [0; VM_INSTRUCTION_SIZE_USIZE]; COUNTERS = Counters::default(); } |