void debug_print_packed_ref(const ref_packed *pref) { ushort elt = *pref; ref nref; switch ( elt >> packed_type_shift ) { case pt_executable_operator: dprintf("<op_name>"); elt &= packed_int_mask; op_index_ref(elt, &nref); debug_print_ref(&nref); break; case pt_integer: dprintf1("<int> %d", (int)(elt & packed_int_mask) + packed_min_intval); break; case pt_literal_name: case pt_literal_name+1: dprintf("<lit_name>"); elt &= packed_max_name_index; goto ptn; case pt_executable_name: case pt_executable_name+1: dprintf("<exec_name>"); elt &= packed_max_name_index; ptn: name_index_ref(elt, &nref); dprintf2("(0x%lx#%x)", (ulong)nref.value.pname, elt); debug_print_name(&nref); break; } }
/* Unmarking routine for ref objects. */ static void refs_clear_marks(const gs_memory_t *cmem, void /*obj_header_t */ *vptr, uint size, const gs_memory_struct_type_t * pstype) { ref_packed *rp = (ref_packed *) vptr; ref_packed *end = (ref_packed *) ((byte *) vptr + size); /* Since the last ref is full-size, we only need to check for */ /* the end of the block when we see one of those. */ for (;;) { if (r_is_packed(rp)) { #ifdef DEBUG if (gs_debug_c('8')) { dlprintf1(" [8]unmark packed 0x%lx ", (ulong) rp); debug_print_ref(cmem, (const ref *)rp); dputs("\n"); } #endif r_clear_pmark(rp); rp++; } else { /* full-size ref */ ref *const pref = (ref *)rp; #ifdef DEBUG if (gs_debug_c('8')) { dlprintf1(" [8]unmark ref 0x%lx ", (ulong) rp); debug_print_ref(cmem, pref); dputs("\n"); } #endif r_clear_attrs(pref, l_mark); rp += packed_per_ref; if (rp >= (ref_packed *) end) break; } } }