Add yjit/zjit bindings for adding namespace

This commit is contained in:
Satoshi Tagomori 2025-05-06 16:11:12 +09:00
parent 5ee1ec313a
commit e81d50207b
3 changed files with 65 additions and 10 deletions

View File

@ -9191,6 +9191,7 @@ jit.$(OBJEXT): $(top_srcdir)/internal/class.h
jit.$(OBJEXT): $(top_srcdir)/internal/compilers.h
jit.$(OBJEXT): $(top_srcdir)/internal/gc.h
jit.$(OBJEXT): $(top_srcdir)/internal/imemo.h
jit.$(OBJEXT): $(top_srcdir)/internal/namespace.h
jit.$(OBJEXT): $(top_srcdir)/internal/sanitizers.h
jit.$(OBJEXT): $(top_srcdir)/internal/serial.h
jit.$(OBJEXT): $(top_srcdir)/internal/set_table.h

View File

@ -258,6 +258,33 @@ pub const RSTRING_FSTR: ruby_rstring_flags = 536870912;
pub type ruby_rstring_flags = u32;
pub type st_data_t = ::std::os::raw::c_ulong;
pub type st_index_t = st_data_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct st_hash_type {
pub compare: ::std::option::Option<
unsafe extern "C" fn(arg1: st_data_t, arg2: st_data_t) -> ::std::os::raw::c_int,
>,
pub hash: ::std::option::Option<unsafe extern "C" fn(arg1: st_data_t) -> st_index_t>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct st_table_entry {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct st_table {
pub entry_power: ::std::os::raw::c_uchar,
pub bin_power: ::std::os::raw::c_uchar,
pub size_ind: ::std::os::raw::c_uchar,
pub rebuilds_num: ::std::os::raw::c_uint,
pub type_: *const st_hash_type,
pub num_entries: st_index_t,
pub bins: *mut st_index_t,
pub entries_start: st_index_t,
pub entries_bound: st_index_t,
pub entries: *mut st_table_entry,
}
pub const ST_CONTINUE: st_retval = 0;
pub const ST_STOP: st_retval = 1;
pub const ST_DELETE: st_retval = 2;
@ -345,7 +372,34 @@ pub const BOP_PACK: ruby_basic_operators = 32;
pub const BOP_INCLUDE_P: ruby_basic_operators = 33;
pub const BOP_LAST_: ruby_basic_operators = 34;
pub type ruby_basic_operators = u32;
#[repr(C)]
pub struct rb_namespace_struct {
pub ns_object: VALUE,
pub ns_id: ::std::os::raw::c_long,
pub top_self: VALUE,
pub load_path: VALUE,
pub load_path_snapshot: VALUE,
pub load_path_check_cache: VALUE,
pub expanded_load_path: VALUE,
pub loaded_features: VALUE,
pub loaded_features_snapshot: VALUE,
pub loaded_features_realpaths: VALUE,
pub loaded_features_realpath_map: VALUE,
pub loaded_features_index: *mut st_table,
pub loading_table: *mut st_table,
pub ruby_dln_libmap: VALUE,
pub gvar_tbl: VALUE,
pub is_builtin: bool,
pub is_user: bool,
pub is_optional: bool,
}
pub type rb_namespace_t = rb_namespace_struct;
pub type rb_serial_t = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rb_id_table {
_unused: [u8; 0],
}
pub const imemo_env: imemo_type = 0;
pub const imemo_cref: imemo_type = 1;
pub const imemo_svar: imemo_type = 2;
@ -434,11 +488,6 @@ pub const OPTIMIZED_METHOD_TYPE_STRUCT_AREF: method_optimized_type = 3;
pub const OPTIMIZED_METHOD_TYPE_STRUCT_ASET: method_optimized_type = 4;
pub const OPTIMIZED_METHOD_TYPE__MAX: method_optimized_type = 5;
pub type method_optimized_type = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rb_id_table {
_unused: [u8; 0],
}
pub type rb_num_t = ::std::os::raw::c_ulong;
pub const RUBY_TAG_NONE: ruby_tag_type = 0;
pub const RUBY_TAG_RETURN: ruby_tag_type = 1;
@ -538,6 +587,7 @@ pub type rb_control_frame_t = rb_control_frame_struct;
#[repr(C)]
pub struct rb_proc_t {
pub block: rb_block,
pub ns: *const rb_namespace_t,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub __bindgen_padding_0: [u8; 7usize],
@ -633,6 +683,8 @@ pub const VM_FRAME_FLAG_LAMBDA: vm_frame_env_flags = 256;
pub const VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM: vm_frame_env_flags = 512;
pub const VM_FRAME_FLAG_CFRAME_KW: vm_frame_env_flags = 1024;
pub const VM_FRAME_FLAG_PASSED: vm_frame_env_flags = 2048;
pub const VM_FRAME_FLAG_NS_SWITCH: vm_frame_env_flags = 4096;
pub const VM_FRAME_FLAG_LOAD_ISEQ: vm_frame_env_flags = 8192;
pub const VM_ENV_FLAG_LOCAL: vm_frame_env_flags = 2;
pub const VM_ENV_FLAG_ESCAPED: vm_frame_env_flags = 4;
pub const VM_ENV_FLAG_WB_REQUIRED: vm_frame_env_flags = 8;

View File

@ -212,6 +212,11 @@ pub const BOP_INCLUDE_P: ruby_basic_operators = 33;
pub const BOP_LAST_: ruby_basic_operators = 34;
pub type ruby_basic_operators = u32;
pub type rb_serial_t = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rb_id_table {
_unused: [u8; 0],
}
pub const imemo_env: imemo_type = 0;
pub const imemo_cref: imemo_type = 1;
pub const imemo_svar: imemo_type = 2;
@ -286,11 +291,6 @@ pub const OPTIMIZED_METHOD_TYPE_STRUCT_AREF: method_optimized_type = 3;
pub const OPTIMIZED_METHOD_TYPE_STRUCT_ASET: method_optimized_type = 4;
pub const OPTIMIZED_METHOD_TYPE__MAX: method_optimized_type = 5;
pub type method_optimized_type = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct rb_id_table {
_unused: [u8; 0],
}
pub type rb_num_t = ::std::os::raw::c_ulong;
pub const RUBY_TAG_NONE: ruby_tag_type = 0;
pub const RUBY_TAG_RETURN: ruby_tag_type = 1;
@ -391,6 +391,8 @@ pub const VM_FRAME_FLAG_LAMBDA: vm_frame_env_flags = 256;
pub const VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM: vm_frame_env_flags = 512;
pub const VM_FRAME_FLAG_CFRAME_KW: vm_frame_env_flags = 1024;
pub const VM_FRAME_FLAG_PASSED: vm_frame_env_flags = 2048;
pub const VM_FRAME_FLAG_NS_SWITCH: vm_frame_env_flags = 4096;
pub const VM_FRAME_FLAG_LOAD_ISEQ: vm_frame_env_flags = 8192;
pub const VM_ENV_FLAG_LOCAL: vm_frame_env_flags = 2;
pub const VM_ENV_FLAG_ESCAPED: vm_frame_env_flags = 4;
pub const VM_ENV_FLAG_WB_REQUIRED: vm_frame_env_flags = 8;