summaryrefslogtreecommitdiff
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-03-17 16:43:04 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-03-17 17:32:06 -0400
commitb9f411b3a855f13b3ab9f5b0fa9845a078e1bc93 (patch)
tree31a1af9628a45a04deb30afc5df3c7df8a1a6d3a /yjit
parent6ba07df4908d4d9d01ece339219e3b9e07ad1bce (diff)
YJIT: Simplify using the BITS associated constant
All the integer types have it.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7563
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index e8cd256b4f..fd40e7ea13 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -16,7 +16,7 @@ use std::cell::Cell;
use std::cmp;
use std::collections::HashMap;
use std::ffi::CStr;
-use std::mem::{self, size_of};
+use std::mem;
use std::os::raw::{c_int};
use std::ptr;
use std::rc::Rc;
@@ -1551,7 +1551,7 @@ fn gen_expandarray(
let flags_opnd = Opnd::mem(VALUE_BITS, array_reg, RUBY_OFFSET_RBASIC_FLAGS);
asm.test(flags_opnd, Opnd::UImm(RARRAY_EMBED_FLAG as u64));
let heap_ptr_opnd = Opnd::mem(
- (8 * size_of::<usize>()) as u8,
+ usize::BITS as u8,
asm.load(array_opnd),
RUBY_OFFSET_RARRAY_AS_HEAP_PTR,
);
@@ -4381,7 +4381,7 @@ fn jit_rb_str_empty_p(
asm.comment("get string length");
let str_len_opnd = Opnd::mem(
- (8 * size_of::<std::os::raw::c_long>()) as u8,
+ std::os::raw::c_long::BITS as u8,
asm.load(recv_opnd),
RUBY_OFFSET_RSTRING_AS_HEAP_LEN as i32,
);
@@ -5148,7 +5148,7 @@ fn get_array_len(asm: &mut Assembler, array_opnd: Opnd) -> Opnd {
_ => asm.load(array_opnd),
};
let array_len_opnd = Opnd::mem(
- (8 * size_of::<std::os::raw::c_long>()) as u8,
+ std::os::raw::c_long::BITS as u8,
array_reg,
RUBY_OFFSET_RARRAY_AS_HEAP_LEN,
);
@@ -5164,7 +5164,7 @@ fn get_array_ptr(asm: &mut Assembler, array_reg: Opnd) -> Opnd {
let flags_opnd = Opnd::mem(VALUE_BITS, array_reg, RUBY_OFFSET_RBASIC_FLAGS);
asm.test(flags_opnd, (RARRAY_EMBED_FLAG as u64).into());
let heap_ptr_opnd = Opnd::mem(
- (8 * size_of::<usize>()) as u8,
+ usize::BITS as u8,
array_reg,
RUBY_OFFSET_RARRAY_AS_HEAP_PTR,
);
@@ -5196,7 +5196,7 @@ fn move_rest_args_to_stack(array: Opnd, num_args: u32, ctx: &mut Context, asm: &
let flags_opnd = Opnd::mem(VALUE_BITS, array_reg, RUBY_OFFSET_RBASIC_FLAGS);
asm.test(flags_opnd, Opnd::UImm(RARRAY_EMBED_FLAG as u64));
let heap_ptr_opnd = Opnd::mem(
- (8 * size_of::<usize>()) as u8,
+ usize::BITS as u8,
array_reg,
RUBY_OFFSET_RARRAY_AS_HEAP_PTR,
);
@@ -5246,7 +5246,7 @@ fn push_splat_args(required_args: u32, ctx: &mut Context, asm: &mut Assembler, o
let array_reg = asm.load(array_opnd);
let array_len_opnd = Opnd::mem(
- (8 * size_of::<std::os::raw::c_long>()) as u8,
+ std::os::raw::c_long::BITS as u8,
array_reg,
RUBY_OFFSET_RARRAY_AS_HEAP_LEN,
);
@@ -5283,7 +5283,7 @@ fn push_splat_args(required_args: u32, ctx: &mut Context, asm: &mut Assembler, o
let flags_opnd = Opnd::mem(VALUE_BITS, array_reg, RUBY_OFFSET_RBASIC_FLAGS);
asm.test(flags_opnd, Opnd::UImm(RARRAY_EMBED_FLAG as u64));
let heap_ptr_opnd = Opnd::mem(
- (8 * size_of::<usize>()) as u8,
+ usize::BITS as u8,
array_reg,
RUBY_OFFSET_RARRAY_AS_HEAP_PTR,
);