Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frameless call optimization broke IN_ARRAY DFA transformation #18050

Closed
nielsdos opened this issue Mar 13, 2025 · 3 comments
Closed

Frameless call optimization broke IN_ARRAY DFA transformation #18050

nielsdos opened this issue Mar 13, 2025 · 3 comments

Comments

@nielsdos
Copy link
Member

nielsdos commented Mar 13, 2025

Description

The following code:

<?php
function test($v) {
    $ary = ['x', 'y'];
    var_dump(in_array($v, $ary));
}
test('x');

Resulted in this output (under opcache.opt_debug_level=0x400000):

BB0:
     ; start exit lines=[0-5]
     ; level=0
0000 #2.CV0($v) [any] = RECV 1
0001 INIT_FCALL 1 96 string("var_dump")
0002 #4.T3 [bool] = FRAMELESS_ICALL_2(in_array) #2.CV0($v) [any] array(...)
0003 SEND_VAL #4.T3 [bool] 1
0004 DO_ICALL
0005 RETURN null
bool(true)

But I expected this output instead (like in 8.3) (under opcache.opt_debug_level=0x400000):

BB0:
     ; start exit lines=[0-5]
     ; level=0
0000 #2.CV0($v) [any] = RECV 1
0001 INIT_FCALL 1 96 string("var_dump")
0002 #4.V3 [bool] = IN_ARRAY 0 #2.CV0($v) [any] array(...)
0003 SEND_VAR #4.V3 [bool] 1
0004 DO_ICALL
0005 RETURN null
bool(true)

PHP Version

8.4+

Operating System

No response

@nielsdos
Copy link
Member Author

cc @iluuu1994

@iluuu1994
Copy link
Member

@nielsdos Are you already looking into this? If not, I can do so.

@nielsdos
Copy link
Member Author

I didn't yet look into this, I would have to refresh my memory first of how the callee info is stored etc.
It was pretty low on my TODO list tbh. If you do start work on this, I'm okay with reviewing ofc.

iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 14, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Mar 17, 2025
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes phpGH-18050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants