Commit Graph

297 Commits

Author SHA1 Message Date
Dmitry Stogov
f4b46314f6 Prevent CGG reordering if hanlers order is defined by zend_vm_order.txt 2020-05-22 12:37:35 +03:00
Nikita Popov
d4de3f95d6 Remove spurious const qualifier from function return type 2020-02-06 11:59:52 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Nikita Popov
58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Tyson Andre
a7580899f3 Support the same handler for multiple opcodes 2019-11-15 17:37:01 +03:00
Tyson Andre
e8525c2f68 Optimize int === int/double === double
Do this by reusing the implementation used for `==`
when both arguments are ints (IS_LONG) or both are floats (IS_DOUBLE)

```php
// Before: nestedloop_ni took 0.442 seconds
// After: nestedloop_ni takes 0.401 seconds (same as nestedloop_ne)
function nestedloop_ni(int $k) {
  $x = 0;
  for ($i=0; $i < 50000000; $i++) {
    if ($i === $k) {
      $x++;
    }
  }
  print "$x\n";
}
function nestedloop_ne(int $k) {
  $x = 0;
  for ($i=0; $i < 50000000; $i++) {
    if ($i == $k) {
        $x++;
    }
  }
  print "$x\n";
}
```
2019-11-15 17:37:01 +03:00
Dmitry Stogov
f6f32f2cf0 SAMRT BRANCH improvement.
Avoid need of insertion NOP opcoes between unrelated SMART BRANCH instruction and following JMPZ/JMPNZ.
Now instead of checking the opcode of following instruction, the same information is encoded into SMART BRANH result_type.
2019-10-09 13:48:39 +03:00
Dmitry Stogov
eec04f6b56 Encapsulate all SMART BRANCH related logic inside macros. Result of SMART BRANCH may be uninitialized (on exception). 2019-10-08 16:37:21 +03:00
Nikita Popov
a66c60cce3 Throw Error when writing property of non-object
This removes object auto-vivification support.

This also means that we can remove the corresponding special
handling for typed properites: We no longer need to check that a
property is convertible to stdClass if such a conversion might
take place indirectly due to a nested property write.

Additionally OBJ_W style operations now no longer modify the
object operand, and as such we no longer need to treat op1 as a
def in SSA form.

The next step would be to actually compile the whole LHS of OBJ_W
operations in R rather than W mode, but that causes issues with
SimpleXML, whose object handlers depend on the current compilation
structure.

Part of https://wiki.php.net/rfc/engine_warnings.
2019-09-27 10:11:47 +02:00
Dmitry Stogov
470bbb8c70 Avoid code dupliction 2019-09-26 01:40:30 +03:00
Dmitry Stogov
02c83b809a ceanup 2019-09-10 15:12:42 +03:00
Dmitry Stogov
0f8bb9e37d Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HOT attribute from some VM handlers. Comparisons almost always followed by JMPZ/JMPNZ; JMPZNZ is rare used.
  Remove --with-zlib-dir option from mysqlnd config
2019-09-05 11:43:13 +03:00
Dmitry Stogov
7237da27fe Remove HOT attribute from some VM handlers. Comparisons almost always followed by JMPZ/JMPNZ; JMPZNZ is rare used. 2019-09-05 11:40:15 +03:00
Dmitry Stogov
57d9b94dea Simplify TMP/VAR operand releasing 2019-07-24 14:13:40 +03:00
Nikita Popov
9e4603f772 Try to fix macos build
By avoiding unused variable opline warnings. Also clean up the
replacement of ZEND_VM_SPEC -- we were sometimes treating it as
an always-defined constant with a value (what it actually is) and
sometimes as a conditionally defined constant (which it isn't, but
which still worked thanks to the specializer). Switch to only
treating it as a constant with a value.
2019-07-24 09:44:55 +02:00
Dmitry Stogov
8d51af9bc2 Fixed CALL VM 2019-07-24 01:52:05 +03:00
Dmitry Stogov
b30e4a5aa6 Avoid extra specialization for cold opcodes 2019-07-17 14:03:48 +03:00
Dmitry Stogov
6fbab09ef0 Remove old hack 2019-07-17 12:05:23 +03:00
Dmitry Stogov
349a388b90 Slit INC/DEC opcodes into hot/cold parts and remove specialized versioins for LONG_OR_DOUBLE. 2019-07-16 17:39:25 +03:00
Dmitry Stogov
2e26b063b6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:54:22 +03:00
Dmitry Stogov
c570980175 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:52:11 +03:00
Dmitry Stogov
9ccf3fb996 Fixed incorrect specialization (missed IS_INDIRECT handling) 2019-07-16 01:50:10 +03:00
Dmitry Stogov
350f2212ff Allow GOTO style helpers in HYBRID VM 2019-07-12 00:00:55 +03:00
Dmitry Stogov
ef1a1a0698 Separate "cold" parts of comparison instructions 2019-07-11 20:44:39 +03:00
Dmitry Stogov
be94c0c3c6 Separate "cold" parts of binary op instructions 2019-07-11 18:23:08 +03:00
Dmitry Stogov
8f0c87e1b6 Avoid unintended inlining 2019-07-09 14:01:48 +03:00
Dmitry Stogov
e1f418dd18 Remove duplicated code for (PRE|POST)_DEC_(OBJ|STATIC_PROP) opcodes 2019-07-09 10:46:04 +03:00
Dmitry Stogov
1804fd634e Fixed dispatch from inlined hybrid opcode to another opcode 2019-07-08 18:01:46 +03:00
Dmitry Stogov
48ca5a1e17 Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP 2019-07-05 12:03:25 +03:00
Dmitry Stogov
925fd0fe6f Introduce and use ZEND_VM_INLINE_HANDLER() to avoid ZEND_RETURN exception 2019-07-04 15:54:45 +03:00
Dmitry Stogov
f2b6b2eee8 Micro-optimization 2019-07-01 16:57:25 +03:00
Joe Watkins
175c7bf6fe
Revert "micro-optimization"
This reverts commit 374f769982.
2019-06-12 20:04:47 +02:00
Dmitry Stogov
374f769982 micro-optimization 2019-06-10 16:43:20 +03:00
Dmitry Stogov
3f4dfe1877 Prevent generation of specialized ZEND_ASSIGN_OP_..._STATIC_PROP handlers, that call unspecialized helper, anyway. 2019-06-05 17:38:13 +03:00
Dmitry Stogov
fe0a0897ba Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Repare SWITCH VM
2019-04-09 01:17:10 +03:00
Dmitry Stogov
8e5a2096a9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Repare SWITCH VM
2019-04-09 01:11:02 +03:00
Dmitry Stogov
7b8212f4d1 Repare SWITCH VM 2019-04-09 00:41:11 +03:00
Benjamin Eberlei
d303225c3a Make regex replacements in zend_vm_gen.php more obvious
Change specializing preg_replace code in VM to be map of search to
replacement for easier understanding.
2019-02-25 17:44:26 +01:00
Dmitry Stogov
626bc3a2de More accurate handling of global registers (allow VM with single global register) 2019-02-12 17:39:02 +03:00
Nikita Popov
1a4ffcd2b4 Fix DIM_OBJ specialization in zend_vm_get_opcode_handler_func
DIM_OBJ also specializes over ASSIGN_STATIC_PROP nowadays.
2019-02-07 10:06:25 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Dmitry Stogov
6ccdb904ae Fixed ws 2018-12-21 19:03:28 +03:00
Dmitry Stogov
7155239669 Merge branch 'PHP-7.3'
* PHP-7.3:
  Removed /e modifirer and fixed ws.
2018-12-21 19:01:36 +03:00
Dmitry Stogov
95193c3872 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Removed /e modifirer and fixed ws.
2018-12-21 19:01:18 +03:00
Dmitry Stogov
8db63adb6d Removed /e modifirer and fixed ws. 2018-12-21 18:58:50 +03:00
Dmitry Stogov
ae9e956ef9 Reorder conditions 2018-12-18 23:23:44 +03:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Dmitry Stogov
a4b33f775e Added new line 2018-10-18 16:40:24 +03:00