Commit Graph

1239 Commits

Author SHA1 Message Date
Dmitry Stogov
7f39ee7159 Delay checks for undefined CV variables after checks for fast paths. 2015-06-05 01:53:32 +03:00
Dmitry Stogov
aca6a1a1c9 Convert "switch" into series of "if". This allows better fast-path placement, additional specialization and makes final code less. 2015-06-04 19:14:16 +03:00
Dmitry Stogov
0040efb170 Avoid useless copying and duplication 2015-06-04 19:13:40 +03:00
Dmitry Stogov
f07d770f0b Specialize out useless checks. Only IS_VAR may be EG(error). 2015-06-04 17:20:37 +03:00
Dmitry Stogov
2fcdad6a58 Removed useless code (there is nothing to free for string offsets). 2015-06-03 22:23:06 +03:00
Dmitry Stogov
36c36ee56d Removed dead code (IS_CONST operand can't be IS_OBJECT) 2015-06-03 19:29:03 +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
58dc22cc13 Reorder conditions to check for fast paths first 2015-06-03 17:20:47 +03:00
Dmitry Stogov
ce2a78939d isset() micro-optimisation 2015-06-03 16:27:38 +03:00
Dmitry Stogov
b21191ba78 Removed commented code 2015-06-03 14:49:29 +03:00
Dmitry Stogov
c09698753e CONCAT optimization 2015-06-03 11:15:28 +03:00
Dmitry Stogov
0d054f5faf Avoid useless duplication. Constant values have to be duplicated only for internal constants in ZTS build, to prevent simultaneous modification of reference counters from different threads. 2015-06-02 12:01:34 +03:00
Dmitry Stogov
ce862a25d5 Reorder conditions to check for fast paths first. 2015-06-01 17:22:04 +03:00
Bob Weinand
b73f87b1e4 Add test for memory leak with wrong return type 2015-05-27 01:37:00 +02:00
Bob Weinand
f7f7d6e385 Fix memory leak with return types upon failure
TMP/VAR wasn't being freed in VERIFY_RETURN
2015-05-27 01:18:06 +02:00
Dmitry Stogov
18cd4b17cc Fixed typo 2015-05-25 19:20:52 +03:00
Dmitry Stogov
c436e25fd5 Fixed bug #69700 (tests/lang/this_assignment.phpt memory errors) 2015-05-25 18:29:31 +03:00
Nikita Popov
8542befa7b Remove ZEND_BRK/ZEND_CONT from VM
These are no longer used at run-time now, only temporarily during
compilation.
2015-05-23 10:51:33 +02:00
Nikita Popov
9325ada725 Embed break/continue depth into opline
Previously a separate lval literal was used - this is probably a
leftover from the time where the break level could still be
specified dynamically.
2015-05-23 10:51:33 +02: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
Dmitry Stogov
d6bcf2bf2e Micro optimization 2015-05-20 22:51:45 +03:00
Dmitry Stogov
cee88571d9 Fixed bug #69649 (segfault with --enable-dtrace) 2015-05-18 12:44:40 +03:00
Nikita Popov
0df2f470fa Don't write prop if read prop threw exception 2015-05-17 13:46:54 +02:00
Dmitry Stogov
fc75d07652 Fixed memory leak 2015-05-14 17:07:32 +03: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
Aaron Piotrowski
071111ecfc Add support for $callable() sytnax with 'Class::method'
Using the $callable() syntax when used with a string of
the form 'Class::method' would error as an undefined
function, even if the string passed is_callable() or the
callable type-hint. The fix adds support for the $callable()
syntax for any string accepted by is_callable() or the
callable type-hint.

Fix bug 68475 test with deprecated notice

Reduced scope of unit test.

Added tests with arguments.
2015-05-12 13:33:28 +02:00
Nikita Popov
8f9f21e8d2 Fix static closure error in call_user_func opcode
I'm assuming this is the only error that is_callable() can generate
with retval=1.

This problem manifested after making closures in static methods
not implicitly static, but would also occur when binding any non-static
closure to a scope without a $this.
2015-05-08 15:17:15 +02:00
Dmitry Stogov
a989c0a1a9 Improved fast path locality 2015-05-07 17:26:35 +03:00
Dmitry Stogov
ab4ccffc4c Avoid unnecessary reference counter incrementation on $this when call methods 2015-05-07 16:28:23 +03:00
Nikita Popov
d9c2959c27 Fix LSB handling for closures
Closures will now use the called_scope from their instantiation
site. If they are rebound either the class of $this is used or if
no $this is provided the bound scope is used.

With this change the scope for static closures can be changed back
to use EG(scope) rather than EX(called_scope), thus fixing
bug #69568.
2015-05-05 21:14:03 +02:00
Nikita Popov
dc546bdc4d Throw exception from FETCH_CLASS_NAME
Instead of empty strings.

This does not affect the existing case of __CLASS__ in traits as
a scope will always exists in that case.
2015-05-05 21:14:03 +02:00
Nikita Popov
dd1fdfb17c Use ZEND_FETCH_CLASS_NAME for dynamic self::class etc
Extend the opcode to support getting the parent and static name and
then use it for dynamic ::class resolution.
2015-05-05 21:14:03 +02:00
Dmitry Stogov
a8172353ba Micro optimization 2015-05-05 18:50:47 +03:00
Xinchen Hui
ce9248b6ef Merge branch 'PHP-5.6' 2015-05-04 19:26:07 +08:00
Xinchen Hui
7289981c61 Merge branch 'PHP-5.5' into PHP-5.6 2015-05-04 19:22:22 +08:00
Xinchen Hui
7af9ba23a7 Saving the latter checking in most cases 2015-05-04 19:21:54 +08:00
Dmitry Stogov
d880ead8a7 Improve fast_is_[not_]identical() functions to teturn value instead of takeing additional arguments.
Pair INSTANCEOF with the following JMPZ/JMPNZ.
2015-04-29 16:43: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
612de5214f Simplified code 2015-04-28 19:11:23 +03:00
Dmitry Stogov
89be15c56d Micro optimizations 2015-04-28 12:41:39 +03:00
Dmitry Stogov
94245bc14c Refactored using specialized opcodes 2015-04-27 12:24:39 +03:00
Nikita Popov
03d7042d5c Don't issue FETCH_CLASS for anon classes 2015-04-26 15:44:48 +02:00
krakjoe
49608e0608 Rebase Joe's anon classes implementation 2015-04-26 15:04:22 +02:00
Dmitry Stogov
000d5d7ec9 Dont't use DO_ICALL for internal functions returned by reference 2015-04-24 00:34:11 +03:00
Dmitry Stogov
49cf7c5d12 Don't propogate "fake" EX(called_scope) and EX(This) into each internal function.
They need quite seldom and it's cheaper to get them from corresponfing upper stack frame.
2015-04-23 12:16:37 +03:00
Dmitry Stogov
6d4da2db8a Make internal non-static methods to be executed in context of class. Set EG(scope) accordingly. 2015-04-23 03:41:50 +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
Nikita Popov
62aabf5d9f Fix "invalid opcode" error
Method call can happen on CONST, it'll just throw an error.

Not forbidding this at compile-time, so this can be overridden in
an extension.
2015-04-22 17:46:25 +02:00
Xinchen Hui
1c3b99c4ff Throw exception will override EX(opline) 2015-04-20 11:58:23 +08:00
Xinchen Hui
a819404e9e Refix opline usage 2015-04-20 10:53:58 +08:00
Bob Weinand
b1bd6f502f Properly define ZEND_OP_DATA in zend_vm_def.h
This allows zend_vm_gen.php to define them in zend_vm_opcodes.{c,h} without further hacks.
2015-04-19 23:21:57 +02:00
Nikita Popov
9f0f93b00f Fix CALL_TRAMPOLINE without global regs
The opline needs to be loaded here in any case. However
LOAD_OPLINE() is a no-op if global VM registers are not used.
2015-04-18 15:44:04 +02:00
Nikita Popov
38da85f313 Initialize VAR_FLAGS for generators 2015-04-17 21:51:49 +02:00
Dmitry Stogov
a759967dd1 Mark call frames to closures with ZEND_CALL_CLOSURE flag to avoid expensive check at zend_leave_helper() 2015-04-16 12:16:03 +03:00
Bob Weinand
7c2fbdf58d Remove some redundant exception checking/continuing VM instructions 2015-04-15 22:18:05 +02:00
Bob Weinand
3dcad2eea2 Fix bug #69458 2015-04-15 21:56:11 +02:00
Bob Weinand
27033f9818 Forgot to transform some errors to engine exceptions 2015-04-15 21:42:26 +02:00
Dmitry Stogov
d5d2032898 eliminate unnecessary EX(opline) <-> opline reloading 2015-04-15 20:53:27 +03:00
Dmitry Stogov
6aee1ee4a1 Optimization of stack-frame construction 2015-04-15 17:02:21 +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
Nikita Popov
ed7e6d4758 Merge branch 'PHP-5.5' into PHP-5.6 2015-04-14 16:36:36 +02:00
Nikita Popov
95650d0942 Fixed bug #69419 2015-04-14 16:35:23 +02:00
Dmitry Stogov
0d18aa8610 Use Z_TYPE_INFO_P() instead Z_TYPE_P() when we check for few scalar types. This allow C compiler to generate the better code. 2015-04-14 13:09:31 +03:00
Dmitry Stogov
5e8133f453 Squashed commit of the following:
commit 2399fc84c5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:38:08 2015 +0300

    Removed useless assignment

commit 796b633817
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 12:35:31 2015 +0300

    Fixed execution with overriden zend_execute_ex()

commit 4a9fb125aa
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 02:02:58 2015 +0300

    Fixed executor without global registers

commit d456c30e00
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 01:30:35 2015 +0300

    Restored original behavior for tests/classes/__call_004.phpt

commit 479646d37f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:32:17 2015 +0300

    Fixed test. We don't keep stack frame for fake function anymore.

commit 9ae61e33e2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:30:09 2015 +0300

    Use ZEND_ACC_CALL_VIA_TRAMPOLINE instead of ZEND_ACC_CALL_VIA_HANDLER. Keep ZEND_ACC_CALL_VIA_HANDLER for compatibility.

commit 0a8403a2a0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Apr 10 00:05:43 2015 +0300

    Rename PROXY_CALL into CALL_TRAMPLINE.
    Generalize API to allow reuse EG(trampline) for other purposes.

commit 4ea0525c10
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 23:22:25 2015 +0300

    Reuse EG(proxy_call_op) for all proxy. Move proxy related functions from zend_objects_API to zend_object_handlers.

commit 529bf737ca
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 21:42:23 2015 +0300

    Accurate use of proxy_call

commit 5d62837d5b
Merge: 83e749f 690843f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:40:00 2015 +0300

    Merge branch 'master' into opcodefy-call

    * master:
      Fixed GOTO executor
      Fixed typo
      Changed ArrayIterator implementation using zend_hash_iterator_... API. Allowed modification of itterated ArrayObject using the same behavior as proposed in `Fix "foreach" behavior`. Removed "Array was modified outside object and internal position is no longer valid" hack.

commit 83e749ff3b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 19:39:10 2015 +0300

    Improved ZEND_PROXY_CALL

commit 0c829afc53
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 15:14:49 2015 +0300

    Reverted white-space changes

commit df65144488
Merge: 5fd2f97 97756d9
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Apr 9 14:37:07 2015 +0300

    Merge branch 'opcodefy-call' of github.com:laruence/php-src into opcodefy-call

    * 'opcodefy-call' of github.com:laruence/php-src:
      Ready for PR
      Fixed static call
      Improve performance by using prealloated op_arrray
      Respect called_scope
      Support internal magical __call/__callStatic
      opcode-fy magical __callStatic
      Opcode-fy magical __call

commit 97756d9190
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:07:59 2015 +0800

    Ready for PR

commit 74f9930846
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 19:03:00 2015 +0800

    Fixed static call

commit ec1d9eb592
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 18:23:17 2015 +0800

    Improve performance by using prealloated op_arrray

commit df7fbbf949
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 15:10:02 2015 +0800

    Respect called_scope

commit 769d1d59fb
Author: Xinchen Hui <laruence@gmail.com>
Date:   Thu Apr 9 12:19:23 2015 +0800

    Support internal magical __call/__callStatic

commit a980fedd5b
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 18:35:41 2015 +0800

    opcode-fy magical __callStatic

commit 73855f7d53
Author: Xinchen Hui <laruence@gmail.com>
Date:   Wed Apr 8 14:21:55 2015 +0800

    Opcode-fy magical __call
2015-04-10 23:01:00 +03:00
Dmitry Stogov
a62896783f Removed wrong error messages 2015-04-06 18:10:45 +03:00
Dmitry Stogov
9e2c14c121 Fixed error messages 2015-04-06 17:24:32 +03:00
Dmitry Stogov
cae0147ed3 Fixed weird operators behavior. Division by zero now emits warning and returns +/-INF, modulo by zero and intdid() throws an exception, shifts by negative offset throw exceptions. Compile-time evaluation of division by zero is disabled. 2015-04-06 14:30:05 +03:00
Nikita Popov
86906d6a7b Fix typo 2015-04-04 10:38:00 +02:00
Dmitry Stogov
dcaa79546b Don't relay on reference-counter when parameter expected to be a reference, but value given. 2015-04-03 16:35:06 +03:00
Xinchen Hui
75551c3f59 Unused var 2015-04-03 15:55:39 +08:00
Dmitry Stogov
adcf0c6052 Improved reference counting 2015-04-03 01:32:20 +03:00
Dmitry Stogov
bf259db82e Recalssify some E_ERROR into E_CORE_ERROR 2015-04-02 13:07:17 +03:00
Dmitry Stogov
53d20140fb Fixed performance degradation introduced with lateast EnfineException related changes.
Restore original errors order in executor.
2015-04-02 03:56:42 +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
ec760d8fff Convert fatal errors into EngineExceptions 2015-04-01 20:01:57 +03:00
Dmitry Stogov
0cad725886 Convert fatal errors into EngineExceptions 2015-04-01 15:54:03 +03:00
Dmitry Stogov
4fd93a4da6 Converted fatal errors into EngineExceptions 2015-04-01 14:50:09 +03:00
Nikita Popov
085774997b Drop support for static calls from incompatible context
Implemented by NULLing $this.
2015-04-01 11:42:05 +02: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
4796e0242b Merge branch 'InternalClassClean'
* InternalClassClean:
  Fixed test
  Patch improvement:
  Fixed indentation. Fixed comment style. Fixed commented out code.
  Reverted change to function name and added note of why it is different from the class it is actually changing.
  Made UConverter throw an exception if the constructor fails.
  Fixed PDO constructor to not return null.
  Fixed fileinfo behaviour.
  Made Phar throw exception on bad constructor.
  Converted intl extension to use IntlException in constructors.
  Fixed SplFixedArray and tests.
  Fixed ReflectionExtension and ReflectionProperty.
  Fixed ReflectionFunction, ReflectionMethod and ReflectionParameter.
  Fixed PDORow behaviour and message.
2015-04-01 12:11:13 +03:00
Dmitry Stogov
2bf8f29d16 Converted most object handlers fatal errors into EngineExceptions 2015-04-01 00:37:59 +03:00
Dmitry Stogov
685ab95add Convert fatal errors on improper access to static properties into EngineExceptions 2015-03-31 16:35:27 +03:00
Dmitry Stogov
1018f462d8 Patch improvement:
Removed the corresponding core code.
Fixed ext/com_dotnet and ext/date.
Refactored ext/intl changes.
Improved ext/fileinfo and ext/pdo changes.
Fixed tests.
2015-03-30 18:53:38 +03:00
Dmitry Stogov
550b07ae1b cleanup 2015-03-25 01:57:05 +03:00
Dmitry Stogov
23c33b1483 Optimized strings concatenation.
ZEND_ADD_STRING/VAR/CHAR are replaced with ZEND_ROPE_INTI, ZEND_ROPE_ADD, ZEND_ROPE_END.
Instead of reallocation and copying string on each ZEND_ADD_STRING/VAR/CAHR, collect all the strings and then allocate and construct the resulting string once.
2015-03-24 22:47:21 +03:00
Nikita Popov
d659ee24ab Fix VERIFY_RETURN separation
a) The SAME_FAKE_TYPE check should always occur on the dereferenced
value, otherwise we'll end up separating large referenced arrays.
b) For by-val return with an rc=1 reference, the SEPARATE_ZVAL
wouldn't do anything. Add a ZVAL_UNREF for this case.

I don't like this fix - there must be some better way to express
this.
2015-03-24 10:51:28 +01:00
Dmitry Stogov
e1ab2cfe1c Introduce ZEND_ASSUME() macro to help optimizing code.
Reuse ZEND_ASSERT() conditions for optimization.
2015-03-24 12:21:06 +03:00
Dmitry Stogov
1f408af03c Fixed in-place modification of IS_CONST operand 2015-03-21 00:22:25 +03: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
1cfa4db338 Fixed return type hint handling for constants 2015-03-20 18:36:43 +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
Anthony Ferrara
2e4401512f Reduce the number of times that the zval needs to be separated in return type checking to those that are necessary 2015-03-19 17:47:43 -04:00
Anthony Ferrara
7044f9c6df Refactor as to not use call info, but add the flag to the op_array. 2015-03-19 13:30:11 -04:00
Anthony Ferrara
0ef80ac351 Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come 2015-03-19 12:26:34 -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
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
d22bfb8aa6 Merge in master, fix merge conflicts and update patch to support exceptions everywhere 2015-03-18 10:50:11 -04:00
Xinchen Hui
5c6db3b0f2 Better make this be consistent with DO_ICALL/DO_CALL
Revert "Use more specific op type"
This reverts commit 9b07ed6dcc.
2015-03-18 22:09:57 +08:00
Xinchen Hui
9b07ed6dcc Use more specific op type 2015-03-18 20:56:28 +08:00
Dmitry Stogov
4e11095438 Reimplemented special constant handling. Now __HALT_COMPILER_OFFSET__ is resolved at compile-time. __CLASS__ retrived using separate ZEND_FETCH_CLASS_NAME opcode. 2015-03-18 15:33:56 +03:00
Nikita Popov
5c230baf75 Implement Generator::getReturn()
Conflicts:
	Zend/zend_vm_execute.h
2015-03-17 21:51:53 +01: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
5c68836b0b improved timeout handling on windows 2015-03-16 17:49:43 +01:00
Dmitry Stogov
0a6ab089cd Use memcmp() instead of strncmp() 2015-03-16 15:53:54 +03:00
Dmitry Stogov
db10b72523 Use fastcall calling convention for most critical ZE subsystems. 2015-03-13 21:10:09 +03:00
Dmitry Stogov
2b42d71908 Changed HashTable layout:
Removed HashTable->arHash (reduced memory consumption). Now hash slots may be accessed using HT_HASH() macro.
Hash slotas are allocated together with Buckets (before them) and lay in reverse order from HashTable->arData base address (see comments in Zend/zend_types.h)
Indexes in hash table and conflict resolution chains (Z_NEXT) may be stored as indeces or offsets in bytes, depending on system (32 or 64-bit).
HashTable data filelds are reordered to keep the most useful for zend_hash_find() data in the same CPU cache line.
2015-03-13 17:13:19 +03:00
Dmitry Stogov
ae26a51f0f Added API function to call VM opcode handler in a portable way 2015-03-13 11:29:43 +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
Xinchen Hui
80274290b7 Comment out for now 2015-03-11 16:54:51 +08:00
Xinchen Hui
37901aa467 Fixed memleak 2015-03-11 13:42:39 +08:00
Xinchen Hui
75c0f63739 Fixed memory leak 2015-03-11 10:33:43 +08:00
Dmitry Stogov
ed9c8a23ba More accurate reference counting on closures 2015-03-10 23:04:41 +03:00
Nikita Popov
00985a975d Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-03-10 18:26:09 +01:00
Nikita Popov
49bd45a2c1 Merge branch 'PHP-5.5' into PHP-5.6 2015-03-10 18:19:27 +01:00
Nikita Popov
bc9f2fb8df Fixed bug #69212 2015-03-10 18:17:56 +01:00
Anatol Belski
61406a527f C89 compat 2015-03-10 12:11:52 +01:00
Dmitry Stogov
fad8fe94a8 Fixed access on uninitialized data in Zend/tests/closure_019.phpt 2015-03-10 14:05:14 +03:00
Xinchen Hui
0714e027d0 Merge branch 'PHP-5.6' 2015-03-10 17:24:29 +08:00
Xinchen Hui
25050e3b00 Merge branch 'PHP-5.5' into PHP-5.6 2015-03-10 17:18:47 +08:00
Xinchen Hui
f074870f4e Typo 2015-03-10 17:18:39 +08:00
Xinchen Hui
d4c1dca98c Merge branch 'master' of https://git.php.net/repository/php-src 2015-03-10 17:09:41 +08:00
Xinchen Hui
a5317e9d41 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-03-10 15:49:02 +08:00
Xinchen Hui
abb09693ac Merge branch 'PHP-5.5' into PHP-5.6 2015-03-10 15:37:14 +08:00
Xinchen Hui
6a6c273893 Fixed bug #66609 (php crashes with __get() and ++ operator in some cases) 2015-03-10 15:36:42 +08: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
Xinchen Hui
5aebdc98de Fixed bug #69201 (Memory leak using iterator and get by reference on PHP 7) 2015-03-08 20:22:02 +08:00
Bob Weinand
b4a142ab97 Added yield from operator 2015-03-07 00:28:12 +01:00
Xinchen Hui
c16dcd3a8e Fixed segfault 2015-03-04 17:17:48 +08:00
Dmitry Stogov
2fa8d67a5c Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse. 2015-03-04 02:05:28 +03:00
Dmitry Stogov
b4e9da22d7 Microoptimization (avoid reloading from memory) 2015-03-03 16:51:27 +03:00
Dmitry Stogov
9a20323e19 Improved assert() according to expectations RFC.
See https://wiki.php.net/rfc/expectations

Squashed commit of the following:

commit 3f3651a787
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Mar 2 11:56:33 2015 +0300

    opcode 137 is used for ZEND_OP_DATA and con't be reused for ZEND_ASSERT_CHECK

commit ca8ecabf2a
Merge: 24328ac 9dac923
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Mar 2 10:49:23 2015 +0300

    Merge branch 'master' into assert

    * master:
      Update NEWS
      Fixed bug #69139 (Crash in gc_zval_possible_root on unserialize)
      windows only test
      Align entries format
      Align entries format for 5.6.7
      Align entries format for 5.5.23
      Bump header year
      Fixed bug #69144 (strtr not replacing with partly matching replace pairs)
      Fixed test?
      Revert mktime()/gmmktime()'s arginfo
      Update NEWS
      Fixed bug #69141 Missing arguments in reflection info for some builtin functions
      Add NEWS entry
      Remove useless date warning
      Fix ARG_INFO for levenshtein
      Fix ARG_INFO for levenshtein
      fix dir separator in tests
      Update NEWS
      Fixed bug #69085 (SoapClient's __call() type confusion through unserialize()).

commit 24328ac03f
Merge: 021fd94 1cdee9a
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Feb 27 15:57:13 2015 +0300

    Merge branch 'master' into assert

    * master:
      Fixed C++ support
      Fixed bug #69115 crash in mail
      Reorder
      Update NEWs
      Fixed bug #69121 (Segfault in get_current_user when script owner is not in passwd with ZTS build)
      Update News
      Fixed bug #69125 (Array numeric string as key)
      fix bug#68942's patch
      Fixed ability to build unspecialized executor
      Fixed bug #69124 (method name could not be used when by ref)
      Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
      Fixed a bug that header value is not terminated by '\0' when accessed through getenv().

commit 021fd94ed1
Merge: 49963eb ace1f82
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Feb 26 11:26:03 2015 +0300

    Merge branch 'master' into assert

    * master: (59 commits)
      Improved ASSIGN_DIM handler
      Don't inline slow path
      Revert a part committted by mistake
      Fixed compilation warnings
      Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
      better name
      Improve fix for #69038
      Update NEWs
      Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage)
      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)
      Use cache_slot offsets instead of indexes (simplify run-time instructions)
      Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV)
      Support list($a, $b) = $a
      Avoid unnecassary check
      Make zend_array_destroy() to free the corresponding zend_array
      Eliminate check on the fast path
      Make current() and key() receive argument by value.
      Use Firebird default home folder, replace Interbase with Firebird
      Updated NEWS
      updated NEWS
      ...

    Conflicts:
    	Zend/zend_vm_execute.h
    	Zend/zend_vm_opcodes.c
    	Zend/zend_vm_opcodes.h

commit 49963ebf9d
Merge: 07b1f92 6b77959
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Feb 19 11:13:08 2015 +0300

    Merge branch 'master' into assert

    * master:
      Implemented AST pretty-printer
      update NEWS to match the actual stuff in 5.6.6
      update NEWS to match the actual stuff in 5.5.22
      update NEWS(add missing entry for the enchant fix, and reorder the entries a bit)
      fix typo in bug#
      update NEWS
      fix email format
      update NEWS
      update 5.6.6 release date in NEWS
      Fix bug #69033 (Request may get env. variables from previous requests if PHP works as FastCGI)
      BFN
      fix test
      fix test
      fix test
      Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
      Updated NEWS
      add CVE
      5.4.39 next
      Fix associativity to match Perl
      Blast off to space.

    Conflicts:
    	Zend/zend_ast.c

commit 07b1f92ed6
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 23:06:32 2015 +0300

    fixed pretty-printer (support for "elseif")

commit 5a976c8d85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 19:50:08 2015 +0300

    Fixed vaeious ptetty-printer issues

commit 69491e8e8e
Merge: 8473157 3ddc246
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 10:18:32 2015 +0300

    Merge branch 'master' into assert

    * master:
      Set PHP_JSON_VERSION to 1.4.0
      Remove unnecessary resource checks in openssl ext
      JSON is now maintained

commit 8473157fbb
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 10:17:26 2015 +0300

    Fixed typo and white spaces

commit 96de5ffc8d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 00:28:39 2015 +0300

    Fixed assert() in namesapaces

commit 5eba069c28
Merge: 4a2d9c0 d428bf2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Feb 17 22:45:55 2015 +0300

    Merge branch 'master' into assert

    * master: (25 commits)
      improve debugability in TS debug builds
      More UPGRADING, in particular on foreach
      Fixed bug #69038 (switch(SOMECONSTANT) misbehaves) for master
      Replace var is introduced
      abstain from using xmlCleanupParser
      fix TS build
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      update news
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      Port for for bug #68552
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      Update NEWS
      Fixed bug #69038 (switch(SOMECONSTANT) misbehaves)
      - BFN
      Don't read the local php.ini when Generating Phar When building phar shared, you can end up loading a previous phar.so that isn't compatible with the php cli being used to generate Phar here.
      - Fixed bug #67827 (broken detection of system crypt sha256/sha512 support)
      Delete json outdated package.xml
      made ZEND_TSRMLS_CACHE_* macros look like function calls
      - Fix merge
      - Fixed bug #67427 (SoapServer cannot handle large messages) patch by: brandt at docoloc dot de
      ...

commit 4a2d9c0953
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Feb 17 22:45:10 2015 +0300

    Implemented AST pretty-printer to capture expression passed to assert()

commit 7a059b66d5
Merge: 9973df7 3892eba
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Feb 16 18:42:28 2015 +0300

    Merge branch 'expect' of github.com:krakjoe/php-src into assert

    * 'expect' of github.com:krakjoe/php-src:
      import expect

    Conflicts:
    	Zend/zend_compile.c
    	Zend/zend_execute_API.c
    	Zend/zend_globals.h
    	Zend/zend_vm_def.h
    	Zend/zend_vm_execute.h
    	Zend/zend_vm_opcodes.c
    	Zend/zend_vm_opcodes.h
    	ext/opcache/Optimizer/block_pass.c
    	ext/opcache/Optimizer/pass1_5.c
    	ext/standard/assert.c
    	ext/standard/tests/assert/assert_error3.phpt

commit 3892eba2bf
Author: krakjoe <joe.watkins@live.co.uk>
Date:   Sun Feb 2 12:49:35 2014 +0000

    import expect
2015-03-02 12:25:40 +03:00
Nikita Popov
fcdb6e0811 WIP 2015-02-28 21:20:37 +01:00
Dmitry Stogov
2bb9a59175 Fixed ability to build unspecialized executor 2015-02-26 17:53:03 +03:00
Bob Weinand
4b861bde47 Fixed bug #69124 (method name could not be used when by ref) 2015-02-26 14:21:48 +01:00
Dmitry Stogov
ace1f82e9c Improved ASSIGN_DIM handler 2015-02-26 02:49:19 +03:00
Dmitry Stogov
803e1432c8 Revert a part committted by mistake 2015-02-25 23:23:10 +03: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
dcb96c2e03 Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV) 2015-02-24 22:29:47 +03:00
Dmitry Stogov
26be614400 Eliminate check on the fast path 2015-02-24 18:34:15 +03:00
Nikita Popov
79f26e9ca5 Implement Generator::getReturn() 2015-02-19 20:25:49 +01:00