summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-05-03 14:40:18 +0300
committerDmitry Stogov <dmitry@zend.com>2018-05-03 14:40:18 +0300
commit1a63fa6ec9b0bacbb726e60c3c212e7d97b518c6 (patch)
tree31df39e3dae0107e1837d60fe318dd094d765d10 /Zend/zend_opcode.c
parent5a31e14beba625f1b32d61d6aec85b3df7f023cc (diff)
downloadphp-git-1a63fa6ec9b0bacbb726e60c3c212e7d97b518c6.tar.gz
Implemented Request #76178 (Class constants are slow: they should be inlined at runtime)
Run-time cache is used to eliminate recalculation of constant expression in RECV_INIT opcode (only non reference countable values are cached).
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index f534808321..869baae020 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -579,6 +579,16 @@ ZEND_API int pass_two(zend_op_array *op_array)
end = opline + op_array->last;
while (opline < end) {
switch (opline->opcode) {
+ case ZEND_RECV_INIT:
+ {
+ zval *val = CT_CONSTANT(opline->op2);
+ if (Z_TYPE_P(val) == IS_CONSTANT_AST) {
+ uint32_t slot = ZEND_MM_ALIGNED_SIZE_EX(op_array->cache_size, 8);
+ Z_CACHE_SLOT_P(val) = slot;
+ op_array->cache_size += sizeof(zval);
+ }
+ }
+ break;
case ZEND_FAST_CALL:
opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);