comparison gcc/alloc-pool.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children f6334be47118
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
39 /* The data of the object. */ 39 /* The data of the object. */
40 char data[1]; 40 char data[1];
41 41
42 /* Because we want any type of data to be well aligned after the ID, 42 /* Because we want any type of data to be well aligned after the ID,
43 the following elements are here. They are never accessed so 43 the following elements are here. They are never accessed so
44 the allocated object may be even smaller than this structure. */ 44 the allocated object may be even smaller than this structure.
45 We do not care about alignment for floating-point types. */
45 char *align_p; 46 char *align_p;
46 HOST_WIDEST_INT align_i; 47 HOST_WIDEST_INT align_i;
47 long double align_ld;
48 } u; 48 } u;
49 } allocation_object; 49 } allocation_object;
50 50
51 /* Convert a pointer to allocation_object from a pointer to user data. */ 51 /* Convert a pointer to allocation_object from a pointer to user data. */
52 #define ALLOCATION_OBJECT_PTR_FROM_USER_PTR(X) \ 52 #define ALLOCATION_OBJECT_PTR_FROM_USER_PTR(X) \
114 alloc_pool_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL); 114 alloc_pool_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL);
115 115
116 slot = (struct alloc_pool_descriptor **) 116 slot = (struct alloc_pool_descriptor **)
117 htab_find_slot_with_hash (alloc_pool_hash, name, 117 htab_find_slot_with_hash (alloc_pool_hash, name,
118 htab_hash_pointer (name), 118 htab_hash_pointer (name),
119 1); 119 INSERT);
120 if (*slot) 120 if (*slot)
121 return *slot; 121 return *slot;
122 *slot = XCNEW (struct alloc_pool_descriptor); 122 *slot = XCNEW (struct alloc_pool_descriptor);
123 (*slot)->name = name; 123 (*slot)->name = name;
124 return *slot; 124 return *slot;
272 272
273 /* Make the block. */ 273 /* Make the block. */
274 block = XNEWVEC (char, pool->block_size); 274 block = XNEWVEC (char, pool->block_size);
275 block_header = (alloc_pool_list) block; 275 block_header = (alloc_pool_list) block;
276 block += align_eight (sizeof (struct alloc_pool_list_def)); 276 block += align_eight (sizeof (struct alloc_pool_list_def));
277 277
278 /* Throw it on the block list. */ 278 /* Throw it on the block list. */
279 block_header->next = pool->block_list; 279 block_header->next = pool->block_list;
280 pool->block_list = block_header; 280 pool->block_list = block_header;
281 281
282 /* Make the block available for allocation. */ 282 /* Make the block available for allocation. */
288 pool->elts_allocated += pool->elts_per_block; 288 pool->elts_allocated += pool->elts_per_block;
289 pool->elts_free += pool->elts_per_block; 289 pool->elts_free += pool->elts_per_block;
290 pool->blocks_allocated += 1; 290 pool->blocks_allocated += 1;
291 } 291 }
292 292
293 293
294 /* We now know that we can take the first elt off the virgin list and 294 /* We now know that we can take the first elt off the virgin list and
295 put it on the returned list. */ 295 put it on the returned list. */
296 block = pool->virgin_free_list; 296 block = pool->virgin_free_list;
297 header = (alloc_pool_list) USER_PTR_FROM_ALLOCATION_OBJECT_PTR (block); 297 header = (alloc_pool_list) USER_PTR_FROM_ALLOCATION_OBJECT_PTR (block);
298 header->next = NULL; 298 header->next = NULL;
372 struct output_info *i = (struct output_info *) b; 372 struct output_info *i = (struct output_info *) b;
373 373
374 if (d->allocated) 374 if (d->allocated)
375 { 375 {
376 fprintf (stderr, "%-22s %6d %10lu %10lu(%10lu) %10lu(%10lu) %10lu(%10lu)\n", d->name, 376 fprintf (stderr, "%-22s %6d %10lu %10lu(%10lu) %10lu(%10lu) %10lu(%10lu)\n", d->name,
377 d->elt_size, d->created, d->allocated, d->allocated / d->elt_size, 377 d->elt_size, d->created, d->allocated, d->allocated / d->elt_size,
378 d->peak, d->peak / d->elt_size, 378 d->peak, d->peak / d->elt_size,
379 d->current, d->current / d->elt_size); 379 d->current, d->current / d->elt_size);
380 i->total_allocated += d->allocated; 380 i->total_allocated += d->allocated;
381 i->total_created += d->created; 381 i->total_created += d->created;
382 } 382 }
383 return 1; 383 return 1;