Hi Dmitry,
I found that INIT_FCALL doesn't use opline->result.var and DO_ICALL doesn't
use op1 or op2. The original purpose of separating these two op was for
sending parameters.
However, if a function doesn't need parameters and it's an internal
function, I think the operation could be merged into INIT_FCALL.
So I guess we can do this below to reduce one bytecode for each function
call without parameters:
if (opline->extended_value == 0) {
// call the function directly and store the value in the result.
}
Your thoughts?
Best Regards,
Yo-An Lin
I think this optimization could be done by two approach:
-
Add another FCALL op, which init a function call and call that function
directly for functions without parameters. -
Let the original INIT_FCALL support "call function when the number of
parameter == 0"
Hi Dmitry,
I found that INIT_FCALL doesn't use opline->result.var and DO_ICALL
doesn't use op1 or op2. The original purpose of separating these two op was
for sending parameters.However, if a function doesn't need parameters and it's an internal
function, I think the operation could be merged into INIT_FCALL.So I guess we can do this below to reduce one bytecode for each function
call without parameters:if (opline->extended_value == 0) { // call the function directly and store the value in the result. }
Your thoughts?
Best Regards,
Yo-An Lin
--
Best Regards,
Yo-An Lin