Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop exporting symbols for MJIT #7459

Merged
merged 2 commits into from Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions array.c
Expand Up @@ -881,7 +881,7 @@ VALUE
return ary;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_ary_tmp_new_from_values(VALUE klass, long n, const VALUE *elts)
{
VALUE ary;
Expand Down Expand Up @@ -1123,7 +1123,7 @@ rb_check_array_type(VALUE ary)
return rb_check_convert_type_with_id(ary, T_ARRAY, "Array", idTo_ary);
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_check_to_array(VALUE ary)
{
return rb_check_convert_type_with_id(ary, T_ARRAY, "Array", idTo_a);
Expand Down Expand Up @@ -1655,7 +1655,7 @@ rb_ary_shift_m(int argc, VALUE *argv, VALUE ary)
return result;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_ary_behead(VALUE ary, long n)
{
if (n <= 0) {
Expand Down Expand Up @@ -1981,7 +1981,7 @@ rb_ary_aref2(VALUE ary, VALUE b, VALUE e)
return rb_ary_subseq(ary, beg, len);
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_ary_aref1(VALUE ary, VALUE arg)
{
long beg, len, step;
Expand Down
2 changes: 1 addition & 1 deletion bignum.c
Expand Up @@ -4541,7 +4541,7 @@ rb_uint128t2big(uint128_t n)
return big;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_int128t2big(int128_t n)
{
int neg = 0;
Expand Down
4 changes: 2 additions & 2 deletions class.c
Expand Up @@ -924,7 +924,7 @@ rb_define_class_id(ID id, VALUE super)
* \return the value \c Class#inherited's returns
* \pre Each of \a super and \a klass must be a \c Class object.
*/
MJIT_FUNC_EXPORTED VALUE
VALUE
rb_class_inherited(VALUE super, VALUE klass)
{
ID inherited;
Expand Down Expand Up @@ -2306,7 +2306,7 @@ rb_define_attr(VALUE klass, const char *name, int read, int write)
rb_attr(klass, rb_intern(name), read, write, FALSE);
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_keyword_error_new(const char *error, VALUE keys)
{
long i = 0, len = RARRAY_LEN(keys);
Expand Down
2 changes: 1 addition & 1 deletion compile.c
Expand Up @@ -13194,7 +13194,7 @@ rb_ibf_load_iseq_complete(rb_iseq_t *iseq)
}

#if USE_LAZY_LOAD
MJIT_FUNC_EXPORTED const rb_iseq_t *
const rb_iseq_t *
rb_iseq_complete(const rb_iseq_t *iseq)
{
rb_ibf_load_iseq_complete((rb_iseq_t *)iseq);
Expand Down
2 changes: 0 additions & 2 deletions constant.h
Expand Up @@ -43,13 +43,11 @@ VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
void rb_free_const_table(struct rb_id_table *tbl);
VALUE rb_const_source_location(VALUE, ID);

MJIT_SYMBOL_EXPORT_BEGIN
int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
VALUE rb_public_const_get_at(VALUE klass, ID id);
VALUE rb_public_const_get_from(VALUE klass, ID id);
int rb_public_const_defined_from(VALUE klass, ID id);
VALUE rb_const_source_location_at(VALUE, ID);
MJIT_SYMBOL_EXPORT_END

#endif /* CONSTANT_H */
2 changes: 0 additions & 2 deletions debug_counter.c
Expand Up @@ -25,10 +25,8 @@ const char *const rb_debug_counter_names[] = {
#undef RB_DEBUG_COUNTER
};

MJIT_SYMBOL_EXPORT_BEGIN
size_t rb_debug_counter[numberof(rb_debug_counter_names)];
void rb_debug_counter_add_atomic(enum rb_debug_counter_type type, int add);
MJIT_SYMBOL_EXPORT_END

static rb_nativethread_lock_t debug_counter_lock;

Expand Down
6 changes: 3 additions & 3 deletions error.c
Expand Up @@ -187,7 +187,7 @@ rb_warning_category_update(unsigned int mask, unsigned int bits)
warning_disabled_categories |= mask & ~bits;
}

MJIT_FUNC_EXPORTED bool
bool
rb_warning_category_enabled_p(rb_warning_category_t category)
{
return !(warning_disabled_categories & (1U << category));
Expand Down Expand Up @@ -867,7 +867,7 @@ rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
report_bug_valist(RSTRING_PTR(file), line, fmt, NULL, args);
}

MJIT_FUNC_EXPORTED void
void
rb_assert_failure(const char *file, int line, const char *name, const char *expr)
{
FILE *out = stderr;
Expand Down Expand Up @@ -1582,7 +1582,7 @@ exc_set_backtrace(VALUE exc, VALUE bt)
return rb_ivar_set(exc, id_bt, rb_check_backtrace(bt));
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_exc_set_backtrace(VALUE exc, VALUE bt)
{
return exc_set_backtrace(exc, bt);
Expand Down
10 changes: 5 additions & 5 deletions gc.c
Expand Up @@ -3129,7 +3129,7 @@ rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0,
}
#endif

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_class_allocate_instance(VALUE klass)
{
return rb_class_instance_allocate_internal(klass, T_OBJECT | ROBJECT_EMBED, RGENGC_WB_PROTECTED_OBJECT);
Expand Down Expand Up @@ -6526,7 +6526,7 @@ stack_check(rb_execution_context_t *ec, int water_mark)

#define STACKFRAME_FOR_CALL_CFUNC 2048

MJIT_FUNC_EXPORTED int
int
rb_ec_stack_check(rb_execution_context_t *ec)
{
return stack_check(ec, STACKFRAME_FOR_CALL_CFUNC);
Expand Down Expand Up @@ -9167,7 +9167,7 @@ rb_gc_writebarrier_unprotect(VALUE obj)
/*
* remember `obj' if needed.
*/
MJIT_FUNC_EXPORTED void
void
rb_gc_writebarrier_remember(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
Expand Down Expand Up @@ -14661,7 +14661,7 @@ obj_info(VALUE obj)
}
#endif

MJIT_FUNC_EXPORTED const char *
const char *
rb_obj_info(VALUE obj)
{
return obj_info(obj);
Expand All @@ -14674,7 +14674,7 @@ rb_obj_info_dump(VALUE obj)
fprintf(stderr, "rb_obj_info_dump: %s\n", rb_raw_obj_info(buff, 0x100, obj));
}

MJIT_FUNC_EXPORTED void
void
rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func)
{
char buff[0x100];
Expand Down
16 changes: 8 additions & 8 deletions hash.c
Expand Up @@ -1534,7 +1534,7 @@ copy_compare_by_id(VALUE hash, VALUE basis)
return hash;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_hash_new_with_size(st_index_t size)
{
VALUE ret = rb_hash_new();
Expand Down Expand Up @@ -1594,7 +1594,7 @@ rb_hash_dup(VALUE hash)
return ret;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_hash_resurrect(VALUE hash)
{
VALUE ret = hash_dup(hash, rb_cHash, 0);
Expand All @@ -1607,7 +1607,7 @@ rb_hash_modify_check(VALUE hash)
rb_check_frozen(hash);
}

MJIT_FUNC_EXPORTED struct st_table *
RUBY_FUNC_EXPORTED struct st_table *
rb_hash_tbl_raw(VALUE hash, const char *file, int line)
{
return ar_force_convert_table(hash, file, line);
Expand Down Expand Up @@ -1887,7 +1887,7 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
return hash;
}

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_to_hash_type(VALUE hash)
{
return rb_convert_type_with_id(hash, T_HASH, "Hash", idTo_hash);
Expand Down Expand Up @@ -2078,7 +2078,7 @@ hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval)
}
}

MJIT_FUNC_EXPORTED int
int
rb_hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval)
{
return hash_stlike_lookup(hash, key, pval);
Expand Down Expand Up @@ -3550,7 +3550,7 @@ keys_i(VALUE key, VALUE value, VALUE ary)
* h.keys # => [:foo, :bar, :baz]
*/

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_hash_keys(VALUE hash)
{
st_index_t size = RHASH_SIZE(hash);
Expand Down Expand Up @@ -3637,7 +3637,7 @@ rb_hash_values(VALUE hash)
* Returns +true+ if +key+ is a key in +self+, otherwise +false+.
*/

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_hash_has_key(VALUE hash, VALUE key)
{
return RBOOL(hash_stlike_lookup(hash, key, NULL));
Expand Down Expand Up @@ -4406,7 +4406,7 @@ rb_hash_compare_by_id(VALUE hash)
* Returns +true+ if #compare_by_identity has been called, +false+ otherwise.
*/

MJIT_FUNC_EXPORTED VALUE
VALUE
rb_hash_compare_by_id_p(VALUE hash)
{
return RBOOL(RHASH_ST_TABLE_P(hash) && RHASH_ST_TABLE(hash)->type == &identhash);
Expand Down
6 changes: 3 additions & 3 deletions id_table.c
Expand Up @@ -92,7 +92,7 @@ rb_id_table_init(struct rb_id_table *tbl, int capa)
return tbl;
}

MJIT_FUNC_EXPORTED struct rb_id_table *
struct rb_id_table *
rb_id_table_create(size_t capa)
{
struct rb_id_table *tbl = ALLOC(struct rb_id_table);
Expand Down Expand Up @@ -223,7 +223,7 @@ hash_table_show(struct rb_id_table *tbl)
}
#endif

MJIT_FUNC_EXPORTED int
int
rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp)
{
id_key_t key = id2key(id);
Expand Down Expand Up @@ -253,7 +253,7 @@ rb_id_table_insert_key(struct rb_id_table *tbl, const id_key_t key, const VALUE
return TRUE;
}

MJIT_FUNC_EXPORTED int
int
rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val)
{
return rb_id_table_insert_key(tbl, id2key(id), val);
Expand Down
11 changes: 0 additions & 11 deletions include/ruby/internal/dllexport.h
Expand Up @@ -69,17 +69,6 @@
/* These macros are used for functions which are exported only for MJIT
and NOT ensured to be exported in future versions. */

#if ! defined(MJIT_HEADER)
# define MJIT_FUNC_EXPORTED RUBY_FUNC_EXPORTED
#elif ! RBIMPL_COMPILER_IS(MSVC)
# define MJIT_FUNC_EXPORTED RUBY_FUNC_EXPORTED
#else
# define MJIT_FUNC_EXPORTED static
#endif

#define MJIT_SYMBOL_EXPORT_BEGIN RUBY_SYMBOL_EXPORT_BEGIN
#define MJIT_SYMBOL_EXPORT_END RUBY_SYMBOL_EXPORT_END

/* On mswin, MJIT header transformation can't be used since cl.exe can't output
preprocessed output preserving macros. So this `MJIT_STATIC` is needed
to force non-static function to static on MJIT header to avoid symbol conflict. */
Expand Down
2 changes: 0 additions & 2 deletions internal/array.h
Expand Up @@ -42,15 +42,13 @@ static inline bool ARY_PTR_USING_P(VALUE ary);
static inline void RARY_TRANSIENT_SET(VALUE ary);
static inline void RARY_TRANSIENT_UNSET(VALUE ary);

MJIT_SYMBOL_EXPORT_BEGIN
VALUE rb_ary_tmp_new_from_values(VALUE, long, const VALUE *);
VALUE rb_check_to_array(VALUE ary);
VALUE rb_ary_behead(VALUE, long);
VALUE rb_ary_aref1(VALUE ary, VALUE i);

struct rb_execution_context_struct;
VALUE rb_ec_ary_new_from_values(struct rb_execution_context_struct *ec, long n, const VALUE *elts);
MJIT_SYMBOL_EXPORT_END

// YJIT needs this function to never allocate and never raise
static inline VALUE
Expand Down
2 changes: 0 additions & 2 deletions internal/basic_operators.h
Expand Up @@ -40,9 +40,7 @@ enum ruby_basic_operators {
BOP_LAST_
};

MJIT_SYMBOL_EXPORT_BEGIN
RUBY_EXTERN short ruby_vm_redefined_flag[BOP_LAST_];
MJIT_SYMBOL_EXPORT_END

/* optimize insn */
#define INTEGER_REDEFINED_OP_FLAG (1 << 0)
Expand Down
2 changes: 0 additions & 2 deletions internal/bignum.h
Expand Up @@ -163,11 +163,9 @@ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags);
RUBY_SYMBOL_EXPORT_END

MJIT_SYMBOL_EXPORT_BEGIN
#if defined(HAVE_INT128_T)
VALUE rb_int128t2big(int128_t n);
#endif
MJIT_SYMBOL_EXPORT_END

/* sign: positive:1, negative:0 */
static inline bool
Expand Down
2 changes: 0 additions & 2 deletions internal/class.h
Expand Up @@ -148,10 +148,8 @@ static inline VALUE RCLASS_SUPER(VALUE klass);
static inline VALUE RCLASS_SET_SUPER(VALUE klass, VALUE super);
static inline void RCLASS_SET_INCLUDER(VALUE iclass, VALUE klass);

MJIT_SYMBOL_EXPORT_BEGIN
VALUE rb_class_inherited(VALUE, VALUE);
VALUE rb_keyword_error_new(const char *, VALUE);
MJIT_SYMBOL_EXPORT_END

static inline rb_alloc_func_t
RCLASS_ALLOCATOR(VALUE klass)
Expand Down
2 changes: 0 additions & 2 deletions internal/compile.h
Expand Up @@ -29,9 +29,7 @@ int rb_vm_insn_addr2insn(const void *);
int rb_vm_insn_decode(const VALUE encoded);
extern bool ruby_vm_keep_script_lines;

MJIT_SYMBOL_EXPORT_BEGIN
/* iseq.c (export) */
rb_event_flag_t rb_iseq_event_flags(const struct rb_iseq_struct *iseq, size_t pos);
MJIT_SYMBOL_EXPORT_END

#endif /* INTERNAL_COMPILE_H */
2 changes: 0 additions & 2 deletions internal/gc.h
Expand Up @@ -291,11 +291,9 @@ void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, siz
void ruby_sized_xfree(void *x, size_t size);
RUBY_SYMBOL_EXPORT_END

MJIT_SYMBOL_EXPORT_BEGIN
int rb_ec_stack_check(struct rb_execution_context_struct *ec);
void rb_gc_writebarrier_remember(VALUE obj);
const char *rb_obj_info(VALUE obj);
MJIT_SYMBOL_EXPORT_END

#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)

Expand Down
2 changes: 0 additions & 2 deletions internal/hash.h
Expand Up @@ -107,7 +107,6 @@ VALUE rb_ident_hash_new(void);
int rb_hash_stlike_foreach(VALUE hash, st_foreach_callback_func *func, st_data_t arg);
RUBY_SYMBOL_EXPORT_END

MJIT_SYMBOL_EXPORT_BEGIN
VALUE rb_hash_new_with_size(st_index_t size);
VALUE rb_hash_resurrect(VALUE hash);
int rb_hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval);
Expand All @@ -117,7 +116,6 @@ VALUE rb_hash_compare_by_id_p(VALUE hash);

st_table *rb_hash_tbl_raw(VALUE hash, const char *file, int line);
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h, __FILE__, __LINE__)
MJIT_SYMBOL_EXPORT_END

VALUE rb_hash_compare_by_id(VALUE hash);

Expand Down
2 changes: 0 additions & 2 deletions internal/numeric.h
Expand Up @@ -111,7 +111,6 @@ RUBY_SYMBOL_EXPORT_BEGIN
/* numeric.c (export) */
RUBY_SYMBOL_EXPORT_END

MJIT_SYMBOL_EXPORT_BEGIN
VALUE rb_flo_div_flo(VALUE x, VALUE y);
double ruby_float_mod(double x, double y);
VALUE rb_float_equal(VALUE x, VALUE y);
Expand All @@ -125,7 +124,6 @@ VALUE rb_int_abs(VALUE num);
VALUE rb_int_bit_length(VALUE num);
VALUE rb_int_uminus(VALUE num);
VALUE rb_int_comp(VALUE num);
MJIT_SYMBOL_EXPORT_END

static inline bool
INT_POSITIVE_P(VALUE num)
Expand Down