Reverted changes to Zend/zend_arena.h.

Reuse CG(arena) instead of creating a new one.
This commit is contained in:
Dmitry Stogov 2015-07-02 22:31:48 +03:00
parent a4fce36907
commit 501ae8aaac
2 changed files with 10 additions and 10 deletions

View File

@ -33,7 +33,7 @@ struct _zend_arena {
static zend_always_inline zend_arena* zend_arena_create(size_t size)
{
zend_arena *arena = (zend_arena*)emalloc(size + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena)));
zend_arena *arena = (zend_arena*)emalloc(size);
arena->ptr = (char*) arena + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena));
arena->end = (char*) arena + size;

View File

@ -860,16 +860,16 @@ typedef struct _op_var_info {
ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
{
zend_arena *arena = zend_arena_create((sizeof(var_live_info) + sizeof(op_var_info) + 2 * sizeof(var_live_info *)) * op_array->T + (sizeof(op_var_info) + sizeof(op_var_info *) + sizeof(zend_op *)) * (op_array->last + 1));
var_live_info **TsTop = zend_arena_alloc(&arena, sizeof(var_live_info *) * op_array->T);
var_live_info **Ts = zend_arena_alloc(&arena, sizeof(var_live_info *) * op_array->T);
void *checkpoint = zend_arena_checkpoint(CG(arena));
var_live_info **TsTop = zend_arena_alloc(&CG(arena), sizeof(var_live_info *) * op_array->T);
var_live_info **Ts = zend_arena_alloc(&CG(arena), sizeof(var_live_info *) * op_array->T);
int i, op_live_total = 0;
uint32_t *info, info_off = op_array->last + 1;
op_var_info *opTsTop = zend_arena_alloc(&arena, sizeof(op_var_info) * (op_array->last + 1));
op_var_info **opTs = zend_arena_alloc(&arena, sizeof(op_var_info *) * (op_array->last + 1));
op_var_info *opTsTop = zend_arena_alloc(&CG(arena), sizeof(op_var_info) * (op_array->last + 1));
op_var_info **opTs = zend_arena_alloc(&CG(arena), sizeof(op_var_info *) * (op_array->last + 1));
for (i = 0; i < op_array->T; i++) {
TsTop[i] = Ts[i] = zend_arena_alloc(&arena, sizeof(var_live_info));
TsTop[i] = Ts[i] = zend_arena_alloc(&CG(arena), sizeof(var_live_info));
Ts[i]->next = NULL;
Ts[i]->start = Ts[i]->end = -1;
}
@ -888,7 +888,7 @@ ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
&& (cur_op->opcode != ZEND_QM_ASSIGN || (cur_op + 1)->opcode != ZEND_JMP)) {
var_live_info *T = Ts[cur_op->result.var];
if (~T->end) {
T = Ts[cur_op->result.var] = T->next = zend_arena_alloc(&arena, sizeof(var_live_info));
T = Ts[cur_op->result.var] = T->next = zend_arena_alloc(&CG(arena), sizeof(var_live_info));
T->next = NULL;
T->start = T->end = -1;
}
@ -944,7 +944,7 @@ ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
if (op_array->opcodes[j].opcode != ZEND_THROW) {
op_var_info *opT = opTs[j];
if (~opT->T) {
opT = opTs[j] = opT->next = zend_arena_alloc(&arena, sizeof(op_var_info));
opT = opTs[j] = opT->next = zend_arena_alloc(&CG(arena), sizeof(op_var_info));
opT->next = NULL;
}
opT->T = i;
@ -969,7 +969,7 @@ ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
}
info[i] = info_off;
zend_arena_destroy(arena);
zend_arena_release(&CG(arena), checkpoint);
return info;
}