Compile debugging code for symbol and ID always

This commit is contained in:
Nobuyoshi Nakada 2023-06-28 23:04:11 +09:00
parent ac0163949a
commit e7dc8f0b27
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -30,7 +30,11 @@
# undef USE_SYMBOL_GC # undef USE_SYMBOL_GC
# define USE_SYMBOL_GC 1 # define USE_SYMBOL_GC 1
#endif #endif
#ifndef SYMBOL_DEBUG #if defined(SYMBOL_DEBUG) && (SYMBOL_DEBUG+0)
# undef SYMBOL_DEBUG
# define SYMBOL_DEBUG 1
#else
# undef SYMBOL_DEBUG
# define SYMBOL_DEBUG 0 # define SYMBOL_DEBUG 0
#endif #endif
#ifndef CHECK_ID_SERIAL #ifndef CHECK_ID_SERIAL
@ -456,8 +460,7 @@ get_id_serial_entry(rb_id_serial_t num, ID id, const enum id_entry_type t)
if (NIL_P(result)) { if (NIL_P(result)) {
result = 0; result = 0;
} }
else { else if (CHECK_ID_SERIAL) {
#if CHECK_ID_SERIAL
if (id) { if (id) {
VALUE sym = result; VALUE sym = result;
if (t != ID_ENTRY_SYM) if (t != ID_ENTRY_SYM)
@ -469,7 +472,6 @@ get_id_serial_entry(rb_id_serial_t num, ID id, const enum id_entry_type t)
if (RSYMBOL(sym)->id != id) result = 0; if (RSYMBOL(sym)->id != id) result = 0;
} }
} }
#endif
} }
} }
} }
@ -504,7 +506,6 @@ rb_id_serial_to_id(rb_id_serial_t num)
} }
} }
#if SYMBOL_DEBUG
static int static int
register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing) register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
{ {
@ -515,19 +516,19 @@ register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, in
*value = arg; *value = arg;
return ST_CONTINUE; return ST_CONTINUE;
} }
#endif
static void static void
register_sym(rb_symbols_t *symbols, VALUE str, VALUE sym) register_sym(rb_symbols_t *symbols, VALUE str, VALUE sym)
{ {
ASSERT_vm_locking(); ASSERT_vm_locking();
#if SYMBOL_DEBUG if (SYMBOL_DEBUG) {
st_update(symbols->str_sym, (st_data_t)str, st_update(symbols->str_sym, (st_data_t)str,
register_sym_update_callback, (st_data_t)sym); register_sym_update_callback, (st_data_t)sym);
#else }
st_add_direct(symbols->str_sym, (st_data_t)str, (st_data_t)sym); else {
#endif st_add_direct(symbols->str_sym, (st_data_t)str, (st_data_t)sym);
}
} }
static void static void