Hi,

Please, review the following patch
https://gist.github.com/dstogov/fba2cc621ef121826efe

It's huge, but actually, only changes in zend_compile.h are matter. The
rest is obvious renaming.

the main idea - the smaller the zend_op structure, the lees memory traffic
is required to load VM instructions during execution. The patch reduces the
size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode,
and applications use thousands of opoceds). This reduced the number of CPU
cache misses by 12% and improved performance of real-life apps by 1-2%.

The patch affects how constants and jump targets are represented in VM
during execution. Previously they were implemented as absolute 64-bit
pointers. Now they are relative 32-bit offsets.

In run-time constant now should be accessed as:
  RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
  EX_CONSTANT(opline->op1) instead of opline->op1.zv

Jump targets:
  OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr

The patch doesn't change zend_op representation for 32-bit systems. They
still use absolute addresses. The compile-time representation is also kept
the same.

The patch must affect xdebug and may be other very engine depended
extensions, but it must not be a big problem to fix them (only ext/opcache,
ext/reflection and sapi/phpdbg required minor changes).

If nobody objects, I'm going to commit this.

Thanks. Dmitry.

Reply via email to