Commit Graph

1068 Commits

Author SHA1 Message Date
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
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
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