summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo_ptr_indirection.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-05-16 10:55:32 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2013-05-16 13:17:11 +0200
commita9e69d519cd5240320e278cdc4efa8b1723a5fa1 (patch)
tree2120598cf66132c40807c05e5a430eb793138c2c /src/lib/eo/eo_ptr_indirection.c
parentab505d5d23299e658b39fa7d0f1aa73742e3e7fb (diff)
eo ptr ind: mostly cosmetic
- add and use SHIFT_* macros - rename queue into fifo - try to clarify the structure top table -> mid table -> table[entry]
Diffstat (limited to 'src/lib/eo/eo_ptr_indirection.c')
-rw-r--r--src/lib/eo/eo_ptr_indirection.c216
1 files changed, 111 insertions, 105 deletions
diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c
index 74a3926..47c5295 100644
--- a/src/lib/eo/eo_ptr_indirection.c
+++ b/src/lib/eo/eo_ptr_indirection.c
@@ -17,14 +17,16 @@
17 * the Eo object to supply a better memory management by preventing bad usage 17 * the Eo object to supply a better memory management by preventing bad usage
18 * of the pointers. 18 * of the pointers.
19 * 19 *
20 * Eo * is no more a pointer but an index to an entry into a ids table. 20 * Eo * is no more a pointer but indexes to an entry into an ids table.
21 * For a better memory usage, we don't allocate all the tables at the beginning, 21 * For a better memory usage:
22 * but only when needed (i.e no more empty entries in allocated tables. 22 * - a tree structure is used, composed of a top level table pointing at
23 * In addition, tables are composed of intermediate tables, this for memory 23 * mid tables pointing at tables composed of entries.
24 * optimizations. Finding the different table, intermediate table and relative 24 * - tables are allocated when needed (i.e no more empty entries in allocated tables.
25 * entry is done by bits manipulation of the id: 25 * For now there is no mechanism to free empty tables.
26 * 26 *
27 * id = Table | Inter_table | Entry | Generation 27 * An Eo id is contructed by bits manipulation of table indexes and a generation.
28 *
29 * id = Mid Table | Table | Entry | Generation
28 * 30 *
29 * Generation helps finding abuse of ids. When an entry is assigned to an 31 * Generation helps finding abuse of ids. When an entry is assigned to an
30 * object, a generation is inserted into the id. If the developer uses this id 32 * object, a generation is inserted into the id. If the developer uses this id
@@ -32,69 +34,73 @@
32 * entry of the table, the generation will be different and an error will 34 * entry of the table, the generation will be different and an error will
33 * occur when accessing with the old id. 35 * occur when accessing with the old id.
34 * 36 *
35 * Each table is composed of: 37 * Each Table is composed of:
36 * - an index 'start' indicating which entry is the next one to use. 38 * - an index 'start' indicating which free entry is the next one to use.
37 * - 2 indexes 'queue_head' and 'queue_tail' defining a queue (fifo), 39 * - 2 indexes 'fifo_head' and 'fifo_tail' defining a fifo,
38 * that will help us to store the entries to be reused. It stores only the 40 * that will help us to store the entries to be reused. It stores only the
39 * entries that have been used at least one time. The entries that have 41 * entries that have been used at least one time. The entries that have
40 * never been used are "pointed" by the start parameter. 42 * never been used are "pointed" by the start parameter.
41 * - entries composed of: 43 * - entries composed of:
42 * - a pointer to the object 44 * - a pointer to the object
45 * - an index 'next_in_fifo' used to chain the free entries in the fifo
43 * - a flag indicating if the entry is active 46 * - a flag indicating if the entry is active
44 * - a generation assigned to the object 47 * - a generation assigned to the object
45 * - an index 'next_in_queue' used to chain the entries in the queue
46 * 48 *
47 * When an entry is searched into a table, we first use one of the entries that 49 * When an entry is searched into a table, we first use one of the entries that
48 * has never been used. If there is none, we try to pop from the queue. 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.
54 *
49 * Assigning all the entries of a table before trying to reuse them from 55 * Assigning all the entries of a table before trying to reuse them from
50 * the fifo ensures that we are not going to soon recycle a released entry, 56 * the fifo ensures that we are not going to soon recycle a released entry,
51 * thus minimize the risks of an aggressive del() then use() on a single entry. 57 * thus minimize the risks of an aggressive del() then use() on a single entry.
52 * If a such entry doesn't exist, we pass to the next table. 58 *
53 * When an entry is found, we reserve it to the object pointer and create
54 * the id with the table id, the intermediate table id, the entry and a
55 * generation.
56 * The indexes and a reference to the last table which served an entry is kept 59 * The indexes and a reference to the last table which served an entry is kept
57 * and is reused prior to the others untill it is full. 60 * and is reused prior to the others untill it is full.
58 * When an object is freed, the entry into the table is released by appending 61 * When an object is freed, the entry into the table is released by appending
59 * it to the queue. 62 * it to the fifo.
60 */ 63 */
61 64
62#if SIZEOF_UINTPTR_T == 4 65#if SIZEOF_UINTPTR_T == 4
63/* 32 bits */ 66/* 32 bits */
64# define BITS_FOR_IDS_TABLE 5 67# define BITS_MID_TABLE_ID 5
65# define BITS_FOR_IDS_INTER_TABLE 5 68# define BITS_TABLE_ID 5
66# define BITS_FOR_ID_IN_TABLE 12 69# define BITS_ENTRY_ID 12
67# define BITS_FOR_GENERATION_COUNTER 10 70# define BITS_GENERATION_COUNTER 10
68typedef int16_t Table_Index; 71typedef int16_t Table_Index;
69typedef uint16_t Generation_Counter; 72typedef uint16_t Generation_Counter;
70#else 73#else
71/* 64 bits */ 74/* 64 bits */
72# define BITS_FOR_IDS_TABLE 11 75# define BITS_MID_TABLE_ID 11
73# define BITS_FOR_IDS_INTER_TABLE 11 76# define BITS_TABLE_ID 11
74# define BITS_FOR_ID_IN_TABLE 12 77# define BITS_ENTRY_ID 12
75# define BITS_FOR_GENERATION_COUNTER 30 78# define BITS_GENERATION_COUNTER 30
76typedef int16_t Table_Index; 79typedef int16_t Table_Index;
77typedef uint32_t Generation_Counter; 80typedef uint32_t Generation_Counter;
78#endif 81#endif
79 82
80/* Shifts macros to manipulate the Eo id */ 83/* Shifts macros to manipulate the Eo id */
81#define SHIFT_FOR_IDS_TABLE \ 84#define SHIFT_MID_TABLE_ID (BITS_TABLE_ID + \
82 (BITS_FOR_IDS_INTER_TABLE + BITS_FOR_ID_IN_TABLE + BITS_FOR_GENERATION_COUNTER) 85 BITS_ENTRY_ID + BITS_GENERATION_COUNTER)
83 86#define SHIFT_TABLE_ID (BITS_ENTRY_ID + BITS_GENERATION_COUNTER)
84#define SHIFT_FOR_IDS_INTER_TABLE \ 87#define SHIFT_ENTRY_ID (BITS_GENERATION_COUNTER)
85 (BITS_FOR_ID_IN_TABLE + BITS_FOR_GENERATION_COUNTER)
86
87#define SHIFT_FOR_ID_IN_TABLE (BITS_FOR_GENERATION_COUNTER)
88 88
89/* Maximum ranges */ 89/* Maximum ranges */
90#define MAX_IDS_TABLES (1 << BITS_FOR_IDS_TABLE) 90#define MAX_MID_TABLE_ID (1 << BITS_MID_TABLE_ID)
91#define MAX_IDS_INTER_TABLES (1 << BITS_FOR_IDS_INTER_TABLE) 91#define MAX_TABLE_ID (1 << BITS_TABLE_ID)
92#define MAX_IDS_PER_TABLE (1 << BITS_FOR_ID_IN_TABLE) 92#define MAX_ENTRY_ID (1 << BITS_ENTRY_ID)
93#define MAX_GENERATIONS (1 << BITS_FOR_GENERATION_COUNTER) 93#define MAX_GENERATIONS (1 << BITS_GENERATION_COUNTER)
94
95/* Masks */
96#define MASK_MID_TABLE_ID (MAX_MID_TABLE_ID - 1)
97#define MASK_TABLE_ID (MAX_TABLE_ID - 1)
98#define MASK_ENTRY_ID (MAX_ENTRY_ID - 1)
99#define MASK_GENERATIONS (MAX_GENERATIONS - 1)
94 100
95#define MEM_HEADER_SIZE 16 101#define MEM_HEADER_SIZE 16
96#define MEM_PAGE_SIZE 4096 102#define MEM_PAGE_SIZE 4096
97#define MEM_MAGIC 0x3f61ec8a 103#define MEM_MAGIC 0x3f61ec8a
98 104
99typedef struct _Mem_Header 105typedef struct _Mem_Header
100{ 106{
@@ -159,26 +165,26 @@ typedef struct
159{ 165{
160 /* Pointer to the object */ 166 /* Pointer to the object */
161 _Eo *ptr; 167 _Eo *ptr;
168 /* Indicates where to find the next entry to recycle */
169 Table_Index next_in_fifo;
162 /* Active flag */ 170 /* Active flag */
163 unsigned int active : 1; 171 unsigned int active : 1;
164 /* Generation */ 172 /* Generation */
165 unsigned int generation : BITS_FOR_GENERATION_COUNTER; 173 unsigned int generation : BITS_GENERATION_COUNTER;
166 /* Indicates where to find the next entry to recycle */
167 Table_Index next_in_queue;
168 174
169} _Eo_Id_Entry; 175} _Eo_Id_Entry;
170 176
171/* Table */ 177/* Table */
172typedef struct 178typedef struct
173{ 179{
174 /* Entries of the table holding real pointers and generations */
175 _Eo_Id_Entry entries[MAX_IDS_PER_TABLE];
176 /* Indicates where start the "never used" entries */ 180 /* Indicates where start the "never used" entries */
177 Table_Index start; 181 Table_Index start;
178 /* Indicates where to find the next entry to recycle */ 182 /* Indicates where to find the next entry to recycle */
179 Table_Index queue_head; 183 Table_Index fifo_head;
180 /* Indicates where to add an entry to recycle */ 184 /* Indicates where to add an entry to recycle */
181 Table_Index queue_tail; 185 Table_Index fifo_tail;
186 /* Entries of the table holding real pointers and generations */
187 _Eo_Id_Entry entries[MAX_ENTRY_ID];
182} _Eo_Ids_Table; 188} _Eo_Ids_Table;
183 189
184/* Table Info */ 190/* Table Info */
@@ -186,14 +192,14 @@ typedef struct
186{ 192{
187 /* Table pointer */ 193 /* Table pointer */
188 _Eo_Ids_Table *table; 194 _Eo_Ids_Table *table;
189 /* Top table index */ 195 /* Index of mid table in top table */
196 Table_Index mid_table_id;
197 /* Index of table in mid table */
190 Table_Index table_id; 198 Table_Index table_id;
191 /* Intermediate table index */
192 Table_Index int_table_id;
193} _Eo_Table_Info; 199} _Eo_Table_Info;
194 200
195/* Tables handling pointers indirection */ 201/* Tables handling pointers indirection */
196static _Eo_Ids_Table **_eo_ids_tables[MAX_IDS_TABLES] = { NULL }; 202static _Eo_Ids_Table **_eo_ids_tables[MAX_MID_TABLE_ID] = { NULL };
197 203
198/* Current table used for following allocations */ 204/* Current table used for following allocations */
199static _Eo_Table_Info current_table = { NULL, 0, 0 }; 205static _Eo_Table_Info current_table = { NULL, 0, 0 };
@@ -202,21 +208,21 @@ static _Eo_Table_Info current_table = { NULL, 0, 0 };
202Generation_Counter _eo_generation_counter; 208Generation_Counter _eo_generation_counter;
203 209
204/* Macro used to compose an Eo id */ 210/* Macro used to compose an Eo id */
205#define EO_COMPOSE_ID(TABLE, INTER_TABLE, ENTRY, GENERATION) \ 211#define EO_COMPOSE_ID(TABLE, INTER_TABLE, ENTRY, GENERATION) \
206 (((Eo_Id)(TABLE & (MAX_IDS_TABLES - 1)) << SHIFT_FOR_IDS_TABLE) | \ 212 (((Eo_Id)(TABLE & MASK_MID_TABLE_ID) << SHIFT_MID_TABLE_ID) | \
207 ((Eo_Id)(INTER_TABLE & (MAX_IDS_INTER_TABLES - 1)) << SHIFT_FOR_IDS_INTER_TABLE) | \ 213 ((Eo_Id)(INTER_TABLE & MASK_TABLE_ID) << SHIFT_TABLE_ID) | \
208 ((ENTRY & (MAX_IDS_PER_TABLE - 1)) << SHIFT_FOR_ID_IN_TABLE) | \ 214 ((ENTRY & MASK_ENTRY_ID) << SHIFT_ENTRY_ID) | \
209 (GENERATION & (MAX_GENERATIONS - 1) )) 215 (GENERATION & MASK_GENERATIONS ))
210 216
211/* Macro to extract from an Eo id the indexes of the tables */ 217/* Macro to extract from an Eo id the indexes of the tables */
212#define EO_DECOMPOSE_ID(ID, TABLE, INTER_TABLE, ENTRY, GENERATION) \ 218#define EO_DECOMPOSE_ID(ID, TABLE, INTER_TABLE, ENTRY, GENERATION) \
213 TABLE = (ID >> SHIFT_FOR_IDS_TABLE) & (MAX_IDS_TABLES - 1); \ 219 TABLE = (ID >> SHIFT_MID_TABLE_ID) & MASK_MID_TABLE_ID; \
214 INTER_TABLE = (ID >> SHIFT_FOR_IDS_INTER_TABLE) & (MAX_IDS_INTER_TABLES - 1); \ 220 INTER_TABLE = (ID >> SHIFT_TABLE_ID) & MASK_TABLE_ID; \
215 ENTRY = (ID >> SHIFT_FOR_ID_IN_TABLE) & (MAX_IDS_PER_TABLE - 1); \ 221 ENTRY = (ID >> SHIFT_ENTRY_ID) & MASK_ENTRY_ID; \
216 GENERATION = ID & (MAX_GENERATIONS - 1); \ 222 GENERATION = ID & MASK_GENERATIONS;
217 223
218/* Macro used for readability */ 224/* Macro used for readability */
219#define ID_TABLE _eo_ids_tables[table_id][int_table_id] 225#define TABLE_FROM_IDS _eo_ids_tables[mid_table_id][table_id]
220 226
221_Eo * 227_Eo *
222_eo_obj_pointer_get(const Eo_Id obj_id) 228_eo_obj_pointer_get(const Eo_Id obj_id)
@@ -224,14 +230,14 @@ _eo_obj_pointer_get(const Eo_Id obj_id)
224#ifdef HAVE_EO_ID 230#ifdef HAVE_EO_ID
225 _Eo_Id_Entry *entry; 231 _Eo_Id_Entry *entry;
226 Generation_Counter generation; 232 Generation_Counter generation;
227 Table_Index table_id, int_table_id, entry_id; 233 Table_Index mid_table_id, table_id, entry_id;
228 234
229 EO_DECOMPOSE_ID(obj_id, table_id, int_table_id, entry_id, generation); 235 EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation);
230 236
231 /* Checking the validity of the entry */ 237 /* Checking the validity of the entry */
232 if (_eo_ids_tables[table_id] && ID_TABLE) 238 if (_eo_ids_tables[mid_table_id] && TABLE_FROM_IDS)
233 { 239 {
234 entry = &(ID_TABLE->entries[entry_id]); 240 entry = &(TABLE_FROM_IDS->entries[entry_id]);
235 if (entry && entry->active && (entry->generation == generation)) 241 if (entry && entry->active && (entry->generation == generation))
236 return entry->ptr; 242 return entry->ptr;
237 } 243 }
@@ -250,20 +256,20 @@ _get_available_entry(_Eo_Ids_Table *table)
250{ 256{
251 _Eo_Id_Entry *entry = NULL; 257 _Eo_Id_Entry *entry = NULL;
252 258
253 if (table->start != MAX_IDS_PER_TABLE) 259 if (table->start != MAX_ENTRY_ID)
254 { 260 {
255 /* Serve never used entries first */ 261 /* Serve never used entries first */
256 entry = &(table->entries[table->start]); 262 entry = &(table->entries[table->start]);
257 table->start++; 263 table->start++;
258 } 264 }
259 else if (table->queue_head != -1) 265 else if (table->fifo_head != -1)
260 { 266 {
261 /* Pop an unused entry from the queue */ 267 /* Pop a free entry from the fifo */
262 entry = &(table->entries[table->queue_head]); 268 entry = &(table->entries[table->fifo_head]);
263 if (entry->next_in_queue == -1) 269 if (entry->next_in_fifo == -1)
264 table->queue_head = table->queue_tail = -1; 270 table->fifo_head = table->fifo_tail = -1;
265 else 271 else
266 table->queue_head = entry->next_in_queue; 272 table->fifo_head = entry->next_in_fifo;
267 } 273 }
268 274
269 return entry; 275 return entry;
@@ -275,25 +281,25 @@ _search_tables()
275 _Eo_Ids_Table *table; 281 _Eo_Ids_Table *table;
276 _Eo_Id_Entry *entry; 282 _Eo_Id_Entry *entry;
277 283
278 for (Table_Index table_id = 1; table_id < MAX_IDS_TABLES; table_id++) 284 for (Table_Index mid_table_id = 1; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
279 { 285 {
280 if (!_eo_ids_tables[table_id]) 286 if (!_eo_ids_tables[mid_table_id])
281 { 287 {
282 /* Allocate a new intermediate table */ 288 /* Allocate a new intermediate table */
283 _eo_ids_tables[table_id] = _eo_id_mem_calloc(MAX_IDS_INTER_TABLES, sizeof(_Eo_Ids_Table*)); 289 _eo_ids_tables[mid_table_id] = _eo_id_mem_calloc(MAX_TABLE_ID, sizeof(_Eo_Ids_Table*));
284 } 290 }
285 291
286 for (Table_Index int_table_id = 0; int_table_id < MAX_IDS_INTER_TABLES; int_table_id++) 292 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
287 { 293 {
288 table = ID_TABLE; 294 table = TABLE_FROM_IDS;
289 295
290 if (!table) 296 if (!table)
291 { 297 {
292 /* Allocate a new table and reserve the first entry */ 298 /* Allocate a new table and reserve the first entry */
293 table = _eo_id_mem_calloc(1, sizeof(_Eo_Ids_Table)); 299 table = _eo_id_mem_calloc(1, sizeof(_Eo_Ids_Table));
294 table->start = 1; 300 table->start = 1;
295 table->queue_head = table->queue_tail = -1; 301 table->fifo_head = table->fifo_tail = -1;
296 ID_TABLE = table; 302 TABLE_FROM_IDS = table;
297 entry = &(table->entries[0]); 303 entry = &(table->entries[0]);
298 } 304 }
299 else 305 else
@@ -303,8 +309,8 @@ _search_tables()
303 { 309 {
304 /* Store table info into current table */ 310 /* Store table info into current table */
305 current_table.table = table; 311 current_table.table = table;
312 current_table.mid_table_id = mid_table_id;
306 current_table.table_id = table_id; 313 current_table.table_id = table_id;
307 current_table.int_table_id = int_table_id;
308 return entry; 314 return entry;
309 } 315 }
310 } 316 }
@@ -337,8 +343,8 @@ _eo_id_allocate(const _Eo *obj)
337 entry->generation = _eo_generation_counter; 343 entry->generation = _eo_generation_counter;
338 _eo_generation_counter++; 344 _eo_generation_counter++;
339 _eo_generation_counter %= MAX_GENERATIONS; 345 _eo_generation_counter %= MAX_GENERATIONS;
340 return EO_COMPOSE_ID(current_table.table_id, 346 return EO_COMPOSE_ID(current_table.mid_table_id,
341 current_table.int_table_id, 347 current_table.table_id,
342 (entry - current_table.table->entries), 348 (entry - current_table.table->entries),
343 entry->generation); 349 entry->generation);
344#else 350#else
@@ -353,27 +359,27 @@ _eo_id_release(const Eo_Id obj_id)
353 _Eo_Ids_Table *table; 359 _Eo_Ids_Table *table;
354 _Eo_Id_Entry *entry; 360 _Eo_Id_Entry *entry;
355 Generation_Counter generation; 361 Generation_Counter generation;
356 Table_Index table_id, int_table_id, entry_id; 362 Table_Index mid_table_id, table_id, entry_id;
357 EO_DECOMPOSE_ID(obj_id, table_id, int_table_id, entry_id, generation); 363 EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation);
358 364
359 /* Checking the validity of the entry */ 365 /* Checking the validity of the entry */
360 if (_eo_ids_tables[table_id] && (table = ID_TABLE)) 366 if (_eo_ids_tables[mid_table_id] && (table = TABLE_FROM_IDS))
361 { 367 {
362 entry = &(table->entries[entry_id]); 368 entry = &(table->entries[entry_id]);
363 if (entry && entry->active && (entry->generation == generation)) 369 if (entry && entry->active && (entry->generation == generation))
364 { 370 {
365 /* Disable the entry */ 371 /* Disable the entry */
366 entry->active = 0; 372 entry->active = 0;
367 entry->next_in_queue = -1; 373 entry->next_in_fifo = -1;
368 /* Push the entry into the queue */ 374 /* Push the entry into the fifo */
369 if (table->queue_tail == -1) 375 if (table->fifo_tail == -1)
370 { 376 {
371 table->queue_head = table->queue_tail = entry_id; 377 table->fifo_head = table->fifo_tail = entry_id;
372 } 378 }
373 else 379 else
374 { 380 {
375 table->entries[table->queue_tail].next_in_queue = entry_id; 381 table->entries[table->fifo_tail].next_in_fifo = entry_id;
376 table->queue_tail = entry_id; 382 table->fifo_tail = entry_id;
377 } 383 }
378 return; 384 return;
379 } 385 }
@@ -388,20 +394,20 @@ _eo_id_release(const Eo_Id obj_id)
388void 394void
389_eo_free_ids_tables() 395_eo_free_ids_tables()
390{ 396{
391 for (Table_Index table_id = 0; table_id < MAX_IDS_TABLES; table_id++) 397 for (Table_Index mid_table_id = 0; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
392 { 398 {
393 if (_eo_ids_tables[table_id]) 399 if (_eo_ids_tables[mid_table_id])
394 { 400 {
395 for (Table_Index int_table_id = 0; int_table_id < MAX_IDS_INTER_TABLES; int_table_id++) 401 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
396 { 402 {
397 if (ID_TABLE) 403 if (TABLE_FROM_IDS)
398 { 404 {
399 _eo_id_mem_free(ID_TABLE); 405 _eo_id_mem_free(TABLE_FROM_IDS);
400 } 406 }
401 } 407 }
402 _eo_id_mem_free(_eo_ids_tables[table_id]); 408 _eo_id_mem_free(_eo_ids_tables[mid_table_id]);
403 } 409 }
404 _eo_ids_tables[table_id] = NULL; 410 _eo_ids_tables[mid_table_id] = NULL;
405 } 411 }
406 current_table.table = NULL; 412 current_table.table = NULL;
407} 413}
@@ -412,22 +418,22 @@ _eo_print()
412{ 418{
413 _Eo_Id_Entry *entry; 419 _Eo_Id_Entry *entry;
414 unsigned long obj_number = 0; 420 unsigned long obj_number = 0;
415 for (Table_Index table_id = 0; table_id < MAX_IDS_TABLES; table_id++) 421 for (Table_Index mid_table_id = 0; mid_table_id < MAX_MID_TABLE_ID; mid_table_id++)
416 { 422 {
417 if (_eo_ids_tables[table_id]) 423 if (_eo_ids_tables[mid_table_id])
418 { 424 {
419 for (Table_Index int_table_id = 0; int_table_id < MAX_IDS_INTER_TABLES; int_table_id++) 425 for (Table_Index table_id = 0; table_id < MAX_TABLE_ID; table_id++)
420 { 426 {
421 if (ID_TABLE) 427 if (TABLE_FROM_IDS)
422 { 428 {
423 for (Table_Index entry_id = 0; entry_id < MAX_IDS_PER_TABLE; entry_id++) 429 for (Table_Index entry_id = 0; entry_id < MAX_ENTRY_ID; entry_id++)
424 { 430 {
425 entry = &(ID_TABLE->entries[entry_id]); 431 entry = &(TABLE_FROM_IDS->entries[entry_id]);
426 if (entry->active) 432 if (entry->active)
427 { 433 {
428 printf("%ld: %p -> (%p, %p, %p, %p)\n", obj_number++, 434 printf("%ld: %p -> (%p, %p, %p, %p)\n", obj_number++,
429 entry->ptr, 435 entry->ptr,
430 (void *)table_id, (void *)int_table_id, (void *)entry_id, 436 (void *)mid_table_id, (void *)table_id, (void *)entry_id,
431 (void *)entry->generation); 437 (void *)entry->generation);
432 } 438 }
433 } 439 }