summaryrefslogtreecommitdiff
path: root/yjit_iface.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-10-01 18:38:39 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:42 -0400
commitf6da559d5b88981000d4c575b6384f59d30dec22 (patch)
tree00fab354584931dd6f88dc275c26260c17259379 /yjit_iface.h
parent25eed2848344f19385b39daaac8ca5eef79f9466 (diff)
Put YJIT into a single compilation unit
For upstreaming, we want functions we export either prefixed with "rb_" or made static. Historically we haven't been following this rule, so we were "leaking" a lot of symbols as `make leak-globals` would tell us. This change unifies everything YJIT into a single compilation unit, yjit.o, and makes everything unprefixed static to pass `make leak-globals`. This manual "unified build" setup is similar to that of vm.o. Having everything in one compilation unit allows static functions to be visible across YJIT files and removes the need for declarations in headers in some cases. Unnecessary declarations were removed. Other changes of note: - switched to MJIT_SYMBOL_EXPORT_BEGIN which indicates stuff as being off limits for native extensions - the first include of each YJIT file is change to be "internal.h" - undefined MAP_STACK before explicitly redefining it since it collide's with a definition in system headers. Consider renaming?
Diffstat (limited to 'yjit_iface.h')
-rw-r--r--yjit_iface.h123
1 files changed, 6 insertions, 117 deletions
diff --git a/yjit_iface.h b/yjit_iface.h
index 319e877560..5f070fc19f 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -16,128 +16,17 @@
# define YJIT_DEFAULT_CALL_THRESHOLD 10
#endif
-#if YJIT_STATS
-struct yjit_comment {
- uint32_t offset;
- const char *comment;
-};
-
-typedef rb_darray(struct yjit_comment) yjit_comment_array_t;
-
-extern yjit_comment_array_t yjit_code_comments;
-#endif // if YJIT_STATS
-
-
-#if YJIT_STATS
-
-#define YJIT_DECLARE_COUNTERS(...) struct rb_yjit_runtime_counters { \
- int64_t __VA_ARGS__; \
-}; \
-static char yjit_counter_names[] = #__VA_ARGS__;
-
-YJIT_DECLARE_COUNTERS(
- exec_instruction,
-
- send_keywords,
- send_kw_splat,
- send_args_splat,
- send_block_arg,
- send_ivar_set_method,
- send_zsuper_method,
- send_undef_method,
- send_optimized_method,
- send_missing_method,
- send_bmethod,
- send_refined_method,
- send_cfunc_ruby_array_varg,
- send_cfunc_argc_mismatch,
- send_cfunc_toomany_args,
- send_cfunc_tracing,
- send_iseq_tailcall,
- send_iseq_arity_error,
- send_iseq_only_keywords,
- send_iseq_complex_callee,
- send_not_implemented_method,
- send_getter_arity,
- send_se_cf_overflow,
- send_se_protected_check_failed,
-
- traced_cfunc_return,
-
- invokesuper_me_changed,
- invokesuper_block,
-
- leave_se_interrupt,
- leave_interp_return,
- leave_start_pc_non_zero,
-
- getivar_se_self_not_heap,
- getivar_idx_out_of_range,
-
- setivar_se_self_not_heap,
- setivar_idx_out_of_range,
- setivar_val_heapobject,
- setivar_name_not_mapped,
- setivar_not_object,
- setivar_frozen,
-
- oaref_argc_not_one,
- oaref_arg_not_fixnum,
-
- opt_getinlinecache_miss,
-
- binding_allocations,
- binding_set,
-
- vm_insns_count,
- compiled_iseq_count,
- compiled_block_count,
-
- invalidation_count,
- invalidate_method_lookup,
- invalidate_bop_redefined,
- invalidate_ractor_spawn,
- invalidate_constant_state_bump,
- invalidate_constant_ic_fill,
-
- constant_state_bumps,
-
- expandarray_splat,
- expandarray_postarg,
- expandarray_not_array,
- expandarray_rhs_too_small,
-
- gbpp_block_param_modified,
- gbpp_block_handler_not_iseq,
-
- // Member with known name for iterating over counters
- last_member
-)
-
-#undef YJIT_DECLARE_COUNTERS
-
-RUBY_EXTERN struct rb_yjit_runtime_counters yjit_runtime_counters;
-
-#endif // YJIT_STATS
-
RUBY_EXTERN struct rb_yjit_options rb_yjit_opts;
-VALUE *yjit_iseq_pc_at_idx(const rb_iseq_t *iseq, uint32_t insn_idx);
-int yjit_opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc);
-void yjit_print_iseq(const rb_iseq_t *iseq);
-
-void check_cfunc_dispatch(VALUE receiver, struct rb_callinfo *ci, void *callee, rb_callable_method_entry_t *compile_time_cme);
-
-RBIMPL_ATTR_NODISCARD() bool assume_bop_not_redefined(block_t *block, int redefined_flag, enum ruby_basic_operators bop);
-void assume_method_lookup_stable(VALUE receiver_klass, const rb_callable_method_entry_t *cme, block_t *block);
-RBIMPL_ATTR_NODISCARD() bool assume_single_ractor_mode(block_t *block);
-void assume_stable_global_constant_state(block_t *block);
+static VALUE *yjit_iseq_pc_at_idx(const rb_iseq_t *iseq, uint32_t insn_idx);
+static int yjit_opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc);
+static void yjit_print_iseq(const rb_iseq_t *iseq);
// this function *must* return passed exit_pc
-const VALUE *rb_yjit_count_side_exit_op(const VALUE *exit_pc);
+static const VALUE *yjit_count_side_exit_op(const VALUE *exit_pc);
-void yjit_unlink_method_lookup_dependency(block_t *block);
-void yjit_block_assumptions_free(block_t *block);
+static void yjit_unlink_method_lookup_dependency(block_t *block);
+static void yjit_block_assumptions_free(block_t *block);
VALUE rb_yjit_code_page_alloc(void);
code_page_t *rb_yjit_code_page_unwrap(VALUE cp_obj);