Use PRIuSIZE instead of "%zu"
This commit is contained in:
parent
da76c4460f
commit
efa380b006
17
cont.c
17
cont.c
@ -292,7 +292,7 @@ fiber_pool_stack_alloca(struct fiber_pool_stack * stack, size_t offset)
|
|||||||
{
|
{
|
||||||
STACK_GROW_DIR_DETECTION;
|
STACK_GROW_DIR_DETECTION;
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %zu/%zu\n", stack, offset, stack->available);
|
if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %"PRIuSIZE"/%"PRIuSIZE"\n", stack, offset, stack->available);
|
||||||
VM_ASSERT(stack->available >= offset);
|
VM_ASSERT(stack->available >= offset);
|
||||||
|
|
||||||
// The pointer to the memory being allocated:
|
// The pointer to the memory being allocated:
|
||||||
@ -445,7 +445,7 @@ fiber_pool_expand(struct fiber_pool * fiber_pool, size_t count)
|
|||||||
void * base = fiber_pool_allocate_memory(&count, stride);
|
void * base = fiber_pool_allocate_memory(&count, stride);
|
||||||
|
|
||||||
if (base == NULL) {
|
if (base == NULL) {
|
||||||
rb_raise(rb_eFiberError, "can't alloc machine stack to fiber (%zu x %zu bytes): %s", count, size, ERRNOMSG);
|
rb_raise(rb_eFiberError, "can't alloc machine stack to fiber (%"PRIuSIZE" x %"PRIuSIZE" bytes): %s", count, size, ERRNOMSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct fiber_pool_vacancy * vacancies = fiber_pool->vacancies;
|
struct fiber_pool_vacancy * vacancies = fiber_pool->vacancies;
|
||||||
@ -461,7 +461,10 @@ fiber_pool_expand(struct fiber_pool * fiber_pool, size_t count)
|
|||||||
#endif
|
#endif
|
||||||
allocation->pool = fiber_pool;
|
allocation->pool = fiber_pool;
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_expand(%zu): %p, %zu/%zu x [%zu:%zu]\n", count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size);
|
if (DEBUG) {
|
||||||
|
fprintf(stderr, "fiber_pool_expand(%"PRIuSIZE"): %p, %"PRIuSIZE"/%"PRIuSIZE" x [%"PRIuSIZE":%"PRIuSIZE"]\n",
|
||||||
|
count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size);
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate over all stacks, initializing the vacancy list:
|
// Iterate over all stacks, initializing the vacancy list:
|
||||||
for (size_t i = 0; i < count; i += 1) {
|
for (size_t i = 0; i < count; i += 1) {
|
||||||
@ -540,7 +543,7 @@ fiber_pool_allocation_free(struct fiber_pool_allocation * allocation)
|
|||||||
|
|
||||||
VM_ASSERT(allocation->used == 0);
|
VM_ASSERT(allocation->used == 0);
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_allocation_free: %p base=%p count=%zu\n", allocation, allocation->base, allocation->count);
|
if (DEBUG) fprintf(stderr, "fiber_pool_allocation_free: %p base=%p count=%"PRIuSIZE"\n", allocation, allocation->base, allocation->count);
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < allocation->count; i += 1) {
|
for (i = 0; i < allocation->count; i += 1) {
|
||||||
@ -581,7 +584,7 @@ static struct fiber_pool_stack
|
|||||||
fiber_pool_stack_acquire(struct fiber_pool * fiber_pool) {
|
fiber_pool_stack_acquire(struct fiber_pool * fiber_pool) {
|
||||||
struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pop(fiber_pool);
|
struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pop(fiber_pool);
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%zu\n", fiber_pool->vacancies, fiber_pool->used);
|
if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%"PRIuSIZE"\n", fiber_pool->vacancies, fiber_pool->used);
|
||||||
|
|
||||||
if (!vacancy) {
|
if (!vacancy) {
|
||||||
const size_t maximum = FIBER_POOL_ALLOCATION_MAXIMUM_SIZE;
|
const size_t maximum = FIBER_POOL_ALLOCATION_MAXIMUM_SIZE;
|
||||||
@ -625,7 +628,7 @@ fiber_pool_stack_free(struct fiber_pool_stack * stack)
|
|||||||
// If this is not true, the vacancy information will almost certainly be destroyed:
|
// If this is not true, the vacancy information will almost certainly be destroyed:
|
||||||
VM_ASSERT(size <= (stack->size - RB_PAGE_SIZE));
|
VM_ASSERT(size <= (stack->size - RB_PAGE_SIZE));
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_stack_free: %p+%zu [base=%p, size=%zu]\n", base, size, stack->base, stack->size);
|
if (DEBUG) fprintf(stderr, "fiber_pool_stack_free: %p+%"PRIuSIZE" [base=%p, size=%"PRIuSIZE"]\n", base, size, stack->base, stack->size);
|
||||||
|
|
||||||
#if VM_CHECK_MODE > 0 && defined(MADV_DONTNEED)
|
#if VM_CHECK_MODE > 0 && defined(MADV_DONTNEED)
|
||||||
// This immediately discards the pages and the memory is reset to zero.
|
// This immediately discards the pages and the memory is reset to zero.
|
||||||
@ -650,7 +653,7 @@ fiber_pool_stack_release(struct fiber_pool_stack * stack)
|
|||||||
struct fiber_pool * pool = stack->pool;
|
struct fiber_pool * pool = stack->pool;
|
||||||
struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pointer(stack->base, stack->size);
|
struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pointer(stack->base, stack->size);
|
||||||
|
|
||||||
if (DEBUG) fprintf(stderr, "fiber_pool_stack_release: %p used=%zu\n", stack->base, stack->pool->used);
|
if (DEBUG) fprintf(stderr, "fiber_pool_stack_release: %p used=%"PRIuSIZE"\n", stack->base, stack->pool->used);
|
||||||
|
|
||||||
// Copy the stack details into the vacancy area:
|
// Copy the stack details into the vacancy area:
|
||||||
vacancy->stack = *stack;
|
vacancy->stack = *stack;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user