Commit Graph

1311 Commits

Author SHA1 Message Date
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Dmitry Stogov
ff363e2e7c Implemented RFC: Replace "Missing argument" warning with "Too few arguments" exception
Squashed commit of the following:

commit 8b45fa2acb
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 01:52:50 2016 +0300

    Separate slow path of ZEND_RECV into a cold function.

commit 9e18895ee5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 23:26:28 2016 +0300

    Required argument can't be IS_UNDEF anymore.

commit 662db66e39
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 17:14:50 2016 +0300

    Replace "Missing argument" warning by "Too few arguments" exception.
2016-06-16 02:32:02 +03:00
Dmitry Stogov
a9512af810 Implemented RFC: Fix inconsistent behavior of $this variable
Squashed commit of the following:

commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 00:19:42 2016 +0300

    Fixed GOTO VM

commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 21:01:57 2016 +0300

    Removed unused variable

commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 19:06:16 2016 +0300

    Protection from $this reassign through mb_parse_str()

commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:14:50 2016 +0300

    Added type inference rule for FETCH_THIS opcode

commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:11:18 2016 +0300

    Restored PHP-7 behavior of isset($this->foo).
    It throws exception if not in object context.
    Removed useless opcode handlers.

commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 12:25:47 2016 +0300

    Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".

commit e32cc528c0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:02:43 2016 +0300

    Throw exception on attempt to re-assign $this through extract() and parse_str().

commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 22:18:36 2016 +0300

    Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Dmitry Stogov
e7e79aa409 Delay IS_ERROR checks 2016-06-09 12:39:38 +03:00
Nikita Popov
766ad0d970 Followup for bug
Assign-ops and nested accesses now get the same treatment.
2016-06-08 15:43:58 +02:00
Dmitry Stogov
b111da96d9 Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags. 2016-05-31 04:06:00 +03:00
Nikita Popov
91f5940329 Forbid dynamic calls to scope introspection functions
Per RFC:
https://wiki.php.net/rfc/forbid_dynamic_scope_introspection
2016-05-24 20:48:24 +02:00
Dmitry Stogov
c466df6813 Inlined fast paths of the freqently execute handlers for FETCH_DIM_R. 2016-05-17 15:08:04 +03:00
Dmitry Stogov
ccf18da450 Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
2016-05-13 01:40:15 +03:00
Dmitry Stogov
7b94b958cc Intern some known (and offten used) strings. 2016-05-12 13:47:22 +03:00
Dmitry Stogov
8a7a913a7a Use main VM stack for generators. Only single call frame for generator itself is allocated on heap, call frames for nested functions are allocated on main VM stack. In case "yield" used in context of another function call, call stack has to be frozen and then restored. 2016-05-12 00:44:18 +03:00
Dmitry Stogov
cca2c8ecc4 Reimplemented Bob's commit bac6fdb0c5 without insignificant renaming and white-space changes 2016-05-06 10:47:58 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Dmitry Stogov
b91197c8a3 Inlined fast path 2016-05-04 17:33:35 +03:00
Joe Watkins
c38310f25a change fcall and statement handlers to accept frame 2016-05-04 09:28:13 +01:00
Bob Weinand
f59de7ea36 Export zend_pass_function to allow comparisons against it 2016-04-30 20:46:52 +02:00
Dmitry Stogov
3e9419dd28 Fixed compilation warnings 2016-04-29 14:03:33 +03:00
Dmitry Stogov
747a482b9c Don't initialize EX(call)->symbol_table on each function call.
Keep it uninitialized, and check ZEND_CALL_HAS_SYMBOL_TABLE flag when necessary.
2016-04-28 15:17:24 +03:00
Dmitry Stogov
6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Dmitry Stogov
c026ca6cdc Merge branch 'master' into safe_timeout
* master:
  Fixed bug  - Reference the bug id directly in NEWS
  Fix magic constants (__LINE__) with ?? for constant scalar exprs
  Add NEWS entry for ?? in constant scalar expressions
  allow null coalescing (??) on constant expressions
  Fix intl tests for ICU < 52
  Fix ZTS builds by adding a missing TSRMLS_FETCH().
  Fix bug 
  Update NEWS
  Fix RECV opcode to handle all kinds of exceptions
  Fix RECV opcode to handle all kinds of exceptions
2016-04-21 10:15:57 +03:00
Bob Weinand
36202ef056 Merge remote-tracking branch 'origin/PHP-7.0' 2016-04-21 01:26:48 +02:00
Márcio Almada
9f3eab44df allow null coalescing (??) on constant expressions 2016-04-21 01:22:28 +02:00
Dmitry Stogov
650c1c0a7d Safe execution timeout handling. 2016-04-20 13:52:21 +03:00
Dmitry Stogov
f484801483 Reduced amount of code generated for interrupt handling.
Improved ZEND_VM_INTERRUPT_CHECK() placement (always perform checks after opcode handler completion, when instruction pointer value is alredy changed to the next opcode).
2016-04-20 11:06:52 +03:00
Nikita Popov
64f91774f2 Remove IS_VAR_RET_REF flag
Instead decide whether a function returned by reference or by value
by checking whether the return value has REFERENCE type. This means
that functions returning by reference must always return a reference
and functions returning by value must not return a reference.
2016-04-15 15:32:20 +02:00
Dmitry Stogov
562d6315b1 Optimize zend_binary_assign_op_dim_helper() 2016-04-14 02:35:53 +03:00
Dmitry Stogov
e95efb6312 Move rare cases of DO_FCALL into separate helpers. 2016-04-13 20:13:17 +03:00
Dmitry Stogov
85f35a8fc1 Separate unspecializeble code of INCLIDE_OR_EVAL into helper functions 2016-04-13 15:29:01 +03:00
Dmitry Stogov
a809444b64 Delay IS_UNDEF check for FETCH_DIM_W and family 2016-04-13 01:19:20 +03:00
Dmitry Stogov
0b3e2fe2b1 Delay IS_UNDEF check for FETCH_DIM_R and family 2016-04-13 00:05:19 +03:00
Dmitry Stogov
23b65bf732 Reuse zend_fetch_dimension_address_read() for FETCH_LIST 2016-04-12 22:53:01 +03:00
Dmitry Stogov
eaf489ac2b Optimize ASSIGN_DIM (separate common unspecializeble code into helper functions). 2016-04-12 19:36:24 +03:00
Dmitry Stogov
ef0099918f Separate unspecializeble code of INIT_DYNAMIC_CALL into separate helper functions. 2016-04-12 14:41:06 +03:00
Dmitry Stogov
a186ac0e47 IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-04-05 20:09:14 +03:00
Dmitry Stogov
d0c6c179cd Initialize op_array->run_time_cache on slow path of INIT_FCALL opcode and omit corresponding check on fast path of DO_FCALL. 2016-04-05 00:01:00 +03:00
Dmitry Stogov
7abfaac901 Merge zend_execute_data->called_scope into zend_execute_data->This.
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this.
Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL).
Some code might need to be adopted to support this change.
Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
2016-04-01 16:17:49 +03:00
Dmitry Stogov
86a1aeed22 Flags ZEND_CALL_RELEASE_THIS and ZEND_CALL_CLOSURE should never be set together.
Closures keep responsibility for releasing $this theirselves.
2016-03-31 18:58:13 +03:00
Nikita Popov
80a722a634 Drop some dead defines 2016-03-20 01:35:51 +01:00
Dmitry Stogov
fc7cbdce61 Squashed commit of the following:
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:56:04 2016 +0300

    Fixed wrong constant usage

commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:10:23 2016 +0300

    Added ability to serialize and serialize opcode handlers for file-cache

commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:11:59 2016 +0300

    Added missed file

commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:00:45 2016 +0300

    Transparently introduce type-specialized opcode handlers.
    This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui
73e8c08788 Sorry for that... Merged by accident....
Revert "Transparently introduce type-specialized opcode handlers."

This reverts commit 59d00b8bcc.
2016-03-17 11:59:15 +08:00
Dmitry Stogov
59d00b8bcc Transparently introduce type-specialized opcode handlers.
This affects only PHP VM, and doesn't change anything else.
2016-03-16 03:36:58 +03:00
Dmitry Stogov
827a7a180b Added possibility for extra specialization for SMART_BRANCH (e.g. IS_EQUAL+JMPZ superinstruction). 2016-03-11 12:17:03 +03:00
Dmitry Stogov
ff8337b783 Merge branch 'PHP-7.0'
* PHP-7.0:
  More effecient fix for bug 
2016-03-10 13:34:00 +03:00
Dmitry Stogov
f8506c062f More effecient fix for bug 2016-03-10 13:33:36 +03:00
Xinchen Hui
a468901e97 Merge branch 'PHP-7.0'
* PHP-7.0:
  Improve the codes (FETCH_DIM_R/IS is read context, we should not expose IS_REFERENCE)
2016-03-10 15:10:26 +08:00
Xinchen Hui
675c295722 Improve the codes (FETCH_DIM_R/IS is read context, we should not expose IS_REFERENCE) 2016-03-10 15:09:51 +08:00
Xinchen Hui
4c388004d4 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug  (Regression in PHP7.0: trivial script segfaults php-cgi)
  Bug  (Call-by-reference widens scope to uninvolved functions when used in switch)
  tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug )
2016-03-10 15:03:25 +08:00
Xinchen Hui
9833c76d3f Bug (Call-by-reference widens scope to uninvolved functions when used in switch) 2016-03-10 14:58:10 +08:00
Francois Laupretre
370b7039e4 Add support for negative string offsets (syntax) 2016-03-09 14:41:37 +01:00