mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
parent
e482785886
commit
bd183a4069
3 changed files with 49 additions and 0 deletions
|
@ -15572,6 +15572,16 @@ static int zend_jit_switch(zend_jit_ctx *jit, const zend_op *opline, const zend_
|
|||
} ZEND_HASH_FOREACH_END();
|
||||
_zend_jit_add_predecessor_ref(jit, default_b, jit->b, ref);
|
||||
}
|
||||
} else if (!(op1_info & MAY_BE_UNDEF)) {
|
||||
if (next_opline) {
|
||||
if (next_opline == default_opline) {
|
||||
ir_END_list(continue_list);
|
||||
} else {
|
||||
jit_SIDE_EXIT(jit, ir_CONST_ADDR(default_label));
|
||||
}
|
||||
} else {
|
||||
_zend_jit_add_predecessor_ref(jit, default_b, jit->b, ir_END());
|
||||
}
|
||||
}
|
||||
|
||||
if (op1_info & MAY_BE_UNDEF) {
|
||||
|
|
21
ext/opcache/tests/jit/match_002.phpt
Normal file
21
ext/opcache/tests/jit/match_002.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
JIT Match: 002 impossible input
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
}
|
||||
function foo(C $i) {
|
||||
return match($i) {
|
||||
1,2=>0,
|
||||
default=>42
|
||||
};
|
||||
};
|
||||
var_dump(foo(new C));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
18
ext/opcache/tests/jit/match_003.phpt
Normal file
18
ext/opcache/tests/jit/match_003.phpt
Normal file
|
@ -0,0 +1,18 @@
|
|||
--TEST--
|
||||
JIT Match: 003 impossible input
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
--FILE--
|
||||
<?php
|
||||
function foo(C $i) {
|
||||
match($i) {
|
||||
1,2=>0
|
||||
};
|
||||
};
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
Loading…
Add table
Add a link
Reference in a new issue