#define ROUND_UP(x, f) (CEIL (x, f) * (f))
+/* Round X to next multiple of the page size */
+
+#define PAGE_ALIGN(x) (((x) + G.pagesize - 1) & ~(G.pagesize - 1))
+
/* The Ith entry is the number of objects on a page or order I. */
static unsigned objects_per_page_table[NUM_ORDERS];
entry_size = num_objects * OBJECT_SIZE (order);
if (entry_size < G.pagesize)
entry_size = G.pagesize;
- entry_size = ROUND_UP (entry_size, G.pagesize);
+ entry_size = PAGE_ALIGN (entry_size);
entry = NULL;
page = NULL;
{
fprintf (stderr, "\nTotal allocations and overheads during the compilation process\n");
- fprintf (stderr, "Total Overhead: %10lld\n",
+ fprintf (stderr, "Total Overhead: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_overhead);
- fprintf (stderr, "Total Allocated: %10lld\n",
+ fprintf (stderr, "Total Allocated: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_allocated);
- fprintf (stderr, "Total Overhead under 32B: %10lld\n",
+ fprintf (stderr, "Total Overhead under 32B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_overhead_under32);
- fprintf (stderr, "Total Allocated under 32B: %10lld\n",
+ fprintf (stderr, "Total Allocated under 32B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_allocated_under32);
- fprintf (stderr, "Total Overhead under 64B: %10lld\n",
+ fprintf (stderr, "Total Overhead under 64B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_overhead_under64);
- fprintf (stderr, "Total Allocated under 64B: %10lld\n",
+ fprintf (stderr, "Total Allocated under 64B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_allocated_under64);
- fprintf (stderr, "Total Overhead under 128B: %10lld\n",
+ fprintf (stderr, "Total Overhead under 128B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_overhead_under128);
- fprintf (stderr, "Total Allocated under 128B: %10lld\n",
+ fprintf (stderr, "Total Allocated under 128B: %10" HOST_LONG_LONG_FORMAT "d\n",
G.stats.total_allocated_under128);
for (i = 0; i < NUM_ORDERS; i++)
if (G.stats.total_allocated_per_order[i])
{
- fprintf (stderr, "Total Overhead page size %7lu: %10lld\n",
+ fprintf (stderr, "Total Overhead page size %7lu: %10" HOST_LONG_LONG_FORMAT "d\n",
(unsigned long) OBJECT_SIZE (i),
G.stats.total_overhead_per_order[i]);
- fprintf (stderr, "Total Allocated page size %7lu: %10lld\n",
+ fprintf (stderr, "Total Allocated page size %7lu: %10" HOST_LONG_LONG_FORMAT "d\n",
(unsigned long) OBJECT_SIZE (i),
G.stats.total_allocated_per_order[i]);
}
unsigned i;
for (i = 0; i < NUM_ORDERS; i++)
- a += ROUND_UP (d->d.totals[i] * OBJECT_SIZE (i), G.pagesize);
+ a += PAGE_ALIGN (d->d.totals[i] * OBJECT_SIZE (i));
return a;
}
for (i = 0; i < NUM_ORDERS; i++)
{
d->base[i] = a;
- a += ROUND_UP (d->d.totals[i] * OBJECT_SIZE (i), G.pagesize);
+ a += PAGE_ALIGN (d->d.totals[i] * OBJECT_SIZE (i));
}
}
if (d.totals[i] == 0)
continue;
- bytes = ROUND_UP (d.totals[i] * OBJECT_SIZE (i), G.pagesize);
+ bytes = PAGE_ALIGN (d.totals[i] * OBJECT_SIZE (i));
num_objs = bytes / OBJECT_SIZE (i);
entry = XCNEWVAR (struct page_entry, (sizeof (struct page_entry)
- sizeof (long)