Pass in arena to allocator
This is so we can configure a new arena later
This commit is contained in:
parent
dd1e047fcb
commit
451776f13d
14
compile.c
14
compile.c
@ -841,11 +841,10 @@ calc_padding(void *ptr, size_t size)
|
|||||||
#endif /* STRICT_ALIGNMENT */
|
#endif /* STRICT_ALIGNMENT */
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
compile_data_alloc(rb_iseq_t *iseq, size_t size)
|
compile_data_alloc_with_arena(struct iseq_compile_data_storage **arena, size_t size)
|
||||||
{
|
{
|
||||||
void *ptr = 0;
|
void *ptr = 0;
|
||||||
struct iseq_compile_data_storage *storage =
|
struct iseq_compile_data_storage *storage = *arena;
|
||||||
ISEQ_COMPILE_DATA(iseq)->storage_current;
|
|
||||||
#ifdef STRICT_ALIGNMENT
|
#ifdef STRICT_ALIGNMENT
|
||||||
size_t padding = calc_padding((void *)&storage->buff[storage->pos], size);
|
size_t padding = calc_padding((void *)&storage->buff[storage->pos], size);
|
||||||
#else
|
#else
|
||||||
@ -862,7 +861,7 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size)
|
|||||||
}
|
}
|
||||||
storage->next = (void *)ALLOC_N(char, alloc_size +
|
storage->next = (void *)ALLOC_N(char, alloc_size +
|
||||||
offsetof(struct iseq_compile_data_storage, buff));
|
offsetof(struct iseq_compile_data_storage, buff));
|
||||||
storage = ISEQ_COMPILE_DATA(iseq)->storage_current = storage->next;
|
storage = *arena = storage->next;
|
||||||
storage->next = 0;
|
storage->next = 0;
|
||||||
storage->pos = 0;
|
storage->pos = 0;
|
||||||
storage->size = alloc_size;
|
storage->size = alloc_size;
|
||||||
@ -880,6 +879,13 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
compile_data_alloc(rb_iseq_t *iseq, size_t size)
|
||||||
|
{
|
||||||
|
struct iseq_compile_data_storage ** arena = &ISEQ_COMPILE_DATA(iseq)->storage_current;
|
||||||
|
return compile_data_alloc_with_arena(arena, size);
|
||||||
|
}
|
||||||
|
|
||||||
static INSN *
|
static INSN *
|
||||||
compile_data_alloc_insn(rb_iseq_t *iseq)
|
compile_data_alloc_insn(rb_iseq_t *iseq)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user