Skip to content

Commit

Permalink
Compile debugging code for symbol and ID always
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 30, 2023
1 parent ac01639 commit e7dc8f0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
# undef USE_SYMBOL_GC
# define USE_SYMBOL_GC 1
#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
#endif
#ifndef CHECK_ID_SERIAL
Expand Down Expand Up @@ -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)) {
result = 0;
}
else {
#if CHECK_ID_SERIAL
else if (CHECK_ID_SERIAL) {
if (id) {
VALUE sym = result;
if (t != ID_ENTRY_SYM)
Expand All @@ -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;
}
}
#endif
}
}
}
Expand Down Expand Up @@ -504,7 +506,6 @@ rb_id_serial_to_id(rb_id_serial_t num)
}
}

#if SYMBOL_DEBUG
static int
register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
{
Expand All @@ -515,19 +516,19 @@ register_sym_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, in
*value = arg;
return ST_CONTINUE;
}
#endif

static void
register_sym(rb_symbols_t *symbols, VALUE str, VALUE sym)
{
ASSERT_vm_locking();

#if SYMBOL_DEBUG
st_update(symbols->str_sym, (st_data_t)str,
register_sym_update_callback, (st_data_t)sym);
#else
st_add_direct(symbols->str_sym, (st_data_t)str, (st_data_t)sym);
#endif
if (SYMBOL_DEBUG) {
st_update(symbols->str_sym, (st_data_t)str,
register_sym_update_callback, (st_data_t)sym);
}
else {
st_add_direct(symbols->str_sym, (st_data_t)str, (st_data_t)sym);
}
}

static void
Expand Down

0 comments on commit e7dc8f0

Please sign in to comment.