diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2023-01-18 11:08:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 11:08:55 -0500 |
commit | cd97976328204263c464cf6846e9bafe6424da15 (patch) | |
tree | 5b9d2268be9f8e6927b9699b570d9b01dbf9e859 /yjit/src/asm | |
parent | 03f5db01e6be9b522d6fbbfb54f07d168c1a3a34 (diff) | |
download | ruby-cd97976328204263c464cf6846e9bafe6424da15.tar.gz |
Add stats so we can keep track of x86 rel32 vs register calls (#7142)
* Add stats so we can keep track of x86 rel32 vs register calls
To know if we get that "prime real estate" as Alan put it.
* Fix bug pointed by Alan
Diffstat (limited to 'yjit/src/asm')
-rw-r--r-- | yjit/src/asm/x86_64/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/yjit/src/asm/x86_64/mod.rs b/yjit/src/asm/x86_64/mod.rs index 1a0cb9cae7..67bb5d1ffb 100644 --- a/yjit/src/asm/x86_64/mod.rs +++ b/yjit/src/asm/x86_64/mod.rs @@ -690,6 +690,8 @@ pub fn call_rel32(cb: &mut CodeBlock, rel32: i32) { /// call - Call a pointer, encode with a 32-bit offset if possible pub fn call_ptr(cb: &mut CodeBlock, scratch_opnd: X86Opnd, dst_ptr: *const u8) { if let X86Opnd::Reg(_scratch_reg) = scratch_opnd { + use crate::stats::{incr_counter}; + // Pointer to the end of this call instruction let end_ptr = cb.get_ptr(cb.write_pos + 5); @@ -698,11 +700,13 @@ pub fn call_ptr(cb: &mut CodeBlock, scratch_opnd: X86Opnd, dst_ptr: *const u8) { // If the offset fits in 32-bit if rel64 >= i32::MIN.into() && rel64 <= i32::MAX.into() { + incr_counter!(x86_call_rel32); call_rel32(cb, rel64.try_into().unwrap()); return; } // Move the pointer into the scratch register and call + incr_counter!(x86_call_reg); mov(cb, scratch_opnd, const_ptr_opnd(dst_ptr)); call(cb, scratch_opnd); } else { |