Skip to content

Commit 36db851

Browse files
committed
Add ZEND_FETCH_CLASS_CONSTANT const/const specialization
1 parent a16c02f commit 36db851

File tree

6 files changed

+1492
-1067
lines changed

6 files changed

+1492
-1067
lines changed

Zend/zend_execute.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,21 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D
386386
return ret;
387387
}
388388

389+
static zend_always_inline zval *_get_zval_ptr_tmpvarcv(int op_type, znode_op node, int type EXECUTE_DATA_DC)
390+
{
391+
if (op_type & (IS_TMP_VAR|IS_VAR)) {
392+
if (op_type == IS_TMP_VAR) {
393+
return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
394+
} else {
395+
ZEND_ASSERT(op_type == IS_VAR);
396+
return _get_zval_ptr_var_deref(node.var EXECUTE_DATA_CC);
397+
}
398+
} else {
399+
ZEND_ASSERT(op_type == IS_CV);
400+
return _get_zval_ptr_cv_deref(node.var, type EXECUTE_DATA_CC);
401+
}
402+
}
403+
389404
static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
390405
{
391406
if (op_type & (IS_TMP_VAR|IS_VAR)) {

Zend/zend_vm_def.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5854,8 +5854,7 @@ ZEND_VM_HOT_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED|CONST_FETCH, CONST, CACHE_SL
58545854
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
58555855
}
58565856

5857-
// FIXME: Small performance regression due to ANY. Can we make this CONST|ANY?
5858-
ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, ANY, CACHE_SLOT)
5857+
ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CONST|TMPVARCV, CACHE_SLOT)
58595858
{
58605859
zend_class_entry *ce, *scope;
58615860
zend_class_constant *c;

0 commit comments

Comments
 (0)