Commit Graph

906 Commits

Author SHA1 Message Date
Dmitry Stogov
97912023bb Merge branch 'PHP-7.4'
* PHP-7.4:
  Use run-time cache to avoid repeatable hash lookups in ZEND_DECLARE_CLASS_DELAYED
2019-07-19 11:46:35 +03:00
Dmitry Stogov
445d51347d Use run-time cache to avoid repeatable hash lookups in ZEND_DECLARE_CLASS_DELAYED 2019-07-19 11:46:03 +03:00
Nikita Popov
eb766751dc Merge branch 'PHP-7.4' 2019-07-19 10:06:30 +02:00
rjhdby
d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Dmitry Stogov
1b5b8175af Merge branch 'PHP-7.4'
* PHP-7.4:
  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:16:30 +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
6188a69b8a Merge branch 'PHP-7.4'
* PHP-7.4:
  Optimization of INC/DEC helpers
2019-07-03 10:50:14 +03:00
Dmitry Stogov
56b8b165f8 Optimization of INC/DEC helpers 2019-07-03 10:33:03 +03:00
Nikita Popov
aa2320b274 Merge branch 'PHP-7.4' 2019-06-28 16:39:57 +02:00
Nikita Popov
3698303540 Fix arginfo leak in disable_functions
Arginfo is allocated if types are used, we need to free it.
2019-06-28 16:38:46 +02:00
Dmitry Stogov
ca22c456ca Merge branch 'PHP-7.4'
* PHP-7.4:
  Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time
2019-06-25 11:32:03 +03:00
Dmitry Stogov
759f4ecd8b Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time 2019-06-25 11:30:58 +03:00
Nikita Popov
38909b7526 Merge branch 'PHP-7.4' 2019-06-21 10:25:17 +02:00
Nikita Popov
a84771573d Make ZEND_SEND_* flags unsigned
These may be shifted to the limit for the arg mask.
2019-06-21 10:24:34 +02:00
Nikita Popov
3645292235 Merge branch 'PHP-7.4' 2019-06-19 15:09:39 +02:00
Nikita Popov
3d4298697b Fix shift UB in constants
We were shifting out the top bit of a signed integer.
2019-06-19 15:09:00 +02:00
twosee
61f78de486 Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
2019-06-12 16:49:32 +02:00
Nikita Popov
e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +02:00
Nikita Popov
8f8fcbbd39 Support full variance if autoloading is used
Keep track of delayed variance obligations and check them after
linking a class is otherwise finished. Obligations may either be
unresolved method compatibility (because the necessecary classes
aren't available yet) or open parent/interface dependencies. The
latter occur because we allow the use of not fully linked classes
as parents/interfaces now.

An important aspect of the implementation is we do not require
classes involved in variance checks to be fully linked in order for
the class to be fully linked. Because the involved types do have to
exist in the class table (as partially linked classes) and we do
check these for correct variance, we have the guarantee that either
those classes will successfully link lateron or generate an error,
but there is no way to actually use them until that point and as
such no possibility of violating the variance contract. This is
important because it ensures that a class declaration always either
errors or will produce an immediately usable class afterwards --
there are no cases where the finalization of the class declaration
has to be delayed until a later time, as earlier variants of this
patch did.

Because variance checks deal with classes in various stages of
linking, we need to use a special instanceof implementation that
supports this, and also introduce finer-grained flags that tell us
which parts have been linked already and which haven't.

Class autoloading for variance checks is delayed into a separate
stage after the class is otherwise linked and before delayed
variance obligations are processed. This separation is needed to
handle cases like A extends B extends C, where B is the autoload
root, but C is required to check variance. This could end up
loading C while the class structure of B is in an inconsistent
state.
2019-06-11 13:09:33 +02:00
Nikita Popov
89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Dmitry Stogov
b4a3b49eab Merge branch 'PHP-7.4'
* PHP-7.4:
  Better hot/cold code splitting
2019-05-31 12:22:08 +03:00
Dmitry Stogov
1df9f238fe Better hot/cold code splitting 2019-05-31 12:20:21 +03:00
Nikita Popov
c3ee12e786 Merge branch 'PHP-7.4' 2019-05-23 10:41:27 +02:00
Nikita Popov
64918c7702 Forbid use of not fully linked classes 2019-05-23 10:41:10 +02:00
Joe Watkins
3518c4dfe9
Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "Rename *.l files to *.re"
2019-05-20 06:07:03 +02:00
Joe Watkins
e11233dc49
Revert "Rename *.l files to *.re"
This reverts commit 969047749d.
2019-05-20 06:06:38 +02:00
Peter Kokot
0a7d71b593 Merge branch 'PHP-7.4'
* PHP-7.4:
  Rename *.l files to *.re
2019-05-17 23:54:12 +02:00
Peter Kokot
969047749d Rename *.l files to *.re
This syncs PHP lexer files to all use *.re extension. The *.re files are
processed with the RE2C tool.
2019-05-17 23:53:03 +02:00
Bob Weinand
cbc90b1f6e Merge branch 'deprecate_concat_add_sub' into PHP-8.4 2019-05-16 18:31:28 +02:00
Dmitry Stogov
139da4b271 Merge branch 'PHP-7.4'
* PHP-7.4:
  Removed ability to compile PHP without EX(run_time_cache). ZEND_EX_USE_RUN_TIME_CACHE was always defined.
2019-05-15 11:07:51 +03:00
Dmitry Stogov
f9e8015847 Removed ability to compile PHP without EX(run_time_cache). ZEND_EX_USE_RUN_TIME_CACHE was always defined. 2019-05-15 11:06:26 +03:00
Nikita Popov
3619cc78a8 Merge branch 'PHP-7.4' 2019-05-07 14:07:30 +02:00
Nikita Popov
09ea55cb4e Deprecate left-associative ternary
Deprecate nesting ternary operators without explicit parentheses.

RFC: https://wiki.php.net/rfc/ternary_associativity
2019-05-07 14:06:29 +02:00
Nikita Popov
79f41944ba Merge branch 'PHP-7.4' 2019-05-02 15:07:04 +02:00
Nikita Popov
f3e5bbe6f3 Implement arrow functions
Per RFC: https://wiki.php.net/rfc/arrow_functions_v2

Co-authored-by: Levi Morrison <levim@php.net>
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2019-05-02 15:04:03 +02:00
Dmitry Stogov
3d2a6d9bed Merge branch 'PHP-7.4'
* PHP-7.4:
  Also, use ZEND_ACC_PRELOADED for classes
2019-04-30 02:22:58 +03:00
Dmitry Stogov
8cdd215894 Also, use ZEND_ACC_PRELOADED for classes 2019-04-30 02:07:02 +03:00
Nikita Popov
e311f2a320 Fix flag value clash affecting defined() function 2019-04-22 12:01:04 +02:00
Dmitry Stogov
55cc280429 Backported call frame initialization improvement 2019-04-12 02:35:42 +03:00
Dmitry Stogov
39505764ad Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace "ZEND_CALL_CTOR" hack by additional live-range
2019-04-12 01:01:47 +03:00
Dmitry Stogov
88a2268d6b Replace "ZEND_CALL_CTOR" hack by additional live-range 2019-04-12 00:49:45 +03:00
Dmitry Stogov
77c522062a Removed old constants (they are redeclared as macros) 2019-04-11 03:06:51 +03:00
Dmitry Stogov
cc900edd77 Simplify call frame initialization 2019-04-11 02:08:32 +03:00
Bob Weinand
3b23694aac Deprecate unparenthesized concatenation and addition/subtraction
Implementing RFC https://wiki.php.net/rfc/concatenation_precedence
2019-03-28 23:54:38 +01:00
Nikita Popov
0720313bd4 Merge branch 'PHP-7.4' 2019-03-28 09:31:18 +01:00
Nikita Popov
7f72d771e8 Revert "Switch to bison location tracking"
This reverts commit e528762c1c.

Dmitry reports that this has a non-trivial impact on parsing
overhead, especially on 32-bit systems. As we don't have a strong
need for this change right now, I'm reverting it.

See also comments on
e528762c1c.
2019-03-28 09:29:08 +01:00
Ivan Enderlin
ece7fe60f5 Fix typos in the documentation 2019-03-26 15:00:32 +01:00
Nikita Popov
6b7545c225 Merge branch 'PHP-7.4' 2019-03-21 16:28:19 +01:00
Nikita Popov
e528762c1c Switch to bison location tracking
Locations for AST nodes are now tracked with the help of bison
location tracking. This is more accurate than what we currently do
and easier to extend with more information.

A zend_ast_loc structure is introduced, which is used for the location
stack. Currently it only holds the start lineno, but can be extended
to also hold end lineno and offset/column information in the future.

All AST constructors now accept a zend_ast_loc* as first argument, and
will use it to determine their lineno. Previously this used either the
CG(zend_lineno), or the smallest AST lineno of child nodes.

On the parser side, the location structure for a whole rule can be
obtained using the &@$ character salad.
2019-03-21 16:27:48 +01:00
Stanislav Malyshev
db777e9199 Fix shifting signed values too far
Signed shift of 31 for int and 63 for long is flagged as undefined
behavior by UBSan (-fsanitize=undefined) and seems to be indeed so
according to the standard.

The patch converts such cases to use unsigned.
2019-03-06 00:50:09 -08:00