10 # include <valgrind.h>
11 # include <memcheck.h>
14 /* Start of pointer indirection:
16 * This feature is responsible of hiding from the developer the real pointer of
17 * the Eo object to supply a better memory management by preventing bad usage
20 * Eo * is no more a pointer but indexes to an entry into an ids table.
21 * For a better memory usage:
22 * - a tree structure is used, composed of a top level table pointing at
23 * mid tables pointing at tables composed of entries.
24 * - tables are allocated when needed (i.e no more empty entries in allocated tables.
25 * - empty tables are freed, except one kept as spare table.
27 * An Eo id is contructed by bits manipulation of table indexes and a generation.
29 * id = Mid Table | Table | Entry | Generation
31 * Generation helps finding abuse of ids. When an entry is assigned to an
32 * object, a generation is inserted into the id. If the developer uses this id
33 * although the object is freed and another one has replaced it into the same
34 * entry of the table, the generation will be different and an error will
35 * occur when accessing with the old id.
37 * Each Table is composed of:
38 * - an index 'start' indicating which free entry is the next one to use.
39 * - 2 indexes 'fifo_head' and 'fifo_tail' defining a fifo,
40 * that will help us to store the entries to be reused. It stores only the
41 * entries that have been used at least one time. The entries that have
42 * never been used are "pointed" by the start parameter.
43 * - entries composed of:
44 * - a pointer to the object
45 * - an index 'next_in_fifo' used to chain the free entries in the fifo
46 * - a flag indicating if the entry is active
47 * - a generation assigned to the object
49 * When an entry is searched into a table, we first use one of the entries that
50 * has never been used. If there is none, we try to pop from the fifo.
51 * If a such entry doesn't exist, we pass to the next table.
52 * When an entry is found, we reserve it to the object pointer
53 * then contruct and return the related Eo id.
55 * Assigning all the entries of a table before trying to reuse them from
56 * the fifo ensures that we are not going to soon recycle a released entry,
57 * thus minimize the risks of an aggressive del() then use() on a single entry.
59 * The indexes and a reference to the last table which served an entry is kept
60 * and is reused prior to the others untill it is full.
61 * When an object is freed, the entry into the table is released by appending
65 // enable this to test and use all 64bits of a pointer, otherwise limit to
66 // 47 bits because of luajit. it wants to check if any bits in the upper 17 are
67 // set for a sanity check for lightuserdata ... basically it does this:
68 // #define checklightudptr(L, p) (((uint64_t)(p) >> 47) ? (lj_err_msg(L, LJ_ERR_BADLU), NULL) : (p))
69 //#define EO_FULL64BIT 1
71 #if SIZEOF_UINTPTR_T == 4
73 # define BITS_MID_TABLE_ID 5
74 # define BITS_TABLE_ID 5
75 # define BITS_ENTRY_ID 11
76 # define BITS_GENERATION_COUNTER 7
77 # define BITS_DOMAIN 2
79 # define REF_TAG_SHIFT 31
80 # define DROPPED_TABLES 0
81 # define DROPPED_ENTRIES 4
82 typedef int16_t Table_Index;
83 typedef uint16_t Generation_Counter;
87 # define BITS_MID_TABLE_ID 11
88 # define BITS_TABLE_ID 11
89 # define BITS_ENTRY_ID 11
90 # define BITS_GENERATION_COUNTER 10
91 # define BITS_DOMAIN 2
93 # define REF_TAG_SHIFT 46
94 # define DROPPED_TABLES 2
95 # define DROPPED_ENTRIES 3
96 typedef int16_t Table_Index;
97 typedef uint16_t Generation_Counter;
100 # define BITS_MID_TABLE_ID 11
101 # define BITS_TABLE_ID 11
102 # define BITS_ENTRY_ID 11
103 # define BITS_GENERATION_COUNTER 27
104 # define BITS_DOMAIN 2
105 # define BITS_CLASS 1
106 # define REF_TAG_SHIFT 63
107 # define DROPPED_TABLES 2
108 # define DROPPED_ENTRIES 3
109 typedef int16_t Table_Index;
110 typedef uint32_t Generation_Counter;
114 /* Shifts macros to manipulate the Eo id */
115 #define SHIFT_DOMAIN (BITS_MID_TABLE_ID + BITS_TABLE_ID + \
116 BITS_ENTRY_ID + BITS_GENERATION_COUNTER)
117 #define SHIFT_MID_TABLE_ID (BITS_TABLE_ID + \
118 BITS_ENTRY_ID + BITS_GENERATION_COUNTER)
119 #define SHIFT_TABLE_ID (BITS_ENTRY_ID + BITS_GENERATION_COUNTER)
120 #define SHIFT_ENTRY_ID (BITS_GENERATION_COUNTER)
122 /* Maximum ranges - a few tables and entries are dropped to minimize the amount
123 * of wasted bytes, see _eo_id_mem_alloc */
124 #define MAX_DOMAIN (1 << BITS_DOMAIN)
125 #define MAX_MID_TABLE_ID (1 << BITS_MID_TABLE_ID)
126 #define MAX_TABLE_ID ((1 << BITS_TABLE_ID) - DROPPED_TABLES )
127 #define MAX_ENTRY_ID ((1 << BITS_ENTRY_ID) - DROPPED_ENTRIES)
128 #define MAX_GENERATIONS (1 << BITS_GENERATION_COUNTER)
131 #define MASK_DOMAIN (MAX_DOMAIN - 1)
132 #define MASK_MID_TABLE_ID (MAX_MID_TABLE_ID - 1)
133 #define MASK_TABLE_ID ((1 << BITS_TABLE_ID) - 1)
134 #define MASK_ENTRY_ID ((1 << BITS_ENTRY_ID) - 1)
135 #define MASK_GENERATIONS (MAX_GENERATIONS - 1)
136 #define MASK_OBJ_TAG (((Eo_Id) 1) << (REF_TAG_SHIFT))
138 /* This only applies to classes. Used to artificially enlarge the class ids
139 * to reduce the likelihood of a clash with normal integers. */
140 #define CLASS_TAG_SHIFT (REF_TAG_SHIFT - 1)
141 #define MASK_CLASS_TAG (((Eo_Id) 1) << (CLASS_TAG_SHIFT))
143 #define MEM_HEADER_SIZE 16
144 #define MEM_PAGE_SIZE 4096
145 #define MEM_MAGIC 0x3f61ec8a
147 typedef struct _Mem_Header
154 _eo_id_mem_alloc(size_t size)
157 # ifdef HAVE_VALGRIND
158 if (RUNNING_ON_VALGRIND) return malloc(size);
165 newsize = MEM_PAGE_SIZE * ((size + MEM_HEADER_SIZE + MEM_PAGE_SIZE - 1) /
167 ptr = mmap(NULL, newsize, PROT_READ | PROT_WRITE,
168 MAP_PRIVATE | MAP_ANON, -1, 0);
169 if (ptr == MAP_FAILED)
171 ERR("mmap of eo id table region failed!");
176 hdr->magic = MEM_MAGIC;
177 /* DBG("asked:%lu allocated:%lu wasted:%lu bytes", size, newsize, (newsize - size)); */
178 return (void *)(((unsigned char *)ptr) + MEM_HEADER_SIZE);
186 _eo_id_mem_calloc(size_t num, size_t size)
188 void *ptr = _eo_id_mem_alloc(num * size);
189 if (!ptr) return NULL;
190 memset(ptr, 0, num * size);
195 _eo_id_mem_free(void *ptr)
198 # ifdef HAVE_VALGRIND
199 if (RUNNING_ON_VALGRIND) free(ptr);
205 hdr = (Mem_Header *)(((unsigned char *)ptr) - MEM_HEADER_SIZE);
206 if (hdr->magic != MEM_MAGIC)
208 ERR("unmap of eo table region has bad magic!");
211 munmap(hdr, hdr->size);
218 #ifdef EINA_DEBUG_MALLOC
220 _eo_id_mem_protect(void *ptr, Eina_Bool may_not_write)
223 # ifdef HAVE_VALGRIND
224 if (RUNNING_ON_VALGRIND) { return; }
230 hdr = (Mem_Header *)(((unsigned char *)ptr) - MEM_HEADER_SIZE);
231 if (hdr->magic != MEM_MAGIC)
233 ERR("mprotect of eo table region has bad magic!");
236 mprotect(hdr, hdr->size, PROT_READ | ( may_not_write ? 0 : PROT_WRITE) );
240 # define PROTECT(_ptr_) _eo_id_mem_protect((_ptr_), EINA_TRUE)
241 # define UNPROTECT(_ptr_) _eo_id_mem_protect((_ptr_), EINA_FALSE)
243 # define PROTECT(_ptr_)
244 # define UNPROTECT(_ptr_)
247 #define EO_ALIGN_SIZE(size) eina_mempool_alignof(size)
252 /* Pointer to the object */
254 /* Indicates where to find the next entry to recycle */
255 Table_Index next_in_fifo;
257 unsigned int active : 1;
259 unsigned int generation : BITS_GENERATION_COUNTER;
266 /* Indicates where start the "never used" entries */
268 /* Indicates where to find the next entry to recycle */
269 Table_Index fifo_head;
270 /* Indicates where to add an entry to recycle */
271 Table_Index fifo_tail;
272 /* Packed mid table and table indexes */
274 /* Counter of free entries */
275 unsigned int free_entries;
276 /* Entries of the table holding real pointers and generations */
277 _Eo_Id_Entry entries[MAX_ENTRY_ID];
280 //////////////////////////////////////////////////////////////////////////
282 typedef struct _Eo_Id_Data Eo_Id_Data;
283 typedef struct _Eo_Id_Table_Data Eo_Id_Table_Data;
285 struct _Eo_Id_Table_Data
287 /* Cached eoid lookups */
293 const Efl_Class *klass;
297 /* Tables handling pointers indirection */
298 _Eo_Ids_Table **eo_ids_tables[MAX_MID_TABLE_ID];
299 /* Current table used for following allocations */
300 _Eo_Ids_Table *current_table;
301 /* Spare empty table */
302 _Eo_Ids_Table *empty_table;
303 /* Optional lock around all objects in eoid table - only used if shared */
305 /* Next generation to use when assigning a new entry to a Eo pointer */
306 Generation_Counter generation;
307 /* are we shared so we need lock/unlock? */
313 Eo_Id_Table_Data *tables[4];
314 unsigned char local_domain;
315 unsigned char stack_top;
316 unsigned char domain_stack[255 - (sizeof(void *) * 4) - 2];
319 extern Eina_TLS _eo_table_data;
320 extern Eo_Id_Data *_eo_table_data_shared;
321 extern Eo_Id_Table_Data *_eo_table_data_shared_data;
323 static inline Eo_Id_Table_Data *
324 _eo_table_data_table_new(Efl_Id_Domain domain)
326 Eo_Id_Table_Data *tdata;
328 tdata = calloc(1, sizeof(Eo_Id_Table_Data));
329 if (!tdata) return NULL;
330 if (domain == EFL_ID_DOMAIN_SHARED)
332 if (!eina_lock_recursive_new(&(tdata->obj_lock)))
337 tdata->shared = EINA_TRUE;
339 tdata->generation = rand() % MAX_GENERATIONS;
343 static inline Eo_Id_Data *
344 _eo_table_data_new(Efl_Id_Domain domain)
348 data = calloc(1, sizeof(Eo_Id_Data));
349 if (!data) return NULL;
350 data->local_domain = domain;
351 data->domain_stack[data->stack_top] = data->local_domain;
352 data->tables[data->local_domain] =
353 _eo_table_data_table_new(data->local_domain);
354 if (domain != EFL_ID_DOMAIN_SHARED)
355 data->tables[EFL_ID_DOMAIN_SHARED] = _eo_table_data_shared_data;
360 _eo_table_data_table_free(Eo_Id_Table_Data *tdata)
362 if (tdata->shared) eina_lock_free(&(tdata->obj_lock));
366 static inline Eo_Id_Data *
367 _eo_table_data_get(void)
369 Eo_Id_Data *data = eina_tls_get(_eo_table_data);
370 if (EINA_LIKELY(data != NULL)) return data;
372 data = _eo_table_data_new(EFL_ID_DOMAIN_THREAD);
373 if (!data) return NULL;
375 eina_tls_set(_eo_table_data, data);
379 static inline Eo_Id_Table_Data *
380 _eo_table_data_current_table_get(Eo_Id_Data *data)
382 return data->tables[data->domain_stack[data->stack_top]];
385 static inline Eo_Id_Table_Data *
386 _eo_table_data_table_get(Eo_Id_Data *data, Efl_Id_Domain domain)
388 return data->tables[domain];
391 static inline Eina_Bool
392 _eo_id_domain_compatible(const Eo *o1, const Eo *o2)
394 Efl_Id_Domain domain1 = ((Eo_Id)o1 >> SHIFT_DOMAIN) & MASK_DOMAIN;
395 Efl_Id_Domain domain2 = ((Eo_Id)o2 >> SHIFT_DOMAIN) & MASK_DOMAIN;
396 if (domain1 == domain2) return EINA_TRUE;
397 ERR("Object %p and %p are not compatible. Domain %i and %i do not match",
398 o1, o2, domain1, domain2);
403 _eo_obj_pointer_done(const Eo_Id obj_id)
405 Efl_Id_Domain domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
406 if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED)) return;
407 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
410 //////////////////////////////////////////////////////////////////////////
413 /* Macro used to compose an Eo id */
414 #define EO_COMPOSE_PARTIAL_ID(MID_TABLE, TABLE) \
415 (((Eo_Id) 0x1 << REF_TAG_SHIFT) | \
416 ((Eo_Id)(MID_TABLE & MASK_MID_TABLE_ID) << SHIFT_MID_TABLE_ID) | \
417 ((Eo_Id)(TABLE & MASK_TABLE_ID) << SHIFT_TABLE_ID))
419 #define EO_COMPOSE_FINAL_ID(PARTIAL_ID, ENTRY, DOMAIN, GENERATION) \
421 (((Eo_Id)DOMAIN & MASK_DOMAIN) << SHIFT_DOMAIN) | \
422 ((ENTRY & MASK_ENTRY_ID) << SHIFT_ENTRY_ID) | \
423 (GENERATION & MASK_GENERATIONS))
425 /* Macro to extract from an Eo id the indexes of the tables */
426 #define EO_DECOMPOSE_ID(ID, MID_TABLE, TABLE, ENTRY, GENERATION) \
427 MID_TABLE = (ID >> SHIFT_MID_TABLE_ID) & MASK_MID_TABLE_ID; \
428 TABLE = (ID >> SHIFT_TABLE_ID) & MASK_TABLE_ID; \
429 ENTRY = (ID >> SHIFT_ENTRY_ID) & MASK_ENTRY_ID; \
430 GENERATION = ID & MASK_GENERATIONS;
432 /* Macro used for readability */
433 #define TABLE_FROM_IDS tdata->eo_ids_tables[mid_table_id][table_id]
435 static inline _Eo_Id_Entry *
436 _get_available_entry(_Eo_Ids_Table *table)
438 _Eo_Id_Entry *entry = NULL;
440 if (table->start != MAX_ENTRY_ID)
442 /* Serve never used entries first */
443 entry = &(table->entries[table->start]);
446 table->free_entries--;
448 else if (table->fifo_head != -1)
450 /* Pop a free entry from the fifo */
451 entry = &(table->entries[table->fifo_head]);
453 if (entry->next_in_fifo == -1)
454 table->fifo_head = table->fifo_tail = -1;
456 table->fifo_head = entry->next_in_fifo;
457 table->free_entries--;
463 static inline _Eo_Id_Entry *
464 _search_tables(Eo_Id_Table_Data *tdata)
466 _Eo_Ids_Table *table;
469 if (!tdata) return NULL;
470 for (Table_Index mid_table_id = 0; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
472 if (!tdata->eo_ids_tables[mid_table_id])
474 /* Allocate a new intermediate table */
475 tdata->eo_ids_tables[mid_table_id] = _eo_id_mem_calloc(MAX_TABLE_ID, sizeof(_Eo_Ids_Table*));
478 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
480 table = TABLE_FROM_IDS;
484 if (tdata->empty_table)
486 /* Recycle the available empty table */
487 table = tdata->empty_table;
488 tdata->empty_table = NULL;
493 /* Allocate a new table */
494 table = _eo_id_mem_calloc(1, sizeof(_Eo_Ids_Table));
496 /* Initialize the table and reserve the first entry */
498 table->free_entries = MAX_ENTRY_ID - 1;
499 table->fifo_head = table->fifo_tail = -1;
500 table->partial_id = EO_COMPOSE_PARTIAL_ID(mid_table_id, table_id);
501 entry = &(table->entries[0]);
502 UNPROTECT(tdata->eo_ids_tables[mid_table_id]);
503 TABLE_FROM_IDS = table;
504 PROTECT(tdata->eo_ids_tables[mid_table_id]);
507 entry = _get_available_entry(table);
511 /* Store table info into current table */
512 tdata->current_table = table;
518 ERR("no more available entries to store eo objects");
519 tdata->current_table = NULL;
523 /* Gives a fake id that serves as a marker if eo id is off. */
525 _eo_id_allocate(const _Eo_Object *obj, const Eo *parent_id)
527 _Eo_Id_Entry *entry = NULL;
529 Eo_Id_Table_Data *tdata;
532 data = _eo_table_data_get();
535 Efl_Id_Domain domain = ((Eo_Id)parent_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
536 tdata = _eo_table_data_table_get(data, domain);
538 else tdata = _eo_table_data_current_table_get(data);
539 if (!tdata) return 0;
541 if (EINA_LIKELY(!tdata->shared))
543 if (tdata->current_table)
544 entry = _get_available_entry(tdata->current_table);
546 if (!entry) entry = _search_tables(tdata);
548 if (!tdata->current_table || !entry)
553 UNPROTECT(tdata->current_table);
554 /* [1;max-1] thus we never generate an Eo_Id equal to 0 */
556 if (tdata->generation >= MAX_GENERATIONS) tdata->generation = 1;
557 /* Fill the entry and return it's Eo Id */
558 entry->ptr = (_Eo_Object *)obj;
560 entry->generation = tdata->generation;
561 PROTECT(tdata->current_table);
562 id = EO_COMPOSE_FINAL_ID(tdata->current_table->partial_id,
563 (entry - tdata->current_table->entries),
564 data->domain_stack[data->stack_top],
569 eina_lock_take(&(_eo_table_data_shared_data->obj_lock));
570 if (tdata->current_table)
571 entry = _get_available_entry(tdata->current_table);
573 if (!entry) entry = _search_tables(tdata);
575 if (!tdata->current_table || !entry)
581 UNPROTECT(tdata->current_table);
582 /* [1;max-1] thus we never generate an Eo_Id equal to 0 */
584 if (tdata->generation == MAX_GENERATIONS) tdata->generation = 1;
585 /* Fill the entry and return it's Eo Id */
586 entry->ptr = (_Eo_Object *)obj;
588 entry->generation = tdata->generation;
589 PROTECT(tdata->current_table);
590 id = EO_COMPOSE_FINAL_ID(tdata->current_table->partial_id,
591 (entry - tdata->current_table->entries),
592 EFL_ID_DOMAIN_SHARED,
595 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
601 _eo_id_release(const Eo_Id obj_id)
603 _Eo_Ids_Table *table;
605 Generation_Counter generation;
606 Table_Index mid_table_id, table_id, entry_id;
607 Efl_Id_Domain domain;
609 Eo_Id_Table_Data *tdata;
611 domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
612 data = _eo_table_data_get();
613 tdata = _eo_table_data_table_get(data, domain);
616 EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation);
618 if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED))
620 // Check the validity of the entry
621 if (tdata->eo_ids_tables[mid_table_id] && (table = TABLE_FROM_IDS))
623 entry = &(table->entries[entry_id]);
624 if (entry && entry->active && (entry->generation == generation))
627 table->free_entries++;
630 entry->next_in_fifo = -1;
631 // Push the entry into the fifo
632 if (table->fifo_tail == -1)
633 table->fifo_head = table->fifo_tail = entry_id;
636 table->entries[table->fifo_tail].next_in_fifo = entry_id;
637 table->fifo_tail = entry_id;
640 if (table->free_entries == MAX_ENTRY_ID)
642 UNPROTECT(tdata->eo_ids_tables[mid_table_id]);
643 TABLE_FROM_IDS = NULL;
644 PROTECT(tdata->eo_ids_tables[mid_table_id]);
645 // Recycle or free the empty table
646 if (!tdata->empty_table) tdata->empty_table = table;
647 else _eo_id_mem_free(table);
648 if (tdata->current_table == table)
649 tdata->current_table = NULL;
651 // In case an object is destroyed, wipe out the cache
652 if (tdata->cache.id == obj_id)
655 tdata->cache.object = NULL;
657 if ((Eo_Id)tdata->cache.isa_id == obj_id)
659 tdata->cache.isa_id = NULL;
660 tdata->cache.klass = NULL;;
661 tdata->cache.isa = EINA_FALSE;
669 eina_lock_take(&(_eo_table_data_shared_data->obj_lock));
670 // Check the validity of the entry
671 if (tdata->eo_ids_tables[mid_table_id] && (table = TABLE_FROM_IDS))
673 entry = &(table->entries[entry_id]);
674 if (entry && entry->active && (entry->generation == generation))
677 table->free_entries++;
680 entry->next_in_fifo = -1;
681 // Push the entry into the fifo
682 if (table->fifo_tail == -1)
683 table->fifo_head = table->fifo_tail = entry_id;
686 table->entries[table->fifo_tail].next_in_fifo = entry_id;
687 table->fifo_tail = entry_id;
690 if (table->free_entries == MAX_ENTRY_ID)
692 UNPROTECT(tdata->eo_ids_tables[mid_table_id]);
693 TABLE_FROM_IDS = NULL;
694 PROTECT(tdata->eo_ids_tables[mid_table_id]);
695 // Recycle or free the empty table
696 if (!tdata->empty_table) tdata->empty_table = table;
697 else _eo_id_mem_free(table);
698 if (tdata->current_table == table)
699 tdata->current_table = NULL;
701 // In case an object is destroyed, wipe out the cache
702 if (tdata->cache.id == obj_id)
705 tdata->cache.object = NULL;
707 if ((Eo_Id)tdata->cache.isa_id == obj_id)
709 tdata->cache.isa_id = NULL;
710 tdata->cache.klass = NULL;;
711 tdata->cache.isa = EINA_FALSE;
713 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
717 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
719 ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", (void *)obj_id);
723 _eo_free_ids_tables(Eo_Id_Data *data)
725 Eo_Id_Table_Data *tdata;
728 tdata = data->tables[data->local_domain];
729 for (Table_Index mid_table_id = 0; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
731 if (tdata->eo_ids_tables[mid_table_id])
733 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
737 _eo_id_mem_free(TABLE_FROM_IDS);
740 _eo_id_mem_free(tdata->eo_ids_tables[mid_table_id]);
742 tdata->eo_ids_tables[mid_table_id] = NULL;
744 if (tdata->empty_table) _eo_id_mem_free(tdata->empty_table);
745 tdata->empty_table = tdata->current_table = NULL;
746 _eo_table_data_table_free(tdata);
747 data->tables[data->local_domain] = NULL;
753 _eo_print(Eo_Id_Table_Data *tdata)
756 unsigned long obj_number = 0;
758 for (Table_Index mid_table_id = 0; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
760 if (tdata->eo_ids_tables[mid_table_id])
762 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
766 for (Table_Index entry_id = 0; entry_id < MAX_ENTRY_ID; entry_id++)
768 entry = &(TABLE_FROM_IDS->entries[entry_id]);
771 printf("%ld: %p -> (%p, %p, %p, %p)\n", obj_number++,
773 (void *)mid_table_id, (void *)table_id, (void *)entry_id,
774 (void *)entry->generation);