summaryrefslogtreecommitdiff
path: root/yjit/bindgen/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'yjit/bindgen/src/main.rs')
-rw-r--r--yjit/bindgen/src/main.rs162
1 files changed, 40 insertions, 122 deletions
diff --git a/yjit/bindgen/src/main.rs b/yjit/bindgen/src/main.rs
index 8376b593b2..373d5abb42 100644
--- a/yjit/bindgen/src/main.rs
+++ b/yjit/bindgen/src/main.rs
@@ -47,6 +47,7 @@ fn main() {
// Our C file for glue code
.header(src_root.join("yjit.c").to_str().unwrap())
+ .header(src_root.join("jit.c").to_str().unwrap())
// Don't want to copy over C comment
.generate_comments(false)
@@ -64,71 +65,46 @@ fn main() {
// Import YARV bytecode instruction constants
.allowlist_type("ruby_vminsn_type")
- // From include/ruby/internal/special_consts.h
.allowlist_type("ruby_special_consts")
-
- // From include/ruby/internal/intern/string.h
.allowlist_function("rb_utf8_str_new")
.allowlist_function("rb_str_buf_append")
.allowlist_function("rb_str_dup")
-
- // From encindex.h
.allowlist_type("ruby_preserved_encindex")
-
- // From include/ruby/ruby.h
.allowlist_function("rb_class2name")
// This struct is public to Ruby C extensions
- // From include/ruby/internal/core/rbasic.h
.allowlist_type("RBasic")
- // From include/ruby/internal/core/rstring.h
.allowlist_type("ruby_rstring_flags")
- // From internal.h
// This function prints info about a value and is useful for debugging
.allowlist_function("rb_obj_info_dump")
// For crashing
.allowlist_function("rb_bug")
- // From shape.h
- .allowlist_function("rb_shape_get_shape_id")
- .allowlist_function("rb_shape_get_shape_by_id")
+ .allowlist_function("rb_obj_shape_id")
.allowlist_function("rb_shape_id_offset")
.allowlist_function("rb_shape_get_iv_index")
- .allowlist_function("rb_shape_get_next_no_warnings")
- .allowlist_function("rb_shape_id")
- .allowlist_function("rb_shape_obj_too_complex")
+ .allowlist_function("rb_shape_transition_add_ivar_no_warnings")
+ .allowlist_function("rb_yjit_shape_obj_complex_p")
+ .allowlist_function("rb_yjit_shape_capacity")
+ .allowlist_function("rb_yjit_shape_index")
.allowlist_var("SHAPE_ID_NUM_BITS")
- .allowlist_var("OBJ_TOO_COMPLEX_SHAPE_ID")
-
- // From ruby/internal/intern/object.h
+ .allowlist_type("shape_id_mask")
+ .allowlist_function("rb_funcall")
.allowlist_function("rb_obj_is_kind_of")
.allowlist_function("rb_obj_frozen_p")
-
- // From ruby/internal/encoding/encoding.h
.allowlist_type("ruby_encoding_consts")
-
- // From include/hash.h
.allowlist_function("rb_hash_new")
-
- // From internal/hash.h
.allowlist_function("rb_hash_new_with_size")
.allowlist_function("rb_hash_resurrect")
- .allowlist_function("rb_hash_stlike_foreach")
.allowlist_function("rb_to_hash_type")
-
- // From include/ruby/st.h
.allowlist_type("st_retval")
-
- // From include/ruby/internal/intern/hash.h
.allowlist_function("rb_hash_aset")
.allowlist_function("rb_hash_aref")
.allowlist_function("rb_hash_bulk_insert")
.allowlist_function("rb_hash_stlike_lookup")
-
- // From include/ruby/internal/intern/array.h
.allowlist_function("rb_ary_new_capa")
.allowlist_function("rb_ary_store")
.allowlist_function("rb_ary_resurrect")
@@ -138,26 +114,17 @@ fn main() {
.allowlist_function("rb_ary_push")
.allowlist_function("rb_ary_unshift_m")
.allowlist_function("rb_yjit_rb_ary_subseq_length")
-
- // From internal/array.h
.allowlist_function("rb_ec_ary_new_from_values")
.allowlist_function("rb_ary_tmp_new_from_values")
-
- // From include/ruby/internal/intern/class.h
.allowlist_function("rb_class_attached_object")
.allowlist_function("rb_singleton_class")
-
- // From include/ruby/internal/core/rclass.h
.allowlist_function("rb_class_get_superclass")
-
- // From include/ruby/internal/gc.h
.allowlist_function("rb_gc_mark")
.allowlist_function("rb_gc_mark_movable")
.allowlist_function("rb_gc_location")
.allowlist_function("rb_gc_writebarrier")
// VALUE variables for Ruby class objects
- // From include/ruby/internal/globals.h
.allowlist_var("rb_cBasicObject")
.allowlist_var("rb_cModule")
.allowlist_var("rb_cNilClass")
@@ -174,84 +141,54 @@ fn main() {
.allowlist_var("rb_cHash")
.allowlist_var("rb_cClass")
- // From include/ruby/internal/fl_type.h
.allowlist_type("ruby_fl_type")
.allowlist_type("ruby_fl_ushift")
-
- // From include/ruby/internal/core/robject.h
.allowlist_type("ruby_robject_flags")
-
- // From include/ruby/internal/core/rarray.h
.allowlist_type("ruby_rarray_flags")
.allowlist_type("ruby_rarray_consts")
-
- // From include/ruby/internal/core/rclass.h
.allowlist_type("ruby_rmodule_flags")
-
- // From ruby/internal/globals.h
.allowlist_var("rb_mKernel")
-
- // From vm_callinfo.h
.allowlist_type("vm_call_flag_bits")
.allowlist_type("rb_call_data")
.blocklist_type("rb_callcache.*") // Not used yet - opaque to make it easy to import rb_call_data
.opaque_type("rb_callcache.*")
.allowlist_type("rb_callinfo")
-
- // From vm_insnhelper.h
.allowlist_var("VM_ENV_DATA_INDEX_ME_CREF")
+ .allowlist_var("VM_KW_SPECIFIED_BITS_MAX")
.allowlist_var("rb_block_param_proxy")
-
- // From include/ruby/internal/intern/range.h
.allowlist_function("rb_range_new")
-
- // From include/ruby/internal/symbol.h
.allowlist_function("rb_intern")
.allowlist_function("rb_intern2")
.allowlist_function("rb_id2sym")
.allowlist_function("rb_id2name")
.allowlist_function("rb_sym2id")
.allowlist_function("rb_str_intern")
-
- // From internal/numeric.h
.allowlist_function("rb_fix_aref")
.allowlist_function("rb_float_plus")
.allowlist_function("rb_float_minus")
.allowlist_function("rb_float_mul")
.allowlist_function("rb_float_div")
-
- // From internal/string.h
.allowlist_type("ruby_rstring_private_flags")
.allowlist_function("rb_ec_str_resurrect")
.allowlist_function("rb_str_concat_literals")
.allowlist_function("rb_obj_as_string_result")
.allowlist_function("rb_str_byte_substr")
.allowlist_function("rb_str_substr_two_fixnums")
-
- // From include/ruby/internal/intern/parse.h
.allowlist_function("rb_backref_get")
-
- // From include/ruby/internal/intern/re.h
.allowlist_function("rb_reg_last_match")
.allowlist_function("rb_reg_match_pre")
.allowlist_function("rb_reg_match_post")
.allowlist_function("rb_reg_match_last")
.allowlist_function("rb_reg_nth_match")
-
- // From internal/re.h
- .allowlist_function("rb_reg_new_ary")
+ .allowlist_function("rb_reg_new_from_values")
// `ruby_value_type` is a C enum and this stops it from
// prefixing all the members with the name of the type
.prepend_enum_name(false)
.translate_enum_integer_types(true) // so we get fixed width Rust types for members
- // From include/ruby/internal/value_type.h
.allowlist_type("ruby_value_type") // really old C extension API
- // From include/ruby/internal/hash.h
.allowlist_type("ruby_rhash_flags") // really old C extension API
-
- // From method.h
.allowlist_type("rb_method_visibility_t")
.allowlist_type("rb_method_type_t")
.allowlist_type("method_optimized_type")
@@ -262,11 +199,8 @@ fn main() {
.blocklist_type("rb_method_cfunc_t")
.blocklist_type("rb_method_definition_.*") // Large struct with a bitfield and union of many types - don't import (yet?)
.opaque_type("rb_method_definition_.*")
-
- // From numeric.c
.allowlist_function("rb_float_new")
-
- // From vm_core.h
+ .allowlist_var("rb_cRubyVM")
.allowlist_var("rb_mRubyVMFrozenCore")
.allowlist_var("VM_BLOCK_HANDLER_NONE")
.allowlist_type("vm_frame_env_flags")
@@ -304,97 +238,82 @@ fn main() {
.allowlist_type("vm_check_match_type")
.allowlist_type("vm_opt_newarray_send_type")
.allowlist_type("rb_iseq_type")
-
- // From yjit.c
.allowlist_function("rb_object_shape_count")
+ .allowlist_function("rb_ivar_get_at")
+ .allowlist_function("rb_ivar_get_at_no_ractor_check")
.allowlist_function("rb_iseq_(get|set)_yjit_payload")
.allowlist_function("rb_iseq_pc_at_idx")
.allowlist_function("rb_iseq_opcode_at_pc")
- .allowlist_function("rb_yjit_reserve_addr_space")
- .allowlist_function("rb_yjit_mark_writable")
- .allowlist_function("rb_yjit_mark_executable")
- .allowlist_function("rb_yjit_mark_unused")
- .allowlist_function("rb_yjit_get_page_size")
- .allowlist_function("rb_yjit_iseq_builtin_attrs")
+ .allowlist_function("rb_jit_reserve_addr_space")
+ .allowlist_function("rb_jit_mark_writable")
+ .allowlist_function("rb_jit_mark_executable")
+ .allowlist_function("rb_jit_mark_unused")
+ .allowlist_function("rb_jit_get_page_size")
+ .allowlist_function("rb_jit_iseq_builtin_attrs")
.allowlist_function("rb_yjit_iseq_inspect")
.allowlist_function("rb_yjit_builtin_function")
.allowlist_function("rb_set_cfp_(pc|sp)")
- .allowlist_function("rb_yjit_multi_ractor_p")
.allowlist_function("rb_c_method_tracing_currently_enabled")
.allowlist_function("rb_full_cfunc_return")
- .allowlist_function("rb_yjit_vm_lock_then_barrier")
- .allowlist_function("rb_yjit_vm_unlock")
.allowlist_function("rb_assert_(iseq|cme)_handle")
.allowlist_function("rb_IMEMO_TYPE_P")
.allowlist_function("rb_yjit_constcache_shareable")
.allowlist_function("rb_iseq_reset_jit_func")
.allowlist_function("rb_yjit_dump_iseq_loc")
- .allowlist_function("rb_yjit_for_each_iseq")
.allowlist_function("rb_yjit_obj_written")
.allowlist_function("rb_yjit_str_simple_append")
.allowlist_function("rb_RSTRING_PTR")
.allowlist_function("rb_RSTRING_LEN")
.allowlist_function("rb_ENCODING_GET")
- .allowlist_function("rb_yjit_get_proc_ptr")
+ .allowlist_function("rb_jit_get_proc_ptr")
.allowlist_function("rb_yjit_exit_locations_dict")
- .allowlist_function("rb_yjit_icache_invalidate")
+ .allowlist_function("rb_jit_icache_invalidate")
.allowlist_function("rb_optimized_call")
- .allowlist_function("rb_yjit_assert_holding_vm_lock")
.allowlist_function("rb_yjit_sendish_sp_pops")
.allowlist_function("rb_yjit_invokeblock_sp_pops")
+ .allowlist_function("rb_yjit_cme_ractor_serial")
.allowlist_function("rb_yjit_set_exception_return")
- .allowlist_function("rb_yjit_str_concat_codepoint")
- .allowlist_type("robject_offsets")
+ .allowlist_function("rb_jit_str_concat_codepoint")
.allowlist_type("rstring_offsets")
-
- // from vm_sync.h
+ .allowlist_function("rb_assert_holding_vm_lock")
+ .allowlist_function("rb_jit_shape_complex_p")
+ .allowlist_function("rb_jit_multi_ractor_p")
+ .allowlist_function("rb_jit_vm_lock_then_barrier")
+ .allowlist_function("rb_jit_vm_unlock")
+ .allowlist_function("rb_jit_for_each_iseq")
+ .allowlist_type("jit_bindgen_constants")
.allowlist_function("rb_vm_barrier")
+ .allowlist_function("rb_yjit_cdhash_all_fixnum_p")
+ .allowlist_function("rb_yjit_cdhash_lookup")
// Not sure why it's picking these up, but don't.
.blocklist_type("FILE")
.blocklist_type("_IO_.*")
- // From internal/compile.h
.allowlist_function("rb_vm_insn_decode")
-
- // from internal/cont.h
.allowlist_function("rb_jit_cont_each_iseq")
-
- // From iseq.h
.allowlist_function("rb_vm_insn_addr2opcode")
.allowlist_function("rb_iseqw_to_iseq")
.allowlist_function("rb_iseq_label")
.allowlist_function("rb_iseq_line_no")
.allowlist_type("defined_type")
-
- // From builtin.h
.allowlist_type("rb_builtin_function.*")
-
- // From internal/variable.h
.allowlist_function("rb_gvar_(get|set)")
.allowlist_function("rb_ensure_iv_list_size")
-
- // From include/ruby/internal/intern/variable.h
.allowlist_function("rb_attr_get")
.allowlist_function("rb_ivar_defined")
.allowlist_function("rb_ivar_get")
.allowlist_function("rb_mod_name")
-
- // From internal/vm.h
- .allowlist_var("rb_vm_insns_count")
-
- // From include/ruby/internal/intern/vm.h
+ .allowlist_function("rb_const_get")
+ .allowlist_var("rb_vm_insn_count")
+ .allowlist_function("rb_vm_instruction_size")
.allowlist_function("rb_get_alloc_func")
-
- // From internal/object.h
.allowlist_function("rb_class_allocate_instance")
.allowlist_function("rb_obj_equal")
-
- // From gc.h and internal/gc.h
+ .allowlist_function("rb_class_new_instance_pass_kw")
+ .allowlist_function("rb_obj_alloc")
.allowlist_function("rb_obj_info")
.allowlist_function("ruby_xfree")
-
- // From include/ruby/debug.h
.allowlist_function("rb_profile_frames")
// Functions used for code generation
@@ -451,8 +370,8 @@ fn main() {
.allowlist_function("rb_str_neq_internal")
.allowlist_function("rb_yarv_ary_entry_internal")
.allowlist_function("rb_yjit_ruby2_keywords_splat_p")
- .allowlist_function("rb_yjit_fix_div_fix")
- .allowlist_function("rb_yjit_fix_mod_fix")
+ .allowlist_function("rb_jit_fix_div_fix")
+ .allowlist_function("rb_jit_fix_mod_fix")
.allowlist_function("rb_FL_TEST")
.allowlist_function("rb_FL_TEST_RAW")
.allowlist_function("rb_RB_TYPE_P")
@@ -466,7 +385,7 @@ fn main() {
.allowlist_function("rb_METHOD_ENTRY_VISI")
.allowlist_function("rb_RCLASS_ORIGIN")
.allowlist_function("rb_method_basic_definition_p")
- .allowlist_function("rb_yjit_array_len")
+ .allowlist_function("rb_jit_array_len")
.allowlist_function("rb_obj_class")
.allowlist_function("rb_obj_is_proc")
.allowlist_function("rb_vm_base_ptr")
@@ -478,7 +397,6 @@ fn main() {
// We define VALUE manually, don't import it
.blocklist_type("VALUE")
- // From iseq.h
.opaque_type("rb_iseq_t")
.blocklist_type("rb_iseq_t")