Skip to content

Commit 58e11b1

Browse files
committed
Clenup: introduce OPTIMIZE_FOR_SIZE macro (disabled by default)
1 parent cc08ba8 commit 58e11b1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444

4545
#define ZREG_RX ZREG_IP
4646

47+
#define OPTIMIZE_FOR_SIZE 0
48+
4749
/* IR builder defines */
4850
#undef _ir_CTX
4951
#define _ir_CTX (&jit->ctx)
@@ -7564,13 +7566,20 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
75647566

75657567
ref = jit_EG(vm_stack_top);
75667568
rx = zend_jit_ip(jit);
7567-
#if 1
7568-
// JIT: EG(vm_stack_top) = (zval*)((char*)call + used_stack);
7569-
// This vesions seems faster, but it generates more code ???
7569+
#if !OPTIMIZE_FOR_SIZE
7570+
/* JIT: EG(vm_stack_top) = (zval*)((char*)call + used_stack);
7571+
* This vesions is longer but faster
7572+
* mov EG(vm_stack_top), %CALL
7573+
* lea size(%call), %tmp
7574+
* mov %tmp, EG(vm_stack_top)
7575+
*/
75707576
top = rx;
75717577
#else
7572-
// JIT: EG(vm_stack_top) += used_stack;
7573-
/* ir_LOAD() makes load forwarding and doesn't allow fusion on x86 */
7578+
/* JIT: EG(vm_stack_top) += used_stack;
7579+
* Use ir_emit() because ir_LOAD() makes load forwarding and doesn't allow load/store fusion
7580+
* mov EG(vm_stack_top), %CALL
7581+
* add $size, EG(vm_stack_top)
7582+
*/
75747583
top = jit->ctx.control = ir_emit2(&jit->ctx, IR_OPT(IR_LOAD, IR_ADDR), jit->ctx.control, ref);
75757584
#endif
75767585
ir_STORE(ref, ir_ADD_A(top, used_stack_ref));

0 commit comments

Comments
 (0)