mirror of
https://github.com/ruby/ruby.git
synced 2026-08-03 11:18:06 +08:00
Inline RHash ifnone offset into jit_bindgen_constants
This commit is contained in:
parent
51384f4bf9
commit
ff8e913048
Notes:
git
2026-07-08 22:20:41 +00:00
2
depend
2
depend
@ -7849,6 +7849,7 @@ jit.$(OBJEXT): $(top_srcdir)/internal/compile.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/compilers.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/fixnum.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/gc.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/hash.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/imemo.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/sanitizers.h
|
||||
jit.$(OBJEXT): $(top_srcdir)/internal/serial.h
|
||||
@ -8014,6 +8015,7 @@ jit.$(OBJEXT): {$(VPATH)}internal/has/declspec_attribute.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/has/extension.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/has/feature.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/has/warning.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/hash.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/intern/array.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/intern/bignum.h
|
||||
jit.$(OBJEXT): {$(VPATH)}internal/intern/class.h
|
||||
|
||||
6
hash.c
6
hash.c
@ -1468,12 +1468,6 @@ rb_zjit_hash_new_size(void)
|
||||
{
|
||||
return hash_slot_size(sizeof(st_table) > sizeof(ar_table));
|
||||
}
|
||||
|
||||
size_t
|
||||
rb_zjit_offset_rhash_ifnone(void)
|
||||
{
|
||||
return offsetof(struct RHash, ifnone);
|
||||
}
|
||||
#endif
|
||||
|
||||
static VALUE
|
||||
|
||||
4
jit.c
4
jit.c
@ -16,6 +16,7 @@
|
||||
#include "internal/gc.h"
|
||||
#include "vm_sync.h"
|
||||
#include "internal/fixnum.h"
|
||||
#include "internal/hash.h"
|
||||
#include "internal/string.h"
|
||||
#include "internal/class.h"
|
||||
#include "internal/imemo.h"
|
||||
@ -37,6 +38,9 @@ enum jit_bindgen_constants {
|
||||
// Field offset for fields_obj in T_DATA
|
||||
TDATA_OFFSET_FIELDS_OBJ = offsetof(struct RTypedData, fields_obj),
|
||||
|
||||
// Field offset for the RHash struct
|
||||
RUBY_OFFSET_RHASH_IFNONE = offsetof(struct RHash, ifnone),
|
||||
|
||||
// Field offsets for the RString struct
|
||||
RUBY_OFFSET_RSTRING_LEN = offsetof(struct RString, len),
|
||||
|
||||
|
||||
1
yjit/src/cruby_bindings.inc.rs
generated
1
yjit/src/cruby_bindings.inc.rs
generated
@ -988,6 +988,7 @@ pub const ROBJECT_OFFSET_AS_HEAP_FIELDS: jit_bindgen_constants = 16;
|
||||
pub const ROBJECT_OFFSET_AS_ARY: jit_bindgen_constants = 16;
|
||||
pub const RCLASS_OFFSET_PRIME_FIELDS_OBJ: jit_bindgen_constants = 40;
|
||||
pub const TDATA_OFFSET_FIELDS_OBJ: jit_bindgen_constants = 16;
|
||||
pub const RUBY_OFFSET_RHASH_IFNONE: jit_bindgen_constants = 16;
|
||||
pub const RUBY_OFFSET_RSTRING_LEN: jit_bindgen_constants = 16;
|
||||
pub const RB_SHAPE_FLAG_SHIFT: jit_bindgen_constants = 32;
|
||||
pub const RUBY_OFFSET_EC_CFP: jit_bindgen_constants = 16;
|
||||
|
||||
1
zjit.h
1
zjit.h
@ -78,7 +78,6 @@ void rb_zjit_invalidate_root_box(void);
|
||||
void rb_zjit_jit_frame_update_references(zjit_jit_frame_t *jit_frame);
|
||||
void rb_zjit_materialize_frames(const rb_execution_context_t *ec, rb_control_frame_t *cfp);
|
||||
size_t rb_zjit_hash_new_size(void);
|
||||
size_t rb_zjit_offset_rhash_ifnone(void);
|
||||
|
||||
// Special value for cfp->jit_return that means "this is a C method frame, use
|
||||
// rb_zjit_c_frame as the JITFrame". We don't control the native stack layout
|
||||
|
||||
@ -2273,9 +2273,6 @@ fn gen_new_hash(
|
||||
let alloc_size = unsafe { rb_zjit_hash_new_size() };
|
||||
let flags = RUBY_T_HASH as u64;
|
||||
let klass = unsafe { rb_cHash };
|
||||
let ifnone_offset: i32 = unsafe { rb_zjit_offset_rhash_ifnone() }
|
||||
.try_into()
|
||||
.expect("RHash ifnone offset should fit in i32");
|
||||
|
||||
let hash = gc_fastpath::gc_fast_path_new_obj(jit, asm, alloc_size, flags, klass, |asm| {
|
||||
asm_ccall!(asm, rb_hash_new,)
|
||||
@ -2283,7 +2280,7 @@ fn gen_new_hash(
|
||||
// TODO: this runs on the slow path too, where rb_hash_new already set
|
||||
// ifnone. A fast-path-only init hook in gc_fast_path_new_obj would avoid
|
||||
// the redundant store and be reusable for other types.
|
||||
asm.store(Opnd::mem(VALUE_BITS, hash, ifnone_offset), Qnil.into());
|
||||
asm.store(Opnd::mem(VALUE_BITS, hash, RUBY_OFFSET_RHASH_IFNONE), Qnil.into());
|
||||
hash
|
||||
} else {
|
||||
gen_prepare_non_leaf_call(jit, asm, state);
|
||||
|
||||
@ -124,8 +124,6 @@ unsafe extern "C" {
|
||||
|
||||
pub fn rb_zjit_offset_ractor_newobj_cache() -> usize;
|
||||
|
||||
pub fn rb_zjit_offset_rhash_ifnone() -> usize;
|
||||
|
||||
// Floats within range will be encoded without creating objects in the heap.
|
||||
// (Range is 0x3000000000000001 to 0x4fffffffffffffff (1.7272337110188893E-77 to 2.3158417847463237E+77).
|
||||
pub fn rb_float_new(d: f64) -> VALUE;
|
||||
|
||||
1
zjit/src/cruby_bindings.inc.rs
generated
1
zjit/src/cruby_bindings.inc.rs
generated
@ -1956,6 +1956,7 @@ pub const ROBJECT_OFFSET_AS_HEAP_FIELDS: jit_bindgen_constants = 16;
|
||||
pub const ROBJECT_OFFSET_AS_ARY: jit_bindgen_constants = 16;
|
||||
pub const RCLASS_OFFSET_PRIME_FIELDS_OBJ: jit_bindgen_constants = 40;
|
||||
pub const TDATA_OFFSET_FIELDS_OBJ: jit_bindgen_constants = 16;
|
||||
pub const RUBY_OFFSET_RHASH_IFNONE: jit_bindgen_constants = 16;
|
||||
pub const RUBY_OFFSET_RSTRING_LEN: jit_bindgen_constants = 16;
|
||||
pub const RB_SHAPE_FLAG_SHIFT: jit_bindgen_constants = 32;
|
||||
pub const RUBY_OFFSET_EC_CFP: jit_bindgen_constants = 16;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user