mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Reorder fields for better nenory consumtion and data locality on 64-bit systems
This commit is contained in:
parent
b1f53ca415
commit
ee552b628c
8 changed files with 31 additions and 33 deletions
12
Zend/zend.h
12
Zend/zend.h
|
@ -476,14 +476,14 @@ struct _zend_class_entry {
|
|||
int refcount;
|
||||
uint32_t ce_flags;
|
||||
|
||||
HashTable function_table;
|
||||
HashTable properties_info;
|
||||
int default_properties_count;
|
||||
int default_static_members_count;
|
||||
zval *default_properties_table;
|
||||
zval *default_static_members_table;
|
||||
zval *static_members_table;
|
||||
HashTable function_table;
|
||||
HashTable properties_info;
|
||||
HashTable constants_table;
|
||||
int default_properties_count;
|
||||
int default_static_members_count;
|
||||
|
||||
union _zend_function *constructor;
|
||||
union _zend_function *destructor;
|
||||
|
@ -511,11 +511,11 @@ struct _zend_class_entry {
|
|||
int (*serialize)(zval *object, unsigned char **buffer, uint32_t *buf_len, zend_serialize_data *data TSRMLS_DC);
|
||||
int (*unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, uint32_t buf_len, zend_unserialize_data *data TSRMLS_DC);
|
||||
|
||||
zend_class_entry **interfaces;
|
||||
uint32_t num_interfaces;
|
||||
uint32_t num_traits;
|
||||
zend_class_entry **interfaces;
|
||||
|
||||
zend_class_entry **traits;
|
||||
uint32_t num_traits;
|
||||
zend_trait_alias **trait_aliases;
|
||||
zend_trait_precedence **trait_precedences;
|
||||
|
||||
|
|
|
@ -5095,7 +5095,7 @@ void zend_compile_try(zend_ast *ast TSRMLS_DC) {
|
|||
CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = opnum_jmp + 1;
|
||||
CG(active_op_array)->try_catch_array[try_catch_offset].finally_end
|
||||
= get_next_op_number(CG(active_op_array));
|
||||
CG(active_op_array)->has_finally_block = 1;
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_HAS_FINALLY_BLOCK;
|
||||
|
||||
zend_emit_op(NULL, ZEND_FAST_RET, NULL, NULL TSRMLS_CC);
|
||||
|
||||
|
|
|
@ -221,15 +221,17 @@ typedef struct _zend_try_catch_element {
|
|||
/* function has arguments with type hinting */
|
||||
#define ZEND_ACC_HAS_TYPE_HINTS 0x10000000
|
||||
|
||||
/* op_array has finally blocks */
|
||||
#define ZEND_ACC_HAS_FINALLY_BLOCK 0x20000000
|
||||
|
||||
#define ZEND_CE_IS_TRAIT(ce) (((ce)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)
|
||||
|
||||
char *zend_visibility_string(uint32_t fn_flags);
|
||||
|
||||
typedef struct _zend_property_info {
|
||||
uint32_t flags;
|
||||
zend_string *name;
|
||||
zend_ulong h;
|
||||
int offset;
|
||||
zend_string *name;
|
||||
zend_string *doc_comment;
|
||||
zend_class_entry *ce;
|
||||
} zend_property_info;
|
||||
|
@ -263,9 +265,9 @@ typedef struct _zend_internal_function_info {
|
|||
struct _zend_op_array {
|
||||
/* Common elements */
|
||||
zend_uchar type;
|
||||
uint32_t fn_flags;
|
||||
zend_string *function_name;
|
||||
zend_class_entry *scope;
|
||||
uint32_t fn_flags;
|
||||
zend_function *prototype;
|
||||
uint32_t num_args;
|
||||
uint32_t required_num_args;
|
||||
|
@ -274,37 +276,34 @@ struct _zend_op_array {
|
|||
|
||||
uint32_t *refcount;
|
||||
|
||||
zend_op *opcodes;
|
||||
uint32_t this_var;
|
||||
|
||||
uint32_t last;
|
||||
zend_op *opcodes;
|
||||
|
||||
zend_string **vars;
|
||||
int last_var;
|
||||
|
||||
uint32_t T;
|
||||
zend_string **vars;
|
||||
|
||||
zend_brk_cont_element *brk_cont_array;
|
||||
int last_brk_cont;
|
||||
|
||||
zend_try_catch_element *try_catch_array;
|
||||
int last_try_catch;
|
||||
zend_bool has_finally_block;
|
||||
zend_brk_cont_element *brk_cont_array;
|
||||
zend_try_catch_element *try_catch_array;
|
||||
|
||||
/* static variables support */
|
||||
HashTable *static_variables;
|
||||
|
||||
uint32_t this_var;
|
||||
|
||||
zend_string *filename;
|
||||
uint32_t line_start;
|
||||
uint32_t line_end;
|
||||
zend_string *doc_comment;
|
||||
uint32_t early_binding; /* the linked list of delayed declarations */
|
||||
|
||||
zval *literals;
|
||||
int last_literal;
|
||||
zval *literals;
|
||||
|
||||
void **run_time_cache;
|
||||
int last_cache_slot;
|
||||
void **run_time_cache;
|
||||
|
||||
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
|
||||
};
|
||||
|
@ -316,9 +315,9 @@ struct _zend_op_array {
|
|||
typedef struct _zend_internal_function {
|
||||
/* Common elements */
|
||||
zend_uchar type;
|
||||
uint32_t fn_flags;
|
||||
zend_string* function_name;
|
||||
zend_class_entry *scope;
|
||||
uint32_t fn_flags;
|
||||
zend_function *prototype;
|
||||
uint32_t num_args;
|
||||
uint32_t required_num_args;
|
||||
|
@ -336,9 +335,9 @@ union _zend_function {
|
|||
|
||||
struct {
|
||||
zend_uchar type; /* never used */
|
||||
uint32_t fn_flags;
|
||||
zend_string *function_name;
|
||||
zend_class_entry *scope;
|
||||
uint32_t fn_flags;
|
||||
union _zend_function *prototype;
|
||||
uint32_t num_args;
|
||||
uint32_t required_num_args;
|
||||
|
|
|
@ -70,9 +70,9 @@ static ZEND_FUNCTION(pass)
|
|||
|
||||
static const zend_internal_function zend_pass_function = {
|
||||
ZEND_INTERNAL_FUNCTION, /* type */
|
||||
0, /* fn_flags */
|
||||
NULL, /* name */
|
||||
NULL, /* scope */
|
||||
0, /* fn_flags */
|
||||
NULL, /* prototype */
|
||||
0, /* num_args */
|
||||
0, /* required_num_args */
|
||||
|
|
|
@ -146,7 +146,7 @@ static void zend_generator_dtor_storage(zend_object *object TSRMLS_DC) /* {{{ */
|
|||
uint32_t op_num, finally_op_num;
|
||||
int i;
|
||||
|
||||
if (!ex || !ex->func->op_array.has_finally_block) {
|
||||
if (!ex || !(ex->func->op_array.fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_siz
|
|||
|
||||
op_array->static_variables = NULL;
|
||||
op_array->last_try_catch = 0;
|
||||
op_array->has_finally_block = 0;
|
||||
|
||||
op_array->this_var = -1;
|
||||
|
||||
|
@ -678,7 +677,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
|
|||
if (!ZEND_USER_CODE(op_array->type)) {
|
||||
return 0;
|
||||
}
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
zend_resolve_finally_calls(op_array TSRMLS_CC);
|
||||
}
|
||||
if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) {
|
||||
|
|
|
@ -1952,7 +1952,7 @@ static void zend_block_optimization(zend_op_array *op_array, zend_optimizer_ctx
|
|||
fflush(stderr);
|
||||
#endif
|
||||
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
|
|||
break;
|
||||
|
||||
case ZEND_JMP:
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
|
|||
|
||||
case ZEND_JMP_SET:
|
||||
case ZEND_JMP_SET_VAR:
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
|
|||
break;
|
||||
case ZEND_JMPZ:
|
||||
case ZEND_JMPNZ:
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ if (ZEND_OPTIMIZER_PASS_3 & OPTIMIZATION_LEVEL) {
|
|||
zend_uchar T_type = opline->result_type;
|
||||
znode_op T = opline->result;
|
||||
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ continue_jmp_ex_optimization:
|
|||
break;
|
||||
|
||||
case ZEND_JMPZNZ:
|
||||
if (op_array->has_finally_block) {
|
||||
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue