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
Xinchen Hui
a8ae88162f
Fixed bug #70689 (Exception handler does not work as expected)
2015-10-13 17:40:58 +08:00
Nikita Popov
cc3c425af8
Fix bug #70662
...
This replaces add_new with update for the RW case. This should not
be problematic for performance, as this branch throws a notice.
Alternatively add_new could also be replaced with add. I went with
update, because it makes $a[0] += 1 behavior the same as
$a[0] = $a[0] + 1.
2015-10-08 11:03:39 +02:00
Nikita Popov
8557e8323a
Remove checks for read_property retval being NULL
...
read_property uses &EG(uninitialized_zval) instead.
2015-10-01 16:33:30 +02:00
Dmitry Stogov
62c96059a2
Fixed memory leak.
2015-09-23 23:16:30 +03:00
Xinchen Hui
504cd492e1
Fixed bug #70548 (Redundant information printed in case of uncaught engine exception)
2015-09-23 13:04:33 +08:00
Bob Weinand
e878dff5d8
Revert accidentally committed closures.c and execute.c
2015-09-19 23:22:07 +02:00
Bob Weinand
08e253cdbc
Optimize zend_mm_small_size_to_bin()
...
It removes a cmov operation and has a much faster branch for small allocations (especially when handling strings) (<= 64 bytes)
2015-09-19 23:07:43 +02:00
Xinchen Hui
98bf9156d5
unused var
2015-09-09 15:11:42 +08:00
Dmitry Stogov
c7dffb5673
Don't inline "Undefined variable" warning reporting.
2015-09-09 03:18:52 +03:00
Dmitry Stogov
bfab74d574
Check EG(exception) only if it's really necessary
2015-09-08 17:20:52 +03:00
Dmitry Stogov
37f0c6b5cb
Add myself into list of authors of the most refactored files.
2015-08-31 11:38:16 +03:00
Xinchen Hui
55f88141c5
Re-Fixed bug #70321 (Magic getter breaks reference to array property)
2015-08-23 11:42:33 +08:00
Xinchen Hui
e26a04f9ec
Revert "Fixed bug #70321 (Magic getter breaks reference to array property)"
...
This reverts commit 66754585f8
.
2015-08-23 10:40:28 +08:00
Bob Weinand
66754585f8
Fixed bug #70321 (Magic getter breaks reference to array property)
...
Note that the UNEXPECTED(zv) was turned into EXPECTED(zv), as zv is mostly set in the context where it is used and usually anyway is checked first with OP*_TYPE == IS_VAR; or maybe just completely remove that (UN)EXPECTED at this place...
2015-08-22 23:54:59 +01:00
Dmitry Stogov
71af54e5f6
Mark error and exception functions as "cold" (Matt's idea)
2015-08-19 14:40:56 +03:00
Dmitry Stogov
9b1570a378
Removed deprecated comments and added expectations (overloaded properties and array elements are less frequently used than regular ones)
2015-08-19 12:21:14 +03:00
Xinchen Hui
3ea8c3cf1c
Fixed memleak in Zend/tests/bug39297
2015-08-18 21:46:02 +08:00
Xinchen Hui
8df3461086
Improved fix for bug #70262
2015-08-18 18:07:31 +08:00
Anatol Belski
1a2c5bc180
second part fixing vc14, type/specifier order also in definitions
2015-08-12 08:52:08 +02:00
Dmitry Stogov
a658465ef2
Export argument type checking functions
2015-08-11 19:11:21 +03:00
Dmitry Stogov
97f159d702
Support for XLC compiler
2015-08-10 19:12:11 +03:00
Xinchen Hui
aa546256e3
Fixed bug #70223 (Incrementing value returned by magic getter)
2015-08-10 17:12:45 +08:00
Dmitry Stogov
a16aa4c42c
Move most "finally" related code-generation from pass_two() to compiler.
2015-08-04 07:42:28 +03:00
Bob Weinand
9e246a73ef
Fixed bug #70182 (Segfault in ZEND_ASSIGN_OP handlers)
2015-08-02 19:08:39 +02:00
Xinchen Hui
0f1e87d9c1
Fixed bug #70124 (null ptr deref / seg fault in ZEND_HANDLE_EXCEPTION)
2015-07-24 15:49:36 +08:00
Xinchen Hui
7d07afd6c1
Fixed bug #70089 (segfault at ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER ())
2015-07-17 15:55:34 +08:00
Bob Weinand
0af0733352
Fixed bug #70083 (Use after free with assign by ref on overloaded objects)
2015-07-15 22:36:42 +02:00
Xinchen Hui
f930d6ea0e
Fixed Bug #69996 (Changing the property of a cloned object affects the original)
2015-07-10 16:33:13 +08: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
Dmitry Stogov
301ee26568
Fixed situation, when CHECH_EXCEPTION() might change value of "opline" variable and the following "opline" useages would access elements of different opcode. That might lead to unpredictable behavior. (Only PHP-7 with GCC global register variables was affected).
...
CHECK_EXCEPTION() macro is removed. ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTIO() should be used instead. It's equivalent to old CHECK_EXCEPTION() + ZEND_VM_NEXT_OPCODE().
As a side effect, this also slightly improved performnce of builds with GCC >= 4.8.
2015-07-08 18:33:58 +03:00
Aaron Piotrowski
5df893ce3c
Use NULL where possible for exception class
...
Matches usage of zend_throw_exception()/zend_throw_exception_ex().
2015-07-07 12:10:55 -05:00
Dmitry Stogov
5ee8413259
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)
...
Squashed commit of the following:
commit 38e22106d4
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 15:12:19 2015 +0300
Added NEWS entry
commit 0a355935bf
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 15:06:32 2015 +0300
Inline function, to eliminate repeatable checks
commit d937584f3a
Merge: 0341626
32677f5
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 14:35:49 2015 +0300
Merge branch 'master' into temporary_cleaning
* master:
Fixed bug #70006 (cli - function with default arg = STDOUT crash output).
Fix x86 build
Fixed use after free on closure_call_leak_with_exception.phpt
Fixed test
commit 0341626ea9
Merge: 74869fa
dec35de
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 12:00:53 2015 +0300
Merge branch 'temporary_cleaning' of https://github.com/laruence/php-src into temporary_cleaning
* 'temporary_cleaning' of https://github.com/laruence/php-src :
Fixed checkpoint get
Fixed crash of invalid pointer derefer
cleanup
commit 74869fa673
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 11:45:34 2015 +0300
Fixed wrong GOTO resolution
commit dec35ded32
Author: Xinchen Hui <laruence@gmail.com>
Date: Tue Jul 7 15:58:49 2015 +0800
Fixed checkpoint get
commit b0f419540a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 10:47:11 2015 +0300
Fixed crash of invalid pointer derefer (laruence)
commit 7a428d98ca
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 10:35:47 2015 +0300
Fixed identation
commit 9c3a4dce9c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 10:33:52 2015 +0300
Fixed invalid size
commit 653abc670b
Author: Xinchen Hui <laruence@gmail.com>
Date: Tue Jul 7 11:29:14 2015 +0800
Fixed crash of invalid pointer derefer
commit e04500ceda
Author: Xinchen Hui <laruence@gmail.com>
Date: Tue Jul 7 11:28:26 2015 +0800
cleanup
commit 34183e1687
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 04:49:46 2015 +0300
op_array->T_liveliness compression
commit 2f6ad84579
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 04:44:44 2015 +0300
White spaces
commit be83f115a3
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 04:42:26 2015 +0300
Identation
commit 1f5084b990
Merge: 91b620d
1adf3df
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 04:41:54 2015 +0300
Merge branch 'master' into temporary_cleaning
* master:
Throw TypeError for invalid callback
Fix crash when exception occurs during nested rope
Fix crash when exception is thrown during ROPE_END
Small cleanup in ternary compilation
move the define to the right place
fix ext/ldap build
Rectify information about invalid shift warning being now ArithmeticError
commit 91b620d684
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 04:32:04 2015 +0300
Replace GOTO by FREE/FE_FREE and JMP at compile time
commit 7052e56979
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Jul 7 02:25:08 2015 +0300
Use zend_regenerate_var_liveliness_info() to regenerate information after pass two.
commit ae72b0dc67
Merge: a81c4bb
a919fe8
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 21:02:34 2015 +0300
Merge branch 'master' into temporary_cleaning
* master:
Do not display EXT_TYPE_UNUSED in phpdbg opcodes
Run debug build with opcache on travis
commit a81c4bb8c6
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 20:59:34 2015 +0300
Improved algorithm. It's actually the same algorithm with second loop removed and simpler temporary data structures. The only difference may be in "re-defined" vatriable handling. Now live-range in that case started from the seconnd definition (this must be more safe).
commit 9a16810f7a
Merge: bbfbe47
001ecd3
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 17:57:45 2015 +0300
Merge branch 'master' into temporary_cleaning
* master:
Simplify TMP var number decoding (without HashTable)
commit bbfbe470c8
Merge: 0bda4ab
436b01e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 17:02:01 2015 +0300
Merge branch 'master' into temporary_cleaning
* master:
Avoid dangerous optimization
Fixed JMPZNZ instruction printing
Attempt at falling back on ldap_find_control for Mac OS
commit 0bda4abea7
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 16:05:33 2015 +0300
Fixed live-range construction for OP_DATA opcode
Added comments about algorithm assumtions
commit 521ad9df98
Merge: 4398dab
a09dcb0
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Mon Jul 6 14:54:15 2015 +0200
Merge branch 'master' of https://github.com/php/php-src into temporary_cleaning
commit 4398dab82f
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Mon Jul 6 13:51:27 2015 +0200
Add a few phpt tests related to temporary cleaning
commit 739656f83f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 14:28:49 2015 +0300
Fixed Zend/tests/foreach_004.phpt failure (FE_FETCH shouldn't be included into TMP vatriablr live range)
commit 3df462a2bc
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 13:41:02 2015 +0300
Improve data layout (reduce the op_array structure size on 64-bit systems)
commit 883b73c56e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Jul 6 13:28:45 2015 +0300
Removed op_array->brk_cont_array
commit ae5e58b598
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Mon Jul 6 04:22:58 2015 +0200
Fix bug with brk_cont variable free / free loop vars via temporary liveliness info
commit b4223ca627
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Mon Jul 6 04:07:07 2015 +0200
Fix bugs / cleanup fixes
commit ea33189d22
Author: Xinchen Hui <laruence@gmail.com>
Date: Sun Jul 5 20:58:38 2015 +0800
Removed useless TsTop
commit 1dbb007e4a
Merge: 550bbf8
3a8af24
Author: Xinchen Hui <laruence@gmail.com>
Date: Sat Jul 4 15:06:44 2015 +0800
Merge branch 'temporary_cleaning' of https://github.com/dstogov/php-src into temporary_cleaning
commit 3a8af24529
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 3 16:15:36 2015 +0300
More exceptions from regular liveliness analyses (with explanation in comments).
Mark old "unexplained" exceptions with ???.
commit ba721efa2c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 3 14:16:09 2015 +0300
Print list of live temp variables (at least for internal debugging)
commit 8d1f88fe91
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 3 13:31:56 2015 +0300
Use op_array->T_liveliness to free incomplete ropes and restore error_reporting level on exception
commit 80c1d0d779
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jul 3 11:05:39 2015 +0300
Don't keep empty T_liveliness
commit 501ae8aaac
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jul 2 22:31:48 2015 +0300
Reverted changes to Zend/zend_arena.h.
Reuse CG(arena) instead of creating a new one.
commit a4fce36907
Merge: 6ff7246
fd0fcce
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jul 2 22:01:42 2015 +0300
Merge branch 'temporary_cleaning' of github.com:bwoebi/php-src into temporary_cleaning
* 'temporary_cleaning' of github.com:bwoebi/php-src:
Fix remaining issues with compacted temporaries
Fix regression from last commit (+1 ?!)
Fix off-by-one (opcache may remove last ZEND_RETURN)
Speed algorithm up, more fail safety when reusing temporaries
Dumb bug in opcode.c (forgot to update Ts[i])
Fix opcache support
Exempt ROPE temporaries from freeing
Hmm, we need temporary info for all the opcodes
Add opcache support for cleaning in optimization step (Opcache seems to have a few unrelated issues which blow up together with that patch)
Add proper temporary cleaning upon frame abortion
Fix arena on small sizes (size < sizeof(zend_arena))
commit fd0fcce811
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Thu Jul 2 20:00:33 2015 +0200
Fix remaining issues with compacted temporaries
commit 427dc58bbb
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Wed Jul 1 22:49:12 2015 +0200
Fix regression from last commit (+1 ?!)
commit 1adcf56a6e
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Wed Jul 1 22:17:07 2015 +0200
Fix off-by-one (opcache may remove last ZEND_RETURN)
commit 25b231b784
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Wed Jul 1 20:59:24 2015 +0200
Speed algorithm up, more fail safety when reusing temporaries
commit 22d9d05350
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Wed Jul 1 16:48:46 2015 +0200
Dumb bug in opcode.c (forgot to update Ts[i])
commit 6538269bfa
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Wed Jul 1 13:05:52 2015 +0200
Fix opcache support
commit 333a7c4a88
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Sat Jun 27 22:40:21 2015 +0200
Exempt ROPE temporaries from freeing
commit 02585f7708
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Fri Jun 26 16:20:55 2015 +0200
Hmm, we need temporary info for all the opcodes
commit cbcaedbd78
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Fri Jun 26 01:04:09 2015 +0200
Add opcache support for cleaning in optimization step
(Opcache seems to have a few unrelated issues which blow up together with that patch)
commit fef649f406
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Fri Jun 26 01:02:27 2015 +0200
Add proper temporary cleaning upon frame abortion
commit 1cec2e7271
Author: Bob Weinand <bobwei9@hotmail.com>
Date: Thu Jun 25 23:33:21 2015 +0200
Fix arena on small sizes (size < sizeof(zend_arena))
2015-07-07 15:41:12 +03:00
Xinchen Hui
333528089e
Fixed use after free on closure_call_leak_with_exception.phpt
2015-07-07 18:19:57 +08:00
Nikita Popov
724051e3bd
Fix crash when exception occurs during nested rope
...
Adds extra condition that the rope var of INIT/ADD must match the
one one END.
2015-07-06 20:53:54 +02:00
Kalle Sommer Nielsen
ce2cd89258
Replace references to PHP_WIN32 and TSRM_WIN32 with ZEND_WIN32 in Zend/, this also fixes 1 instance of where fflush(stderr) was misplaced (zend_extensions.c)
2015-07-04 18:55:22 +02:00
Aaron Piotrowski
22c38b2ef5
Remove need to pass error level
2015-07-03 17:53:41 -05:00
Aaron Piotrowski
5a99c07ecc
Enable throwing custom exceptions from errors
2015-07-03 17:53:40 -05:00
Dmitry Stogov
7aa7627172
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
2015-06-30 13:59:27 +03:00
Dmitry Stogov
4bd22cf1c1
Improved zend_string API (Francois Laupretre)
...
Squashed commit of the following:
commit d96eab8d79
Author: Francois Laupretre <francois@tekwire.net>
Date: Fri Jun 26 01:23:31 2015 +0200
Use the new 'ZSTR' macros in the rest of the code.
Does not change anything to the generated code (thanks to compat macros) but cleaner.
commit b352643910
Author: Francois Laupretre <francois@tekwire.net>
Date: Thu Jun 25 13:45:06 2015 +0200
Improve zend_string API
Add missing methods
2015-06-29 16:44:54 +03:00
Bob Weinand
4a4529adb0
Fix rope memory leaks upon exception
2015-06-28 15:42:15 +02:00
Bob Weinand
25e1b49ea1
Fix warning in zend_execute.c by explicit cast
2015-06-26 20:39:56 +02:00
Bob Weinand
1335ebd068
Fix Closure leak in aborted INIT_DYNAMIC_FCALL
2015-06-26 05:10:58 +02:00
Dmitry Stogov
7a01c44ab2
Fixed bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER)
2015-06-23 16:26:40 +03:00
Bob Weinand
115e9288bb
Fix segfault with scalar passed to typehint with not loaded class
2015-06-21 01:35:22 +02:00
Nikita Popov
ddf41d3aeb
Fix generator memory leak
...
Make sure HANDLE_EXCEPTION and generator unwinds stay in sync in
the future by extracting a common function.
2015-06-20 18:37:28 +02:00
Bob Weinand
7adc0ae631
Fix potential writes into wrong memory, ensure vm_stack integrity
...
Fixes also a segfault on stack frames > 1 << 18 bytes
Stack frames, when reallocated, need to be marked as top frame of current stack page
2015-06-20 18:29:09 +02:00
Nikita Popov
9fa70dbd29
Fixed bug #69889
...
There is one case that requires further discussion:
$foo = "test";
var_dump($foo[0.0] ?? "default");
var_dump(isset($foo[0.0]) ? $foo[0.0] : "default");
Here the former will currently return "t", while the latter also
returns "t" and additionally throws a notice.
I think we need to revisit the behavior of invalid types for string
offset access in PHP 7, as currently there is some mismatch between
what isset() does and what the access itself supports.
2015-06-20 15:09:58 +02:00
Xinchen Hui
235c7edb8b
Revert "Fix bug #69871 (short-circuiting failure with smart_branch)"
...
This reverts commit fae6bedea5
.
2015-06-19 23:03:23 +08:00
Bob Weinand
fae6bedea5
Fix bug #69871 (short-circuiting failure with smart_branch)
2015-06-18 15:59:00 +02:00
Dmitry Stogov
a524a375d9
Improved class type hints checks, by caching resolved class entries in run-time cache.
2015-06-17 12:07:43 +03:00
Bob Weinand
7c2a0157c7
Cache the class_name typehint key in arg_info
...
This leads to up to 2% improvement on one tested real world application by not having to always recalculate the lowercased string and its hash
2015-06-12 17:26:53 +02:00
Márcio Almada
fdda34e0bc
fix bad formatted "undefined offset" notice when key is negative
2015-06-10 22:18:23 +02:00
Dmitry Stogov
7f39ee7159
Delay checks for undefined CV variables after checks for fast paths.
2015-06-05 01:53:32 +03:00
Dmitry Stogov
544fb5c7bc
Separate rare used increment/decrement/assign_op of overloaded properies into non inlined functions.
2015-06-03 18:44:25 +03:00
Dmitry Stogov
ce862a25d5
Reorder conditions to check for fast paths first.
2015-06-01 17:22:04 +03:00
Nikita Popov
d0e265392f
Drop FREE_ON_RETURN flag, check brk_cont->start instead
...
Start >= 0 already tells us whether or not the loop has a loop
variable, no need to add extra flags to opcodes.
Also added a test for a case where FREE_ON_RETURN is relevant,
we didn't seem to have any coverage for this.
2015-05-23 10:51:33 +02:00
Nikita Popov
4ea1d8a9c7
Show argument causing TypeException in trace
...
Not sure why that check was there, did I miss something?
2015-05-20 18:28:09 +02:00
Dmitry Stogov
d72a94468e
Merged FE_FETCH_R[W] with the following ASSIGN[_REF] when assigne to CV.
2015-05-13 12:55:42 +03:00
Dmitry Stogov
0586702d32
Mark first call frames of stack segment with ZEND_CALL_ALLOCATED flag to simplify checks on stack deallocation.
2015-05-12 15:56:42 +03:00
Dmitry Stogov
ab4ccffc4c
Avoid unnecessary reference counter incrementation on $this when call methods
2015-05-07 16:28:23 +03:00
Dmitry Stogov
762a774c40
Fixed repeatable opcodes on CALL VM without global registers
2015-04-29 14:20:44 +03:00
Dmitry Stogov
690440771a
Paired instuctions frequientiy used together (e.g. comparisons + conditional jumps)
2015-04-29 04:17:59 +03:00
Dmitry Stogov
d271d2cf7b
Make ZEND_RECV_INIT and ZEND_BIND_GLOBALS opcodes to be "repeatabe" with inner-loop instead of main interpreter loop.
2015-04-29 00:40:43 +03:00
Dmitry Stogov
3057034608
Optimize opcodes for fast path
2015-04-28 23:57:21 +03:00
Dmitry Stogov
388c2cbdbc
Micro optimizations
2015-04-28 19:11:45 +03:00
Dmitry Stogov
15a5f61cf4
Use fast method to check if first arguments should be passed by reference (not tested onbig endian).
2015-04-22 21:46:13 +03:00
Xinchen Hui
8362aebdbf
Fixed mem leak in assign_to_obj with reference
2015-04-21 21:04:20 +08:00
Dmitry Stogov
b99174136c
Fixed reference counting
2015-04-20 18:49:17 +03:00
Dmitry Stogov
10d4fdb34a
Fixed memory-leak
2015-04-17 01:27:54 +03:00
Dmitry Stogov
5b0d86edcc
Safe destruction (variables and arguments may need to be cuptured by exception)
2015-04-16 21:45:40 +03:00
Dmitry Stogov
2ca2d0938b
Micro optimizations for the more frequently paths
2015-04-16 14:46:54 +03:00
Dmitry Stogov
6aee1ee4a1
Optimization of stack-frame construction
2015-04-15 17:02:21 +03:00
Dmitry Stogov
8144795133
Avoid double refcounting
2015-04-15 13:34:23 +03:00
Nikita Popov
108ae7961e
Fix leak when calling ->get() on tmp property
2015-04-14 22:16:18 +02:00
Bob Weinand
f3e124d58d
Merge branch 'coroutineDelegation' of https://github.com/bwoebi/php-src
2015-04-14 17:58:58 +02:00
Dmitry Stogov
851a219226
Fixed typo
2015-04-08 23:15:43 +03:00
Dmitry Stogov
adcf0c6052
Improved reference counting
2015-04-03 01:32:20 +03:00
Dmitry Stogov
ea09a9fa32
Convert fatal errors into EngineExceptions
...
Make zval_update_constant_ex(), zval_update_constant(), zend_update_class_constants() and zend_ast_evaluate() return SUCCESS or FAILURE.
2015-04-02 02:05:25 +03:00
Dmitry Stogov
0cad725886
Convert fatal errors into EngineExceptions
2015-04-01 15:54:03 +03:00
Dmitry Stogov
8c031a3f95
Handle incorrect break/continue statements at compile-time
2015-04-01 15:52:26 +03:00
Dmitry Stogov
4fd93a4da6
Converted fatal errors into EngineExceptions
2015-04-01 14:50:09 +03:00
Dmitry Stogov
acfc31c0f8
Use zend_error_noreturn() for fatal errors
2015-04-01 13:32:23 +03:00
Nikita Popov
8d00385871
Reclassify E_STRICT notices
...
Per RFC https://wiki.php.net/rfc/reclassify_e_strict
While reviewing this, found that there are still three E_STRICTs
left in libraries - need to discuss those.
2015-04-01 11:17:55 +02:00
Dmitry Stogov
35f9b90bb8
ZPP changed to lazely check for "strict/weak" only if it's really necessary.
...
Cleanup.
2015-03-20 23:18:52 +03:00
Dmitry Stogov
66f16c6cfb
Fixed comments
2015-03-20 17:26:38 +03:00
Dmitry Stogov
5935612666
Improved type hinting:
...
EX_PREV_USES_STRICT_TYPES() and family changed/renamed to fit with other macros
Optimized zend_verify_internal_arg_type() and family (they don't need "strict" argument anymore)
Standerd ZPP is called from VM only for weak type check or strict exception (int -> double)
Fixed ZEND_RECV_VARIADIC
Fixed ZEND_STRLEN
TODO: should we accept IS_NULL for non-nullable arguments?
2015-03-20 16:04:04 +03:00
Dmitry Stogov
44669e8f41
Fixed white spaces
2015-03-20 11:10:29 +03:00
Dmitry Stogov
aee2985f35
Merge branch 'scalar_type_hints_v5' of github.com:ircmaxell/php-src into scalar_type_hints_v5
...
* 'scalar_type_hints_v5' of github.com:ircmaxell/php-src: (54 commits)
Add check for maintaining reference all the way through both type and return values
Reduce the number of times that the zval needs to be separated in return type checking to those that are necessary
Add test to ensure namespaced code can't use scalar types as class names
Disallow relative namespace type declarations
Add support and tests for null constant default values. Refactor complex conditionals into an extracted function for clarity and code-reuse
Refactor as to not use call info, but add the flag to the op_array.
Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come
Fix C89 compatibility by moving a misplaced if statement
Refactor gotos into more elaborate ifs to eliminate goto failure
Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases
Add error case with invalid type declaration default value
Add tests for using constants as defaults with scalar type declarations
Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
Revert gd and mysqli to former calls for arg count errors. Fix first identified issues with zend_compile.c from nikic. Add tests for generator returns prior to first yield
Style cleanup, as well as fixing bug with missing argument for WRONG_PARAM_COUNT_WITH_RETVAL
Clean up API renames for zend_wrong_param_count to maintain BC, introducing a zend_wrong_param_count_ex() function when you know strict value
Fix executor issue with ignoring strict types, which cleans up a bunch of errors. Additionally fix the expected error of 2 unrelated tests that was caused by a change to the core error messages
Fix more tests, improve error messages in failure output for thrown exception
Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function
Refactor declare placement detection, allow encoding declares before type declares
...
2015-03-20 10:51:41 +03:00
Dmitry Stogov
d146d15003
Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate()
2015-03-20 02:02:42 +03:00
Anthony Ferrara
62fc556764
Add support and tests for null constant default values. Refactor complex conditionals into an extracted function for clarity and code-reuse
2015-03-19 13:51:24 -04:00
Anthony Ferrara
d8ef608f3d
Refactor gotos into more elaborate ifs to eliminate goto failure
2015-03-18 18:24:00 -04:00
Anthony Ferrara
427ecdc5eb
Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases
2015-03-18 18:10:08 -04:00
Anthony Ferrara
724f7118f1
Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
2015-03-18 16:38:51 -04:00
Anthony Ferrara
0529eeb4a6
Fix executor issue with ignoring strict types, which cleans up a bunch of errors. Additionally fix the expected error of 2 unrelated tests that was caused by a change to the core error messages
2015-03-18 15:22:21 -04:00
Anthony Ferrara
dd9f4f9585
Fix more tests, improve error messages in failure output for thrown exception
2015-03-18 12:42:09 -04:00
Anthony Ferrara
7feebead1b
Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function
2015-03-18 12:23:09 -04:00
Anthony Ferrara
d22bfb8aa6
Merge in master, fix merge conflicts and update patch to support exceptions everywhere
2015-03-18 10:50:11 -04:00
Dmitry Stogov
a01b5f2953
Enabled global register variables for PPC
2015-03-18 16:15:00 +03:00
Dmitry Stogov
d6bb5c2cd4
GCC prior 4.8.0 may generates wrong code
2015-03-18 02:15:49 +03:00
Dmitry Stogov
4d4a5336f1
Embed "fast" operator functions (add, sub, increment, etc) into executor with additional optimizations
2015-03-17 18:53:19 +03:00
Dmitry Stogov
fb4b706984
Enable GCC global register variables if available
2015-03-17 13:51:02 +03:00
Dmitry Stogov
5c68836b0b
improved timeout handling on windows
2015-03-16 17:49:43 +01:00
Anatol Belski
e78971cd7b
fix syntax for the Visual studio compat
2015-03-13 20:25:10 +01:00
Dmitry Stogov
db10b72523
Use fastcall calling convention for most critical ZE subsystems.
2015-03-13 21:10:09 +03:00
Dmitry Stogov
249c2323f4
Allow CALL executor to keep few very often used vaiables in CPU registers.
...
This is disabled by default yet, but may be enabled compiling zend_execute.c with -DHAVE_GCC_GLOBAL_REGS.
Only tested on Linux x86 and x86_64 with GCC 4.9.2.
2015-03-13 03:28:21 +03:00
Dmitry Stogov
6289f7e52f
Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build additional PHP-5.0 compatible VM, hide executor implementation details.
2015-03-12 20:39:04 +03:00
Dmitry Stogov
a30d328671
Errors converted to exceptions are not "recoverable" anymore.
2015-03-10 10:31:55 +03:00
Dmitry Stogov
1c94ff0595
Implement engine exceptions
...
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7
Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01:00
Bob Weinand
afad979c60
Reduced initial VM_STACK page size of Generators to 4 KB (256 slots)
...
Generators all have their own vm_stack, but usually don't go really deep.
In most cases even most of the 4 KB will remain unused (in my tests average is rather 1 KB), but this was tested a straightforward implementation without a lot of abstraction layers.
That way I'm using a more conservative 4 KB stack size which really should be enough for, I think, at least 90% of the cases.
This was necessary to not immediately run out of memory with 95%+ usused vm_stack space: If you have a few thousands of Generators active, your application quickly hits memory_limit with a stack page size of 256 KB...
In addition, it's also a bit faster (70% less instructions for zend_vm_stack_new_page) due to emalloc() not having to allocate a whole new segment (segment size 256 KB). Also no mmap()/malloc() necessary.
2015-03-07 13:25:21 +01:00
Bob Weinand
b4a142ab97
Added yield from operator
2015-03-07 00:28:12 +01:00
Dmitry Stogov
fa2450c5f8
Don't inline helpers for ArrayAccess objects
2015-03-03 03:28:31 +03:00
Nikita Popov
fcdb6e0811
WIP
2015-02-28 21:20:37 +01:00
Dmitry Stogov
ff86267632
Fixed compilation warnings
2015-02-25 23:20:47 +03:00
Dmitry Stogov
c2c78dc963
Added specialized versions of DO_FCALL handler:
...
DO_ICALL - for internal functions
DO_UCALL - for user functions
DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods)
2015-02-25 10:37:21 +03:00
Dmitry Stogov
5f278e4d3a
Use cache_slot offsets instead of indexes (simplify run-time instructions)
2015-02-25 01:52:35 +03:00
Dmitry Stogov
e97ae4fee8
Make zend_array_destroy() to free the corresponding zend_array
2015-02-24 18:34:37 +03:00
Anthony Ferrara
dc35868a77
Merge branch 'master' into scalar_type_hints_v5
2015-02-20 13:33:35 -05:00
Dmitry Stogov
d85113702c
Lazy duplication of op_array->static_variables
2015-02-20 13:28:26 +03:00
Anthony Ferrara
9109e48749
Merge in master
2015-02-18 10:35:39 -05:00
Dmitry Stogov
e10e151e9b
Merged zend_array and HashTable into the single data structure.
...
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
2015-02-13 22:20:39 +03:00
Dmitry Stogov
97fe15db43
Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach
...
Squashed commit of the following:
commit 1e41295097
Author: Dmitry Stogov <dmitry@zend.com>
Date: Sat Jan 31 07:28:58 2015 +0300
Generalize HashTableIterator API to allows its usage without involvement of HashTable.nInternalPonter
commit 5406f21b11
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 18:08:43 2015 +0300
Reduced alghorithms complexity
commit b37f1d58d2
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 18:08:30 2015 +0300
Fixed test name
commit fb2d079645
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 18:08:05 2015 +0300
API cleanup
commit 08302c0d6d
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 14:20:46 2015 +0300
Make array_splice() to preserve foreach hash position
commit cc4b7be41e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 12:24:31 2015 +0300
Make internal function, operation on array passed by reference, to preserve foreach hash position
commit 5aa9712b0a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 09:49:35 2015 +0300
Implement consistent behavior for foreach by value over plain object
commit 4c5b385ff5
Author: Dmitry Stogov <dmitry@zend.com>
Date: Fri Jan 30 07:56:37 2015 +0300
More careful iterators update.
commit 721fc9e80d
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jan 29 21:43:28 2015 +0300
Added new test
commit 15a23b1218
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jan 29 21:05:02 2015 +0300
Reimplement iteration magic with HashTableIterators (see https://wiki.php.net/rfc/php7_foreach#implementation_details )
commit 10a3260b1f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jan 29 21:04:44 2015 +0300
New test
commit eef80c5837
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jan 28 16:52:21 2015 +0300
Fixed foreach by reference iteration over constant array
commit 61e7391873
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jan 28 14:59:54 2015 +0300
Fixed temporary variable re-allocation pass
commit 92e90c09f0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jan 28 12:44:57 2015 +0300
Fixed operand destruction in case of exceptions in iterator
commit dd2a36a207
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jan 28 10:02:34 2015 +0300
Use GET_OP1_ZVAL_PTR_DEREF() (IS_TMP_VAR and IS_CONST can't be IS_REFERENCE)
commit 4638f7b914
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jan 28 07:43:28 2015 +0300
Change "foreach" statement behavior (this is just a PoC yet)
- "foreach by value" don't relay on internal array/object pointer and doesnt perform array duplication. It just locks it incrementing reference counter. If the original array is modified by some code, the copy on write is performed and "foreach" still work with the old copy.
- it makes no difference if array given to "foreach by value" is reference itself
- "foreach by reference" still use internal array/object pointer and should work similar to PHP-5. (This id not completely implemented)
2015-02-12 13:57:12 +03:00
Dmitry Stogov
d6bea5bb1e
Fixed use after free on the following code
...
sapi/cli/php -r 'function hello(string $world) : string { var_dump(bin2hex($world)); return $world; } echo "foo" . hello(6) . "\n";'
2015-02-10 15:51:16 +00:00
Andrea Faulds
5a7ac0fade
Implement per-file strictness for scalar return types
2015-02-10 15:48:09 +00:00
Andrea Faulds
6b6b2b4b7c
Implement scalar return types (strict only for now)
2015-02-10 15:48:09 +00:00
Andrea Faulds
fe663cc404
Partial ZPP strictness implementation
2015-02-10 15:48:06 +00:00
Andrea Faulds
cc01e37e54
It Begins
2015-02-10 15:48:06 +00:00
Andrea Faulds
a13d13429a
Refactor scalar type hints implementation per Dmitry's patch
2015-02-10 15:48:05 +00:00
Andrea Faulds
d4dd2a9baf
Use new names of arg parsing functions
2015-02-10 15:48:05 +00:00
Andrea Faulds
c3c0f531a2
Scalar type hints with ZPP casting rules
2015-02-10 15:48:04 +00:00
Dmitry Stogov
f5a9cfc33a
Merge branch 'internal-function-return-types' of github.com:reeze/php-src into test
...
* 'internal-function-return-types' of github.com:reeze/php-src:
Add load time return type checking to match user land logic
Add test function arguments
Implemented internal function return types
2015-02-05 11:01:07 +03:00
Reeze Xia
bff4c47fa7
Implemented internal function return types
2015-02-05 01:04:54 +08:00
Dmitry Stogov
8b46d45a9d
Simplify code and add comments
2015-02-04 17:56:14 +03:00
Levi Morrison
c8576c5a46
Implement return types
...
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Dmitry Stogov
371dc9b6a6
Fixed bug #68896 (Changing ArrayObject value cause Segment Fault)
2015-01-26 11:25:05 +03:00
Xinchen Hui
fc33f52d8c
bump year
2015-01-15 23:27:30 +08:00
Dmitry Stogov
5a24ac8853
Improved access to object properties (cache property offset instead of pointer to property_info).
2015-01-13 11:33:00 +03:00
Stanislav Malyshev
b7a7b1a624
trailing whitespace removal
2015-01-10 15:07:38 -08:00
Dmitry Stogov
ab0b15b8ff
Optimized destruction of extra arguments passed to user functions.
...
If no refcounted arguments are passed, then destruction code is not triggered at all.
(Full rebuild required)
2014-12-26 22:34:44 +03:00
Dmitry Stogov
fd4844e079
Removed useless checks
2014-12-22 19:04:29 +03:00
Dmitry Stogov
2646f7bcb9
Don't count variadic argument in zend_func.common.num_args. This allows faster CALL/RETURN code.
2014-12-22 16:44:39 +03:00
Anatol Belski
bdeb220f48
first shot remove TSRMLS_* things
2014-12-13 23:06:14 +01:00
Dmitry Stogov
3893c1fc3d
Fixed compilation warnings
2014-12-12 21:57:34 +03:00
Dmitry Stogov
68cfeed70f
Removed unnecessary checks
2014-12-12 21:57:12 +03:00
Dmitry Stogov
14e29f5146
Reduced size of zend_op on 64-bit systems.
...
the main idea - the smaller the zend_op structure, the lees memory traffic is required to load VM instructions during execution. The patch reduces the size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode, and applications use thousands of opoceds). This reduced the number of CPU cache misses by 12% and improved performance of real-life apps by 1-2%.
The patch affects how constants and jump targets are represented in VM during execution. Previously they were implemented as absolute 64-bit pointers. Now they are relative 32-bit offsets.
In run-time constant now should be accessed as:
RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
EX_CONSTANT(opline->op1) instead of opline->op1.zv
Jump targets:
OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr
The patch doesn't change zend_op representation for 32-bit systems. They still use absolute addresses. The compile-time representation is also kept the same.
2014-12-12 10:19:41 +03:00
Anatol Belski
da78550006
fix TS build and C89 compat
2014-12-10 12:23:46 +01:00
Dmitry Stogov
5b3a69c29f
Improved ASSIGN_<OP>, ASSIGN_DIM and UNSET_DIM
2014-12-09 15:15:24 +03:00
Dmitry Stogov
98e81e13cf
simplified code
2014-12-09 12:17:55 +03:00
Dmitry Stogov
f70545678b
Pass znode_op structure by value (it fits into one word) instead of pointer to structure.
2014-12-09 03:03:38 +03:00
Dmitry Stogov
11f7854e75
Move checks for references into slow paths.
2014-12-09 01:09:44 +03:00
Dmitry Stogov
b6c6e7960a
Improved ASSIGN_DIM and ASSIGN_OBJ
2014-12-09 00:10:23 +03:00
Dmitry Stogov
db4271d332
Move checks for references into slow paths of handlers or helpers. Remove duplicate opcode handlers.
2014-12-08 18:11:14 +03:00
Dmitry Stogov
a417ebfc48
Get rid of duplicare FETCH_DIM_* handlers
2014-12-05 13:45:03 +03:00
Dmitry Stogov
5dd427eac2
Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*.
2014-12-03 16:56:09 +03:00
Dmitry Stogov
1da14c9f81
Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" into "call_kind" and VM_FRAME_... into ZEND_CALL_...
2014-11-28 10:33:03 +03:00
Dmitry Stogov
11384ba77b
Pack EX(num_args) into EX(This).u2.num_args
2014-11-28 10:28:49 +03:00