Xinchen Hui
16a2b47394
Fixed bug #71300 (Segfault in zend_fetch_string_offset)
2016-01-07 07:05:17 -08:00
Xinchen Hui
563659822d
Merge branch 'PHP-7.0'
2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97
bump year which is missed in rev 49493a2
2016-01-02 17:56:11 +08:00
Derick Rethans
5362f0ad7f
MFH: Fix lineno for finally FAST_CALL and JMP
2015-12-31 09:46:43 +00:00
Nikita Popov
b3afeeabef
Fix lineno for finally FAST_CALL and JMP
2015-12-30 23:49:07 +01:00
Nikita Popov
65e456f364
Introduce BIND_LEXICAL
...
This opcodes inserts a local CV into the closure static variable
table. This replaces the previous mechanism of having static
variables marked as LEXICAL, which perform a symtable lookup
during copying.
This means a) functions which contain closures no longer have to
rebuild their symtable (better performance) and b) we can now track
used variables in SSA.
2015-12-29 23:14:53 +01:00
Nikita Popov
4440436821
Forbid use() of auto-globals
...
We don't correctly support it, it doesn't make sense and it's also
forbidden for parameters.
2015-12-29 11:20:44 +01:00
Julien Pauli
7a2f60d3c7
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Remove mentions of "type hint" and "typehint"
2015-12-24 15:19:54 +01:00
Levi Morrison
2a7eeff33e
Remove mentions of "type hint" and "typehint"
2015-12-24 15:19:31 +01:00
Dmitry Stogov
aa4a83fec7
Fixed bug #71196 (Memory leak with out-of-order live ranges)
2015-12-23 01:47:38 +03:00
Nikita Popov
88eae43ff9
Remove uses of VARs in extended_value
...
The DECLARE_(ANON_)INHERITED_CLASS(_DELAYED) opcodes were
referencing the parent ce VAR through extended_value. This is
hacky and we can't track the def-use chain in SSA.
To avoid this, the layout of declaration opcodes is changed
as follows: op1 points to the lcname and rtd_key literals, in
that order. (For anon/lambda declarations only one of lcname or
rtd_key is present.) This frees up op2, which is now used to
reference the parent ce VAR in inheriting declarations. The
jmp offset for anon class declarations is moved frop op2 to
extended_value.
The changes were applied both to class and function declarations
to keep everything symmetric.
2015-12-21 14:44:42 +01:00
Andrea Faulds
5d0dfda60c
Merge branch 'PHP-7.0'
2015-12-19 02:35:19 +00:00
Andrea Faulds
42c8f5e91d
Fix bug #70804
...
This follows on from a4648ded43
and
4e01269082
.
Both -(+0.0) and +(-0.0) behaved incorrectly for the same reason.
2015-12-19 02:25:44 +00:00
Andrea Faulds
8d355bff85
Merge branch 'PHP-7.0'
2015-12-17 22:40:55 +00:00
Andrea Faulds
a4648ded43
Fix bug #52355
2015-12-17 22:39:29 +00:00
Nikita Popov
56f1106162
Use FETCH_CLASS_EXCEPTION for instanceof
...
This does not collide with NO_AUTOLOAD -- missing classes will be
silenced, but invalid use of self etc will result in an exception
instead of a fatal error.
2015-12-14 17:50:20 +01:00
Nikita Popov
0919178963
Add result op for ASSERT_CHECK to fix SSA
...
Otherwise one source of the phi node at the join point will be
borked.
I'm marking the ASSERT_CHECK result as unused in pass2, which is
a bit ugly.
2015-12-14 12:31:00 +01:00
Xinchen Hui
0d8f5a43d3
Merge branch 'PHP-7.0'
...
Conflicts:
NEWS
2015-12-11 09:13:26 -08:00
Xinchen Hui
778e5f3da5
Fixed bug #71092 (Segmentation fault with return type hinting)
2015-12-11 09:11:28 -08:00
Nikita Popov
591fe26d5d
Remove BP_VAR_REF
...
The distinction between BP_VAR_REF and BP_VAR_W is no longer
revelant, since we dropped support for =& new.
2015-12-11 15:56:52 +01:00
Nikita Popov
04e3d82b55
Make duplicate class constant error for internal class
...
And drop two duplicate constant declarations from intl. These
were leaking previously.
2015-12-10 22:22:49 +01:00
Nikita Popov
8e5e3301a1
Make ZEND_CLONE return a TMP_VAR
...
As the return value can't be reference and it's unlikely to be
unused.
Also remove some unnecessary checks for ce==NULL. A ce is required
nowadays.
2015-12-10 22:16:25 +01:00
Nikita Popov
f1278edefc
Drop two compiler TODOs
...
Call-time pass by reference is now a parse error.
There is no benefit in dropping implementing_class currently.
2015-12-10 19:04:59 +01:00
Nikita Popov
c8a64e289c
Reintroduce use of FETCH_GLOBAL_LOCK
...
Just found this old AST todo...
It no longer makes sense as an optimization due to the introduction
of BIND_GLOBAL, however it ensures that the global variable name is
not evaluated twice, which is presumably something we wish to
guarantee.
2015-12-10 19:04:59 +01:00
Nikita Popov
3fa86105f7
Remove FETCH_STATIC_MEMBER flag
2015-12-10 18:25:29 +01:00
Nikita Popov
3d4a2d2002
Merge branch 'PHP-7.0'
...
Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
2015-12-10 18:24:29 +01:00
Nikita Popov
37f3425263
Fix Foo::${42} and similar
...
Fixes segfault on direct use, segfault on opcache evaluated use,
leak on temporary use.
Fixes analogeous segfault for ${42} on opcache eval as well.
2015-12-10 18:14:40 +01:00
Dmitry Stogov
5ee7b7d01a
Don't create live-range across NOPs and some other instructions
2015-12-09 05:15:58 +03:00
Dmitry Stogov
c1803bf652
Avoid construction of empty live-ranges because of OP_DATA instruction
2015-12-08 18:10:07 +03:00
Dmitry Stogov
a75c195000
Implemented the RFC Support Class Constant Visibility
.
...
Squashed commit of the following:
commit f11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Dec 8 12:38:42 2015 +0300
Fixed test expectation
commit 211f873f54
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Dec 8 12:28:38 2015 +0300
Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags
commit 51deab84b2
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Dec 7 11:18:55 2015 +0300
Fixed issues found by Nikita
commit 544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com>
Date: Sat Dec 5 02:41:05 2015 +0300
Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility
@reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
2015-12-08 12:40:42 +03:00
Xinchen Hui
5c707a6cf8
Merge branch 'PHP-7.0'
2015-11-28 23:44:06 -08:00
Xinchen Hui
1f65006fce
Fixed bug #70931 (Two errors messages are in conflict)
2015-11-28 23:43:41 -08:00
Nikita Popov
95283a0504
Merge branch 'PHP-7.0'
2015-11-26 16:57:11 +01:00
Nikita Popov
99dd7ee80b
Forbid namespace\int type hint as well
2015-11-26 16:56:08 +01:00
Xinchen Hui
06bcaf98c5
Merge branch 'PHP-7.0'
2015-11-25 19:11:40 +08:00
Xinchen Hui
3cdbe347ae
Always lower name
2015-11-25 19:11:22 +08:00
Xinchen Hui
05738eb71a
Revert "Improved fix for Fully qualified (leading backslash) type names must fail"
...
This reverts commit 00865ae22f
.
2015-11-25 19:06:42 +08:00
Xinchen Hui
c6b08e99fe
Merge branch 'PHP-7.0'
2015-11-25 11:41:01 +08:00
Xinchen Hui
00865ae22f
Improved fix for Fully qualified (leading backslash) type names must fail
...
it now all fails with COMPILE_ERROR instead of syntax error for T_ARRAY
but COMPILE_ERROR for int
2015-11-25 11:27:32 +08:00
Bob Weinand
569763cb1a
Fix scalar type names with leading backslash
2015-11-24 21:39:06 +01:00
Xinchen Hui
42252f409b
Merge branch 'PHP-7.0'
2015-11-23 18:33:21 +08:00
Xinchen Hui
51ccc88b87
Port fix to 7.0
2015-11-23 18:31:56 +08:00
Dmitry Stogov
84610b1f39
Don't keep wrong jump target in last CATCH.
2015-11-19 00:47:08 +03:00
Andrea Faulds
366ba41334
Add void return type
2015-11-18 17:30:49 +00:00
Xinchen Hui
36d25a287b
Merge branch 'PHP-7.0'
2015-11-13 21:25:06 +08:00
Xinchen Hui
25de928df7
Fixed bug #70912 (Null ptr dereference instantiating class with invalid array property)
2015-11-13 21:24:42 +08:00
Dmitry Stogov
3a5fa926bf
Squashed commit of the following:
...
commit afe963e6cc289696e60c6c679796ba2197c52b3b
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Nov 13 15:32:29 2015 +0300
Added news entry
commit a126b891c97848dd7ef8f1abf716328c46e0f19c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Nov 13 15:29:21 2015 +0300
VERIFY_RETURN_TYPE doesn't have to cleanup operand on exception, bacause now, live temporary variables are released by exception unwinder.
commit 0db475e98786e6bcaa8401ee3e0b33743b9a2f2b
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Nov 12 22:55:39 2015 +0300
Fixed copy/paste
commit 0ac73fe7174bec9de9a610319a98b259bea67f7f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Nov 11 16:11:50 2015 +0300
Fixed bug #62210 (Exceptions can leak temporary variables)
2015-11-13 15:35:07 +03:00
Dmitry Stogov
998204ef2d
Separate common part of compile_file() and compile_string() into zend_compile()
2015-11-12 16:59:44 +03:00
Dmitry Stogov
948b7f5421
Changed ZEND_FREE.op2.num and ZEND_FE_FREE.op2.num back to use live_range_offset (try_catch_offset does't work)
2015-11-11 11:12:44 +03:00
Dmitry Stogov
baf97b1fcc
We don't nees zend_op_array->brk_cont_array at run-time anymore.
...
Move zend_op_array->brk_cont_array into CG(context).brk_cont_array.
Use more compact zend_op_array->live_range instead of zend_op_array->brk_cont_array.
Semantic is kept unchanged.
2015-11-10 21:48:03 +03:00
Dmitry Stogov
71092b7c2b
Make FE_FETCH and following assignments to be a part of a loop.
2015-11-10 20:11:05 +03:00
Dmitry Stogov
86a96f2cf1
Changed meaning of "op2" for ZEND_FREE, ZEND_FE_FREE, ZEND_FAST_CALL, ZEND_FAST_RET.
...
Previously it was an instruction number.
Now it's an index in op_array->try_cacth_array[].
2015-11-10 19:13:54 +03:00
Andrea Faulds
7bc6361294
Merge branch 'PHP-7.0'
2015-11-09 23:42:12 +00:00
Andrea Faulds
dae37661d9
Use ZEND_STRL macro for builtin_types
2015-11-09 11:15:58 +00:00
Dmitry Stogov
b009f84ec0
Removed incorrect "return" statement
2015-10-28 21:26:52 +03:00
Dmitry Stogov
eb7be5379d
Speed up fetching of class entries for self:: parent:: and static::
...
This is generalized solution for Bob's idea of speed up self::method() calls without ZEND_FETCH_CLASS.
At first, it adds few new opcodes to separate class related behaviour:
FETCH_STATIC_PROP_R
FETCH_STATIC_PROP_W
FETCH_STATIC_PROP_RW
FETCH_STATIC_PROP_FUNC_ARG
FETCH_STATIC_PROP_UNSET
FETCH_STATIC_PROP_IS
UNSET_STATIC_PROP
ISSET_ISEMPTY_STATIC_PROP
FETCH_CLASS_CONSTANT
At seconds, it enables IS_UNUSED operand to fetch (self, parent or static without separate FETCH_CLASS) for new opcodes and the following ones:
INIT_STATIC_METHOD_CALL
NEW
END_INSTANCEOF
Finaly, opcache optimizer had to be fixed to support new opcodes.
2015-10-28 21:26:52 +03:00
Nikita Popov
36cd300693
Merge branch 'PHP-7.0'
2015-10-24 23:19:36 +02:00
Nikita Popov
b9cc3176eb
Fix bug #70782
2015-10-24 23:19:02 +02:00
Levi Morrison
43a4336820
Refactor zend_mark_function_as_generator
2015-10-19 06:57:21 -07:00
Márcio Almada
ddb6d7801e
Fix bug #70650
2015-10-07 16:25:59 +02:00
Dmitry Stogov
e0b3b3c752
Revert "Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())"
...
This reverts commit 517b553625
.
2015-10-06 23:59:36 +03:00
Dmitry Stogov
3c0348056a
Revert "Speed up self::method() calls (no ZEND_FETCH_CLASS)"
...
This reverts commit 8c33bdb976
.
2015-10-06 23:48:08 +03:00
Dmitry Stogov
5a49ac77aa
Revert "Speed up self::$property access by 20%"
...
This reverts commit 0fbd3e5fe7
.
2015-10-06 23:48:04 +03:00
Bob Weinand
0fbd3e5fe7
Speed up self::$property access by 20%
2015-10-05 21:52:09 +02:00
Bob Weinand
8c33bdb976
Speed up self::method() calls (no ZEND_FETCH_CLASS)
2015-10-05 21:16:52 +02:00
Bob Weinand
517b553625
Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
...
This additionally removes support for binding to an unknown (not in parent hierarchy) scope.
Removing support for cross-scope is necessary for certain compile-time assumptions (like class constants) to prevent unexpected results
2015-10-04 01:38:59 +02:00
Bob Weinand
6c61286da4
Do not include zend_verify_return_type in executable ops (phpdbg)
2015-10-02 12:37:39 +02:00
Xinchen Hui
45cb42f49f
Simply use 0/1 instead as dmitry suggested
2015-09-30 10:41:27 +08:00
Xinchen Hui
df2ff75116
Make ZEND_ECHO and removed ZEND_PRINT distinguishable
2015-09-29 21:50:15 +08:00
Anatol Belski
29bf529d88
fix warning
2015-09-24 16:33:53 +02:00
Joe Watkins
1a5d6acff6
ZEND_COMPILE_GUARDS compiler option
2015-09-23 15:33:57 +02:00
Xinchen Hui
4ddeeb49a5
Remove free_string_zval
2015-09-11 10:58:24 +08:00
Joe Watkins
784dd715e4
Fix mangled property names on anon classes
2015-08-18 16:37:38 +01:00
Bob Weinand
34834c58fa
Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1)
2015-08-18 15:01:24 +02:00
Xinchen Hui
121409865b
use efree_size here
2015-08-12 11:15:09 +08:00
Bob Weinand
dbd8edbbd0
Fixed bug #70241 (Skipped assertions affect Generator returns)
2015-08-11 22:12:06 +02:00
Steven Hilder
7ecb761818
Allow property names from anonymous classes to be unmangled
2015-08-06 15:18:14 +00:00
Dmitry Stogov
58596897e9
Get rid of ZEND_FAST_CALL_UNBOUND
2015-08-04 08:35:40 +03:00
Dmitry Stogov
a16aa4c42c
Move most "finally" related code-generation from pass_two() to compiler.
2015-08-04 07:42:28 +03:00
Nikita Popov
743801054d
Try to fix finally issue
2015-08-04 07:42:28 +03:00
Hugh Davenport
2a1a8f9ea7
Fixed bug #70183 null pointer deref (segfault) in zend_eval_const_expr
2015-08-02 16:51:23 +02:00
Bob Weinand
ac87657d42
Implicit return should be always on the last line of a function
2015-07-31 02:44:42 +02:00
Bob Weinand
d45d5271f7
Fix bug #70164 (__COMPILER_HALT_OFFSET__ under namespace is not defined)
2015-07-29 19:18:29 +02:00
Julien Pauli
a28115ccdb
Fix for #70159 - Better magic constants substitution
2015-07-28 16:30:08 +02:00
Bob Weinand
33a91f57e9
Set CG(zend_lineno) to beginning for final class errors/ops
2015-07-28 00:57:49 +02:00
Bob Weinand
7ca85d8875
Fully fix typed generator returns
2015-07-24 22:04:05 +02:00
Nikita Popov
cff6cbc01f
Emit EXT_STMT for each statement
...
I'm excluding unticked statements for this (in 5.x they were included)
as this would just result in two consecutive EXT_STMTs.
Also add all class statements to unticked statements, these would
generate superfluous EXT_STMT/TICKS in the parent op_array.
2015-07-22 13:38:42 +02:00
Bob Weinand
2141ab9be5
Fix bug #70106 (Inheritance by anonymous class)
2015-07-21 20:34:06 +02:00
Bob Weinand
81a2c43d5e
Add an option to not generate INIT_FCALL ops for user functions too
2015-07-21 16:39:49 +02:00
Nikita Popov
c568ffe517
Ignore getcwd return in zend_compile
...
To do this move the php_ignore_value macro to ZEND_IGNORE_VALUE.
2015-07-16 22:48:56 +02:00
Xinchen Hui
4064ee3061
Fixed bug #70240 (Segfault when doing unset($var());)
2015-08-11 21:42:11 +08:00
Xinchen Hui
87a5f2c486
Fixed no return statement in function returning non-void
2015-08-10 21:48:17 +08:00
Bob Weinand
1003d01f3a
Fix __METHOD__ in functions nested into methods
2015-07-14 02:37:35 +02:00
Xinchen Hui
e63c756c09
Better implementation
2015-07-11 18:59:09 +08:00
Bob Weinand
0584df0ad9
hmm, we do not need the nop after compilation, so does not matter for opcache...
2015-07-10 23:35:05 +02:00
Bob Weinand
56800e470b
a: try { ... } ≠ try { a: ... }
2015-07-10 23:29:07 +02:00
Dmitry Stogov
ef1b588f6a
Resolve GOTO at compile time and replace it with sequnce of FREE/FE_FREE and JMP.
2015-07-10 04:44:21 +03:00
Dmitry Stogov
44f7348caa
Exception thrown by "return" statement (from TMP destructors) shouldn't be caught in the same function
2015-07-10 04:13:34 +03:00
Dmitry Stogov
549e8c4959
Squashed commit of the following:
...
commit 03cf871f1576f08b2348c141b209894a7bf17a86
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:31 2015 +0300
Revert "Fixed bug #62210 (Exceptions can leak temporary variables. As a part of the fix serious refactoring was done. op_array->brk_cont_array was removed, and replaced with more general and speed efficient op_array->T_liveliness. ZEND_GOTO opcode is always replaced by ZEND_JMP at compile time). (Bob, Dmitry, Laruence)"
This reverts commit 5ee8413259
.
commit 285a68227ce3d380e821a24fa389aa5239bd3fe1
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:26 2015 +0300
Revert "Tuned off dubugging of live ranges"
This reverts commit 404dc93d35
.
commit 93d9d11157301ee2ec99afb6f5744b126d17f637
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:17 2015 +0300
Revert "Remove loop_var_stack"
This reverts commit b3a4c05071
.
commit ede68ebbc284aec79e3f719f2c8dbf9da6907752
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:12 2015 +0300
Revert "ZEND_SEPARATE reuses temporaries"
This reverts commit 1852f538b9
.
commit 96d8995dc1f517fb01b481736273767509f76c47
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:10 2015 +0300
Revert "Add assertion in liveliness computation"
This reverts commit ed14019e8c
.
commit 0649d7bfef152e6cc8e67b922534e9946c634d9c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:07 2015 +0300
Revert "Fixed invalid live-range detection"
This reverts commit 54f367ee2a
.
commit dfe8f3851f6b04595eb089323e3492115a59363e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:04 2015 +0300
Revert "Add test guaranteeing that loop vars are only freed after potential return type exceptions"
This reverts commit f5db5a558d
.
commit 52a94aad6f48a199358cc07f7e4f56bb73050504
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:45:01 2015 +0300
Revert "Fixed exception habdling on "return" statement."
This reverts commit 17c5315bdf
.
commit 6e90ad7331901711e89c2ceb2bcab5023e5cee60
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:44:58 2015 +0300
Revert "Fix too early terminated temporary range with break/cont/goto"
This reverts commit cc876c04b4
.
commit 7b766e44b1970e4031f75109c302c07ead2c05cb
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 10 02:44:55 2015 +0300
Revert "Fixed exception catching on break/continue"
This reverts commit 8c3f701eeb
.
2015-07-10 03:31:52 +03:00
Nikita Popov
a49ce7bb91
Don't return T_ERROR from token_get_all()
...
This turned out to be rather inconvenient after all. Instead just
return the same output we did on PHP 5. If people want to have an
error, use TOKEN_PARSE.
2015-07-09 23:02:21 +02:00