@@ -8967,13 +8967,18 @@ static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, zend_op_array
8967
8967
| add r0, offsetof(zend_reference, val)
8968
8968
}
8969
8969
if (!ZEND_TYPE_IS_CLASS(type)) {
8970
- // TODO: Use bt?
8971
8970
uint32_t type_mask = ZEND_TYPE_MASK(type);
8972
- | mov edx, 1
8973
- | mov cl, byte [r0 + 8]
8974
- | shl edx, cl
8975
- | test edx, type_mask
8976
- | je >8
8971
+ if (is_power_of_two(type_mask)) {
8972
+ uint32_t type_code = concrete_type(type_mask);
8973
+ | cmp byte [r0 + 8], type_code
8974
+ | jne >8
8975
+ } else {
8976
+ | mov edx, 1
8977
+ | mov cl, byte [r0 + 8]
8978
+ | shl edx, cl
8979
+ | test edx, type_mask
8980
+ | je >8
8981
+ }
8977
8982
} else {
8978
8983
| SAVE_VALID_OPLINE opline
8979
8984
| cmp byte [r0 + 8], IS_OBJECT
@@ -9111,12 +9116,18 @@ static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, zend_op_a
9111
9116
| LOAD_ZVAL_ADDR r0, res_addr
9112
9117
| ZVAL_DEREF r0, MAY_BE_REF
9113
9118
if (!ZEND_TYPE_IS_CLASS(arg_info->type)) {
9114
- // TODO: Use bt?
9115
- | mov edx, 1
9116
- | mov cl, byte [r0 + 8]
9117
- | shl edx, cl
9118
- | test edx, ZEND_TYPE_MASK(arg_info->type)
9119
- | je >8
9119
+ uint32_t type_mask = ZEND_TYPE_MASK(arg_info->type);
9120
+ if (is_power_of_two(type_mask)) {
9121
+ uint32_t type_code = concrete_type(type_mask);
9122
+ | cmp byte [r0 + 8], type_code
9123
+ | jne >8
9124
+ } else {
9125
+ | mov edx, 1
9126
+ | mov cl, byte [r0 + 8]
9127
+ | shl edx, cl
9128
+ | test edx, type_mask
9129
+ | je >8
9130
+ }
9120
9131
} else {
9121
9132
| cmp byte [r0 + 8], IS_OBJECT
9122
9133
| jne >8
0 commit comments