Skip to content

Commit 0564bbc

Browse files
committed
Further removal of remnants
1 parent c55a164 commit 0564bbc

File tree

3 files changed

+4
-92
lines changed

3 files changed

+4
-92
lines changed

Zend/Optimizer/compact_literals.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -43,50 +43,6 @@ typedef struct _literal_info {
4343
info[n].num_related = (related); \
4444
} while (0)
4545

46-
static size_t type_num_classes(const zend_op_array *op_array, uint32_t arg_num)
47-
{
48-
zend_arg_info *arg_info;
49-
if (arg_num > 0) {
50-
if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
51-
return 0;
52-
}
53-
if (EXPECTED(arg_num <= op_array->num_args)) {
54-
arg_info = &op_array->arg_info[arg_num-1];
55-
} else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
56-
arg_info = &op_array->arg_info[op_array->num_args];
57-
} else {
58-
return 0;
59-
}
60-
} else {
61-
arg_info = op_array->arg_info - 1;
62-
}
63-
64-
if (ZEND_TYPE_IS_COMPLEX(arg_info->type)) {
65-
if (ZEND_TYPE_HAS_LIST(arg_info->type)) {
66-
/* Intersection types cannot have nested list types */
67-
if (ZEND_TYPE_IS_INTERSECTION(arg_info->type)) {
68-
return ZEND_TYPE_LIST(arg_info->type)->num_types;
69-
}
70-
ZEND_ASSERT(ZEND_TYPE_IS_UNION(arg_info->type));
71-
size_t count = 0;
72-
zend_type *list_type;
73-
74-
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(arg_info->type), list_type) {
75-
if (ZEND_TYPE_IS_INTERSECTION(*list_type)) {
76-
count += ZEND_TYPE_LIST(*list_type)->num_types;
77-
} else {
78-
ZEND_ASSERT(!ZEND_TYPE_HAS_LIST(*list_type));
79-
count += 1;
80-
}
81-
} ZEND_TYPE_LIST_FOREACH_END();
82-
return count;
83-
}
84-
return 1;
85-
}
86-
87-
return 0;
88-
}
89-
9046
static uint32_t add_static_slot(HashTable *hash,
9147
zend_op_array *op_array,
9248
uint32_t op1,
@@ -504,17 +460,6 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
504460
opline->op2.constant = map[opline->op2.constant];
505461
}
506462
switch (opline->opcode) {
507-
case ZEND_RECV_INIT:
508-
case ZEND_RECV:
509-
case ZEND_RECV_VARIADIC:
510-
{
511-
size_t num_classes = type_num_classes(op_array, opline->op1.num);
512-
if (num_classes) {
513-
opline->extended_value = cache_size;
514-
cache_size += num_classes * sizeof(void *);
515-
}
516-
break;
517-
}
518463
case ZEND_ASSIGN_STATIC_PROP_OP:
519464
if (opline->op1_type == IS_CONST) {
520465
// op1 static property

Zend/zend_compile.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,33 +2620,6 @@ static void zend_compile_memoized_expr(znode *result, zend_ast *expr) /* {{{ */
26202620
}
26212621
/* }}} */
26222622

2623-
/* Remember to update type_num_classes() in compact_literals.c when changing this function */
2624-
static size_t zend_type_get_num_classes(zend_type type) {
2625-
if (!ZEND_TYPE_IS_COMPLEX(type)) {
2626-
return 0;
2627-
}
2628-
if (ZEND_TYPE_HAS_LIST(type)) {
2629-
/* Intersection types cannot have nested list types */
2630-
if (ZEND_TYPE_IS_INTERSECTION(type)) {
2631-
return ZEND_TYPE_LIST(type)->num_types;
2632-
}
2633-
ZEND_ASSERT(ZEND_TYPE_IS_UNION(type));
2634-
size_t count = 0;
2635-
zend_type *list_type;
2636-
2637-
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
2638-
if (ZEND_TYPE_IS_INTERSECTION(*list_type)) {
2639-
count += ZEND_TYPE_LIST(*list_type)->num_types;
2640-
} else {
2641-
ZEND_ASSERT(!ZEND_TYPE_HAS_LIST(*list_type));
2642-
count += 1;
2643-
}
2644-
} ZEND_TYPE_LIST_FOREACH_END();
2645-
return count;
2646-
}
2647-
return 1;
2648-
}
2649-
26502623
static void zend_emit_return_type_check(
26512624
znode *expr, zend_arg_info *return_info, bool implicit) /* {{{ */
26522625
{
@@ -7752,12 +7725,6 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
77527725
SET_NODE(opline->result, &var_node);
77537726
opline->op1.num = i + 1;
77547727

7755-
if (type_ast) {
7756-
/* Allocate cache slot to speed-up run-time class resolution */
7757-
opline->extended_value =
7758-
zend_alloc_cache_slots(zend_type_get_num_classes(arg_info->type));
7759-
}
7760-
77617728
uint32_t arg_info_flags = _ZEND_ARG_INFO_FLAGS(is_ref, is_variadic, /* is_tentative */ 0)
77627729
| (is_promoted ? _ZEND_IS_PROMOTED_BIT : 0);
77637730
ZEND_TYPE_FULL_MASK(arg_info->type) |= arg_info_flags;

Zend/zend_vm_def.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5677,7 +5677,7 @@ ZEND_VM_HELPER(zend_verify_recv_arg_type_helper, ANY, ANY, zval *op_1)
56775677
ZEND_VM_NEXT_OPCODE();
56785678
}
56795679

5680-
ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, CACHE_SLOT)
5680+
ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, UNUSED)
56815681
{
56825682
USE_OPLINE
56835683
uint32_t arg_num = opline->op1.num;
@@ -5696,7 +5696,7 @@ ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, CACHE_SLOT)
56965696
ZEND_VM_NEXT_OPCODE();
56975697
}
56985698

5699-
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_RECV, op->op2.num == MAY_BE_ANY, ZEND_RECV_NOTYPE, NUM, NUM, CACHE_SLOT)
5699+
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_RECV, op->op2.num == MAY_BE_ANY, ZEND_RECV_NOTYPE, NUM, NUM, UNUSED)
57005700
{
57015701
USE_OPLINE
57025702
uint32_t arg_num = opline->op1.num;
@@ -5708,7 +5708,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_RECV, op->op2.num == MAY_BE_ANY, ZEND_RECV_NO
57085708
ZEND_VM_NEXT_OPCODE();
57095709
}
57105710

5711-
ZEND_VM_HOT_HANDLER(64, ZEND_RECV_INIT, NUM, CONST, CACHE_SLOT)
5711+
ZEND_VM_HOT_HANDLER(64, ZEND_RECV_INIT, NUM, CONST, UNUSED)
57125712
{
57135713
USE_OPLINE
57145714
uint32_t arg_num;
@@ -5758,7 +5758,7 @@ ZEND_VM_C_LABEL(recv_init_check_type):
57585758
ZEND_VM_NEXT_OPCODE();
57595759
}
57605760

5761-
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, CACHE_SLOT)
5761+
ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, UNUSED)
57625762
{
57635763
USE_OPLINE
57645764
uint32_t arg_num = opline->op1.num;

0 commit comments

Comments
 (0)