mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Reverted changes to Zend/zend_arena.h.
Reuse CG(arena) instead of creating a new one.
This commit is contained in:
parent
a4fce36907
commit
501ae8aaac
@ -33,7 +33,7 @@ struct _zend_arena {
|
|||||||
|
|
||||||
static zend_always_inline zend_arena* zend_arena_create(size_t size)
|
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->ptr = (char*) arena + ZEND_MM_ALIGNED_SIZE(sizeof(zend_arena));
|
||||||
arena->end = (char*) arena + size;
|
arena->end = (char*) arena + size;
|
||||||
|
@ -860,16 +860,16 @@ typedef struct _op_var_info {
|
|||||||
|
|
||||||
ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
|
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));
|
void *checkpoint = zend_arena_checkpoint(CG(arena));
|
||||||
var_live_info **TsTop = zend_arena_alloc(&arena, sizeof(var_live_info *) * op_array->T);
|
var_live_info **TsTop = zend_arena_alloc(&CG(arena), sizeof(var_live_info *) * op_array->T);
|
||||||
var_live_info **Ts = zend_arena_alloc(&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;
|
int i, op_live_total = 0;
|
||||||
uint32_t *info, info_off = op_array->last + 1;
|
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 *opTsTop = zend_arena_alloc(&CG(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 **opTs = zend_arena_alloc(&CG(arena), sizeof(op_var_info *) * (op_array->last + 1));
|
||||||
|
|
||||||
for (i = 0; i < op_array->T; i++) {
|
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]->next = NULL;
|
||||||
Ts[i]->start = Ts[i]->end = -1;
|
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)) {
|
&& (cur_op->opcode != ZEND_QM_ASSIGN || (cur_op + 1)->opcode != ZEND_JMP)) {
|
||||||
var_live_info *T = Ts[cur_op->result.var];
|
var_live_info *T = Ts[cur_op->result.var];
|
||||||
if (~T->end) {
|
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->next = NULL;
|
||||||
T->start = T->end = -1;
|
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) {
|
if (op_array->opcodes[j].opcode != ZEND_THROW) {
|
||||||
op_var_info *opT = opTs[j];
|
op_var_info *opT = opTs[j];
|
||||||
if (~opT->T) {
|
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->next = NULL;
|
||||||
}
|
}
|
||||||
opT->T = i;
|
opT->T = i;
|
||||||
@ -969,7 +969,7 @@ ZEND_API uint32_t *generate_var_liveliness_info(zend_op_array *op_array)
|
|||||||
}
|
}
|
||||||
info[i] = info_off;
|
info[i] = info_off;
|
||||||
|
|
||||||
zend_arena_destroy(arena);
|
zend_arena_release(&CG(arena), checkpoint);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user