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