Dmitry Stogov
bd908f6145
Fixed build without global register variables
2018-02-22 11:00:29 +03:00
Dmitry Stogov
927748b271
Reorganize make_real_object() related code
2018-02-21 18:43:38 +03:00
Dmitry Stogov
ecb52b8b3b
Move exceprional code into helper & zend_fetch_var_address_helper() micro-optimization.
2018-02-21 17:09:42 +03:00
Dmitry Stogov
7559b1c50c
Move result address calculation from specialized handlers to less specialized helpers
2018-02-21 16:06:29 +03:00
Dmitry Stogov
9c0427cada
Mark exceptional helpers as "cold"
2018-02-21 12:07:29 +03:00
Dmitry Stogov
e1b1cff48d
Move exceptional code into helpers
2018-02-21 10:10:04 +03:00
Dmitry Stogov
a00286921e
Move cold code, duplicated by specializer, into helper functions
2018-02-20 23:44:25 +03:00
Dmitry Stogov
b46f10b43f
Fixed build without global register variables
2018-02-20 20:39:02 +03:00
Dmitry Stogov
8b7cdbaa49
Separate slow path with make_real_object() and related code into "cold" function.
2018-02-20 17:22:11 +03:00
Dmitry Stogov
cbf2d91911
Separate cold paths of ISSET_ISEMPTY_DIM_OBJ
2018-02-20 14:42:53 +03:00
Dmitry Stogov
a3afad5af0
Added tracer to collect frequency of opcode handler call chains
2018-02-19 16:50:24 +03:00
Nikita Popov
b0af9ac733
Avoid live range references in opcodes
...
Don't store the live range of the freed variable for FREE_ON_RETURN
frees, instead look it up at runtime. As this is an extremely
unlikely codepath (in particular, it requires a loop variable with
a throwing destructor), saving the runtime lookup of the live range
is not worth the extra complexity this adds everywhere else.
2018-02-16 21:30:48 +01:00
Dmitry Stogov
6fadb72c0b
Move exceptional code into "cold" helpers
2018-02-16 02:45:31 +03:00
Dmitry Stogov
02aea893fb
Use Z_TYPE_INFO_REFCOUNTED() macro
2018-02-15 21:54:49 +03:00
Dmitry Stogov
ca035f26aa
Moved "zval.u2.cache_slot" into free room of "zend_op"
2018-02-05 19:41:47 +03:00
Dmitry Stogov
3a794d39f0
Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement).
2018-02-05 19:40:06 +03:00
Dmitry Stogov
9a6100f9dd
Break dependency between IS_TYPE_REFCOUNTED and ZEND_CALL_FREE_EXTRA_ARGS
2018-02-02 17:38:07 +03:00
Dmitry Stogov
1d7eab12e6
Avoid redundand mask extraction
2018-01-31 13:34:34 +03:00
Dmitry Stogov
7141631cc8
Change FETCH/ISSET instruction modifiers:
...
- Get rid of ZEND_ISEMPTY and ZEND_ISSET_ISEMPTY_MASK. Use just single ZEND_ISSET bit to make distinct between isset() and empty()
- Use ZEND_FETCH_GLOBAL, ZEND_FETCH_LOCAL and ZEND_FETCH_GLOBAL_LOCK as bitmask
- Removed unused ZEND_FETCH_STANDARD
- Extended ZEND_FETCH_ARG_MASK
2018-01-30 22:06:05 +03:00
Dmitry Stogov
1613b6a06b
Expand SEPARATE_STRING()
2018-01-18 02:30:07 +03:00
Dmitry Stogov
25a44cb99e
Eliminate duplication, increment_string() performs it anyway.
2018-01-17 20:09:28 +03:00
Dmitry Stogov
12c386f5b9
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573af
, now it should be OK).
2018-01-11 22:15:45 +03:00
Dmitry Stogov
6ba10a03e7
Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
...
This reverts commit 781e1573af
.
2018-01-11 17:27:26 +03:00
Dmitry Stogov
781e1573af
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse.
2018-01-11 16:25:28 +03:00
Gabriel Caruso
6400264856
Trailing whitespaces
...
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514
year++
2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49
year++
2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7
year++
2018-01-02 12:53:31 +08:00
Dmitry Stogov
6e4d18924b
Combine READY_TO_DESTROY, EXTRACT_ZVAL_PTR and FREE_OP_VAR_PTR into single, better optimized, macro.
2017-12-26 16:50:34 +03:00
Dmitry Stogov
35b3fdfd0a
Separate exceptional code into cold functions.
2017-12-22 16:35:52 +03:00
Dmitry Stogov
3aceab825a
Manual loop optimizaton.
...
Cost of the loops body is still the same, but the loop headers are improved.
2017-12-14 03:39:22 +03:00
Dmitry Stogov
4d19bc2279
Disable some "bad" GCC optimizations
2017-12-14 03:25:20 +03:00
David Walker
6d4de4cf05
Implement list() reference assignments
...
Support list() reference assignments of the form:
list(&$a, list(&$b, $c)) = $d;
RFC: https://wiki.php.net/rfc/list_reference_assignment
2017-12-09 13:39:52 +01:00
Dmitry Stogov
6a9d2b2190
Cleanup type conversion
2017-12-07 19:24:55 +03:00
Dmitry Stogov
d1d1aff4e5
Optimization of init_func_execute_data()
2017-12-06 02:53:30 +03:00
Nikita Popov
828d8e635b
Fix ZEND_VM_SPEC=0 build
2017-11-24 23:06:01 +01:00
Nikita Popov
6b258197e8
Fix zend_fetch_dimension_const()
...
Pass IS_TMP_VAR instead of IS_CONST as operand type, as IS_CONST
requires additional guarantees that are not necessarily
satisfied by the caller.
2017-11-24 21:24:13 +01:00
Dmitry Stogov
ec2dde0c0b
Introduced zend_hash_find_ex() that may avoid unnecessary hash value check.
2017-11-24 14:01:19 +03:00
Dmitry Stogov
6780c74619
Allowed modification of VM stack page size. Exported few functions. Green light for Fibers/Coroutines.
2017-11-22 15:36:09 +03:00
Nikita Popov
26f8fc833b
Enable and fix printf() format warnings
...
Add _unchecked() variants of zend_spprintf and zend_strpprintf for
cases where we specifically want to disable these checks, such as
use of %H.
2017-11-16 21:15:36 +01:00
Dmitry Stogov
ccc12b82da
Avoid unnecessary reference-counting on strings.
2017-11-16 17:09:32 +03:00
Dmitry Stogov
ce18738a30
Removed "_" from API functions.
2017-11-16 17:09:01 +03:00
Dmitry Stogov
49ea143bbd
Encapsulate reference-counting primitives.
...
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
aeca761856
Removed useless reallocations
2017-10-26 19:13:53 +03:00
Dmitry Stogov
6a034be2c6
Fixed signed/unsigned comparisons
2017-10-25 11:45:17 +03:00
Dmitry Stogov
59a7944bc6
Made run_time_cache to keep "offset" to dynamic properties Buckets (instead of index).
2017-10-24 10:28:19 +03:00
Dmitry Stogov
ef5ea48741
Always use IS_CONSTANT_AST (IS_CONSTANT is removed).
2017-10-10 10:11:05 +03:00
Dmitry Stogov
fcccb0d6ea
Use zval_ptr_dtor_nogc() in places where circular zvals are not possible
2017-10-09 12:24:11 +03:00
Dmitry Stogov
e70618aff6
Changed the way VM accesses constant operands in 64-bit builds.
2017-10-04 16:53:01 +03:00
Dmitry Stogov
44e0b79ac6
Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values.
2017-09-20 02:25:56 +03:00
Dmitry Stogov
0fb05f1487
Property access micro-optimization. (ZEND_WRONG_PROPERTY_OFFSET and ZEND_DYNAMIC_PROPERTY_OFFSET are hidden, use one comparison instead of two on fast paths. "Negative" offsets are reserved for future optimizations).
2017-09-18 13:13:24 +03:00
Dmitry Stogov
28fdc1f1c3
Merge branch 'PHP-7.2'
...
* PHP-7.2:
Fixed possible incorrect result of type verification.
2017-08-15 14:47:17 +03:00
Dmitry Stogov
b096eacdd1
Fixed possible incorrect result of type verification.
2017-08-15 14:46:18 +03:00
Xinchen Hui
9b87b73fec
Req #74963 (Improved error message on fetching property of non-object)
2017-07-31 11:51:23 +08:00
Xinchen Hui
f12d1e2819
Merge branch 'req74963' of https://github.com/laruence/php-src
...
* 'req74963' of https://github.com/laruence/php-src :
Req #74963 (Improved error message on fetching property of non-object)
2017-07-31 11:45:19 +08:00
Xinchen Hui
dbd729e86b
Req #74963 (Improved error message on fetching property of non-object)
2017-07-31 11:43:14 +08:00
Anatol Belski
49d9b3013f
Move cwd_state and path related routines to size_t
...
Having `int` there is no real profit in the size or speed, while unsigned
improves security and overall integration. ZPP supplied strings can
be then accepted directly and structs can be still handled with smaller
unsigned types for size reasons, which is safe. Yet some related places
are to go.
basic move tsrm_realpath_r to size_t
fix conditions and sync with affected places
touch ocurrences of php_sys_readlink usage
follow up on phar path handling
remove duplicated check
move zend_resolve_path and related pieces to size_t
touch yet resolve path related places
remove cast
missing pieces
missing piece
yet cleanups for php_sys_readlink for ssize_t
fix wrong return
2017-07-27 20:11:21 +02:00
Anatol Belski
bc5811f361
further sync for vim mode lines
2017-07-04 18:12:45 +02:00
Dmitry Stogov
bbb786c85b
Split zend_init_execute_data() into zend_init_func_execute_data() and zend_init_code_execute_data()
2017-06-29 10:10:57 +03:00
Nikita Popov
4465b37105
Fix zend_get_zval_ptr()
2017-06-28 10:21:32 +02:00
Michał Brzuchalski
8e10c9d373
Implement object type annotation
...
RFC: https://wiki.php.net/rfc/object-typehint
2017-06-25 21:49:41 +02:00
Nikita Popov
957c24d5ee
Merge branch 'PHP-7.1'
2017-06-25 19:49:25 +02:00
Nikita Popov
653b96347c
Merge branch 'PHP-7.0' into PHP-7.1
2017-06-25 19:49:11 +02:00
Nikita Popov
2fddc4a7f1
Fixed bug #73900
2017-06-25 19:48:17 +02:00
Dmitry Stogov
bfa154448d
VM refactoring, to avoid passing "execute_data" into helper functions that can access it using global register variable.
2017-06-16 01:42:49 +03:00
Dmitry Stogov
8bb29704ea
Refactored API for constant array element propagation
2017-06-15 22:50:04 +03:00
Dmitry Stogov
c8f073d0d7
Avoid useless checks
2017-05-10 13:27:37 +03:00
Nikita Popov
0c3bc43207
Remove leftover code for generator stack page handling
2017-04-15 12:11:30 +02:00
Nikita Popov
3895aa2f77
Merge branch 'PHP-7.1'
2017-04-09 15:51:38 +02:00
Anatol Belski
c698299550
Interned strings unification for TS/NTS
...
Hereby, interned strings are supported in thread safe PHP. The patch
implements two types of interned strings
- interning per process, strings are not freed till process end
- interning per request, strings are freed at request end
There is no runtime interning.
With Opcache, all the permanent iterned strings are copied into SHM on
startup, additional copying into SHM might happen on demand.
2017-03-04 10:39:13 +01:00
Dmitry Stogov
3d84aef55d
Separate zend_fetch_static_property_address() into an inline function
2017-01-17 11:11:12 +03:00
Dmitry Stogov
501ff45283
Fixed nullable handling (phpunit failure)
2017-01-13 19:51:12 +03:00
Dmitry Stogov
1a8ad8ac27
Avoid NULL dereference
2017-01-13 12:51:23 +03:00
Dmitry Stogov
141d1ba980
Introduced "zend_type" - an abstraction for type-hinting representation.
2017-01-13 11:37:46 +03:00
Sammy Kaye Powers
dac6c639bb
Update copyright headers to 2017
2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9
Update copyright headers to 2017
2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce
Update copyright headers to 2017
2017-01-02 09:30:12 -06:00
Dmitry Stogov
088dd88eeb
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Fixed bug #73792 (invalid foreach loop hangs script)
Fixed bug #73789 (Strange behavior of class constants in switch/case block)
2016-12-20 16:54:28 +03:00
Dmitry Stogov
43cc3d7d92
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Fixed bug #73792 (invalid foreach loop hangs script)
2016-12-20 16:53:06 +03:00
Xinchen Hui
7695fba388
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Fix the bug in ZEND_ASSIGN_DIM (as nikic suggest)
Revert "Refix bug #73686 "
2016-12-09 22:30:41 +08:00
Xinchen Hui
6812721ef2
Revert "Refix bug #73686 "
...
This reverts commit 4589386026
.
2016-12-09 22:22:59 +08:00
Xinchen Hui
95f41f21e1
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Refix bug #73686
2016-12-09 16:43:45 +08:00
Xinchen Hui
4589386026
Refix bug #73686
2016-12-09 16:37:22 +08:00
Dmitry Stogov
e8109e09aa
Fixed memory leaks caused by exceptions thrown from destructors.
2016-12-07 00:41:07 +03:00
Dmitry Stogov
22cebaf89a
Revert "Fix return value memory leaks upon exceptions in opcode operand freeing"
...
This reverts commit 9ad9d7ae37
.
2016-12-02 11:58:41 +03:00
Dmitry Stogov
8fa691ea8a
Revert "Fix a few valgrind warnings with undefing result"
...
This reverts commit 8f4e100f21
.
2016-12-02 11:58:25 +03:00
Bob Weinand
8f4e100f21
Fix a few valgrind warnings with undefing result
2016-12-01 10:15:07 +01:00
Bob Weinand
9ad9d7ae37
Fix return value memory leaks upon exceptions in opcode operand freeing
2016-11-30 17:44:34 +01:00
Dmitry Stogov
1ab44223bf
Export zend_do_fcall_overloaded()
2016-11-22 18:36:27 +03:00
Dmitry Stogov
653c9e1fa2
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Removed useless (double) checks for EG(exception). (Bob)
2016-11-22 11:51:42 +03:00
Dmitry Stogov
8d70b04a1c
Removed useless (double) checks for EG(exception). (Bob)
2016-11-22 11:50:48 +03:00
Dmitry Stogov
68ee168c75
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Fixed memory leak (Bob)
2016-11-22 11:23:17 +03:00
Dmitry Stogov
db5bbe94be
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Fixed memory leak (Bob)
2016-11-22 11:22:55 +03:00
Dmitry Stogov
63ea4d194b
Fixed memory leak (Bob)
2016-11-22 11:22:10 +03:00
Dmitry Stogov
d6c332eb51
Turn IS_TYPE_COLLECTABLE zval flag into GC_COLLECTABLE zend_refcounted flag.
...
This simplifies checks and allows reset this flag for "acyclic" arrays and objects.
2016-10-21 17:47:30 +03:00
Dmitry Stogov
3e0e404173
Merge branch 'PHP-7.1'
...
* PHP-7.1:
zval_dtor_func_for_ptr() -> zval_dtor_func()
2016-09-29 11:00:13 +03:00
Dmitry Stogov
53c0a04185
zval_dtor_func_for_ptr() -> zval_dtor_func()
2016-09-29 10:59:54 +03:00
Dmitry Stogov
02a6c3a343
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Better fix for bug #72854 (avoid extra copy and creating reference to stack variable)
2016-09-29 10:57:39 +03:00
Dmitry Stogov
8863ca76e6
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Better fix for bug #72854 (avoid extra copy and creating reference to stack variable)
2016-09-29 10:57:09 +03:00
Dmitry Stogov
e7f4355d9b
Better fix for bug #72854 (avoid extra copy and creating reference to stack variable)
2016-09-29 10:56:01 +03:00
Dmitry Stogov
97628da24a
Expose information about calls to "fake" closures (created through ReflectionFunction::getClosure), to allow extra specialization of RETRUN opcode handler.
2016-09-26 17:44:28 +03:00
Nikita Popov
daa2b75c76
Fix some sizeof(zend_long) > sizeof(size_t) issues
...
Fix a couple of mistakes that are only relevant if
sizeof(zend_long) > sizeof(size_t).
* Fix cast order in string offset check: Negation should happen
after the (zend_long) cast, otherwise sign extension does not
occur.
* Use Z_UL in zend_inference.
* Use aligned size for HT_USED_SIZE in zend_persist: The issue is
that on x86-32 uint64_t is considered to be 4-aligned, so the
alignment assumption does not hold.
2016-09-05 15:33:02 +02:00
Davey Shafik
12ee17d5e0
Implement \ArgumentCountError exception
2016-08-30 19:35:56 -07:00
Xinchen Hui
557f1ccf0c
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Fixed bug #72943 (assign_dim on string doesn't reset hval)
Conflicts:
Zend/zend_execute.c
2016-08-26 18:32:54 +08:00
Xinchen Hui
c67fa3c91d
Fixed bug #72943 (assign_dim on string doesn't reset hval)
2016-08-26 18:30:08 +08:00
Xinchen Hui
e849e65d89
This is unecessary for 7.1 (IS_ERROR is an internal type)
2016-08-21 17:40:10 +08:00
Xinchen Hui
e572035ecf
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Fixed bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
Fixed bug #72907 (null pointer deref, segfault in gc_remove_zval_from_buffer (zend_gc.c:260))
2016-08-21 17:39:52 +08:00
Xinchen Hui
0476bb1de5
Fixed bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
2016-08-21 17:38:03 +08:00
Kalle Sommer Nielsen
447e57a1e1
Fixed 7.1 build, decls first please!
2016-08-17 20:26:32 +02:00
Nikita Popov
7384fcff0a
Merge branch 'PHP-7.0' into PHP-7.1
2016-08-16 21:05:57 +02:00
Nikita Popov
e2230c17d3
Fix bug #72854
2016-08-16 21:05:30 +02:00
Nikita Popov
ba09a520d2
Cleanup parameter/return type checking code
...
a) Extract all the logic for error message formatting into a separate
function that is reused for everything.
b) Extract the logic for whether a value matches a type into two
functions, one for user types, one for internal ones.
This tries to fight the increasing code duplication in the type
checking code, whether everything was repeated at least four times
and parts of the error message handling were repeated in dozens of
branches.
2016-08-16 15:48:33 +02:00
Andrea Faulds
1dab96c1db
Show "or null" in TypeErrors for nullable arg_infos
2016-08-11 18:44:43 +02:00
Andrea Faulds
ab45f13a0b
Merge branch 'PHP-7.0' into PHP-7.1
2016-08-08 21:00:49 +01:00
Andrea Faulds
5358c7cf5e
Replace dead branch with ZEND_ASSERT()
2016-08-08 20:56:11 +01:00
Nikita Popov
3859bcd1f8
Merge branch 'PHP-7.0' into PHP-7.1
2016-08-05 19:56:27 +02:00
Nikita Popov
807e81937b
Fix bug #72767
...
The page size calculation did not account for the size of the
stack header (or rather it did account for it, but in the wrong
direction...)
2016-08-05 19:55:10 +02:00
Nikita Popov
0bda0422af
Merge branch 'PHP-7.0'
...
Conflicts:
Zend/zend_vm_execute.h
2016-07-14 18:39:48 +02:00
Nikita Popov
82ce2a4e4d
Add missing call opcodes in cleanup_unfinished_calls()
...
Otherwise we may leak if an exception is thrown from them.
2016-07-14 18:37:28 +02:00
Nikita Popov
5f6effed43
Add opcodes to zend_wrong_string_offset()
2016-07-10 15:15:34 +02:00
Aaron Piotrowski
d9a9cf8eca
Merge branch 'master' into iterable
2016-07-03 22:42:10 -05:00
Dmitry Stogov
044e2718fe
Fixed executor without global register variales (gcc warnings or clang errors)
2016-06-27 10:36:41 +03:00
Dmitry Stogov
d0460d8f6b
Turn safe timeout handling into general interrupt handling ability.
2016-06-23 15:01:23 +03:00
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 #53432
...
Assign-ops and nested accesses now get the same treatment.
2016-06-08 15:43:58 +02:00
Aaron Piotrowski
8146c47d85
Fix error message
2016-06-03 18:29:24 -05:00
Aaron Piotrowski
72692e9a9c
Add iterable pseudo-type
2016-06-03 17:42:04 -05: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 #72059 - 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 #71737
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
a287c3f776
Fix magic constants (__LINE__) with ?? for constant scalar exprs
...
Also fix general memory leak when root ast gets replaced in compile time evaluation
2016-04-21 02:45:09 +02: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 #71756
2016-03-10 13:34:00 +03:00
Dmitry Stogov
f8506c062f
More effecient fix for bug #71756
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 #71754 (Regression in PHP7.0: trivial script segfaults php-cgi)
Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in switch)
tsrm_win32_get_path_sid_key might returns NULL (Partially fix bug #71752 )
2016-03-10 15:03:25 +08:00
Xinchen Hui
9833c76d3f
Bug #71756 (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
Dmitry Stogov
2e94cba430
Use quick check for first arguments
2016-02-26 21:44:28 +03:00
Francois Laupretre
be607e724c
Fix bug #71572
...
Discussed on the internals list as part of
http://markmail.org/message/fa625yc2eegk2dio .
2016-02-14 13:18:23 +01:00
Nikita Popov
44ed1cb5c0
Remove ZEND_CALL_CTOR_RESULT_UNUSED
...
Instead emit a FREE on the result of NEW.
2016-02-11 22:15:11 +01:00
Nikita Popov
5faedf5b3e
Remove EXT_TYPE_UNUSED in favor of IS_UNUSED
...
This means we no longer allocate an unused VAR for the retval of
instructions that support unused results.
Nearly all instructions already used the result variable only if
it was used. The only exception to this was the return value
variable for internal function call results. I've adjusted the code
to use a stack zval for the unused return case now. As we have
retval specialization now, we know that it doesn't matter.
2016-02-11 18:02:19 +01:00
Bob Weinand
00a2c30c59
Add extra VM operand specialization
...
For now RETVAL and OP_DATA= are supported
2016-02-04 16:49:50 +01:00
Dmitry Stogov
d510255879
Rename IS_ERROR into _IS_ERROR (to prevent redefinition on Windows).
2016-02-01 11:12:28 +03:00
Dmitry Stogov
86f54fcdf7
Use special type IS_ERROR instread of EG(error_zval). (we still need EG(error_zval) for SPL support).
2016-01-28 18:00:06 +03:00
Dmitry Stogov
e99fe9865e
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
2016-01-28 11:54:48 +03:00
Dmitry Stogov
6039d2d914
Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
2016-01-28 11:41:15 +03:00
Dmitry Stogov
6579e48417
Introduced BIND_STATIC opcode instead of FETCH_R/FETCH_W(static)+ASSIGN/ASSIGN_REF (similar to BIND_GLOBAL).
...
In the future we may refer to static variable by index instead of name, to eliminate hash lookup.
2016-01-12 12:20:35 +03: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
Dmitry Stogov
4abbfb9707
Marked function as "cold"
2015-12-24 16:03:31 +03:00
Xinchen Hui
70f9ba00f7
This check become useless after 98885bfa1e
2015-12-23 20:56:49 +08:00
Dmitry Stogov
98885bfa1e
Consolidate indirect string offset modification checks (Nikita, Dmitry)
...
Check it once, instead of dozens of times.
2015-12-23 13:52:15 +03:00
Dmitry Stogov
4c9e4caab4
Fixed typo
2015-12-10 21:17:24 +03:00
Xinchen Hui
02d7001962
Merge branch 'PHP-7.0'
2015-12-09 21:09:09 +08:00
Xinchen Hui
4c379392b2
Fixed bug #71067 (Local object in class method stays in memory for each call)
2015-12-09 21:07:59 +08:00
Andrea Faulds
366ba41334
Add void return type
2015-11-18 17:30:49 +00: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
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
Xinchen Hui
4803914ae6
Unused var
2015-11-10 15:54:32 +08:00
Dmitry Stogov
d66d1b97aa
Fixed incorrect order of free/finally on exception
2015-11-10 10:10:39 +03:00