summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zjit.rb2
-rw-r--r--zjit/src/codegen.rs1
-rw-r--r--zjit/src/stats.rs3
3 files changed, 6 insertions, 0 deletions
diff --git a/zjit.rb b/zjit.rb
index 9ea83fe10f..b62d8e2b52 100644
--- a/zjit.rb
+++ b/zjit.rb
@@ -197,6 +197,8 @@ class << RubyVM::ZJIT
:vm_write_to_parent_iseq_local_count,
:vm_read_from_parent_iseq_local_count,
+ :guard_type_count,
+
:code_region_bytes,
:side_exit_count,
:total_insn_count,
diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs
index bfbc8e88b9..2b71be0e15 100644
--- a/zjit/src/codegen.rs
+++ b/zjit/src/codegen.rs
@@ -1595,6 +1595,7 @@ fn gen_test(asm: &mut Assembler, val: lir::Opnd) -> lir::Opnd {
/// Compile a type check with a side exit
fn gen_guard_type(jit: &mut JITState, asm: &mut Assembler, val: lir::Opnd, guard_type: Type, state: &FrameState) -> lir::Opnd {
+ gen_incr_counter(asm, Counter::guard_type_count);
if guard_type.is_subtype(types::Fixnum) {
asm.test(val, Opnd::UImm(RUBY_FIXNUM_FLAG as u64));
asm.jz(side_exit(jit, state, GuardType(guard_type)));
diff --git a/zjit/src/stats.rs b/zjit/src/stats.rs
index 5ab81f9ac6..4874d0fe64 100644
--- a/zjit/src/stats.rs
+++ b/zjit/src/stats.rs
@@ -249,6 +249,9 @@ make_counters! {
vm_read_from_parent_iseq_local_count,
// TODO(max): Implement
// vm_reify_stack_count,
+
+ // The number of times we ran a dynamic check
+ guard_type_count,
}
/// Increase a counter by a specified amount