Commit Graph

33 Commits

Author SHA1 Message Date
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
Stanislav Malyshev
3551083c2c Merge branch 'pull-request/1007'
* pull-request/1007:
  Fix associativity to match Perl
  Blast off to space.
2015-02-18 08:48:17 +01: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
Andrea Faulds
797dee59cd Blast off to space. 2015-01-29 17:56:09 +00: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
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Nikita Popov
0f815642e0 Drop ZEND_PRINT opcode in favor of ZEND_ECHO
The return value long(1) is an IS_CONST operand now.
2014-12-18 14:39:40 +01:00
Dmitry Stogov
7c7b9184b1 Fixed list() behavior inconsistency (string handling is disabled for all cases, ArrayAccess objects handling is enabled for all cases, ZEND_FETCH_DIM_TMP_VAR opcode is renamed into ZEND_FETCH_LIST, ZEND_FETCH_ADD_LOCK flag is removed). 2014-10-05 13:02:58 +04:00
Nikita Popov
67a11b61cd Drop unused INIT_STRING opcode
INIT_STRING has been implemented as an UNUSED op1 to ADD_* for
some time now.
2014-09-29 22:59:57 +02:00
Nikita Popov
290d71de75 Drop unused RAISE_ABSTRACT_ERROR opcode
Abstract methods are being prevented from being called in DO_FCALL
etc.
2014-09-29 22:50:56 +02:00
Andrea Faulds
2d069f640e Merge branch 'coalesce_operator'
* coalesce_operator:
  Extended coalesce operator test case for ordering/short-circuiting
  Ensure not evaluated twice
  Added test
  Initial coalesce operator implementation
2014-09-28 00:07:04 +01:00
Dmitry Stogov
06103d65b1 Use zval_ptr_dtor_nogc() to free IS_TMP_VAR operands.
Removed ZEND_SWITCH_FREE opcode (ZEND_FREE used instead).
2014-09-23 17:21:29 +04:00
Nikita Popov
69e7c9d89c Initial coalesce operator implementation 2014-09-16 19:14:46 +01:00
Dmitry Stogov
82096dc151 Removed ZEND_QM_ASSIGN_VAR and ZEND_JMP_SET_VAR opcodes (in PHPNG they did exacly the same as ZEND_QM_ASSIGN and ZEND_JMP_SET) 2014-09-11 12:29:54 +04:00
Dmitry Stogov
af7cb16907 Implemented builtin instruction for strlen() 2014-07-14 15:43:11 +04:00
Dmitry Stogov
7dfb4f6b38 Implemented builtin instruction for type check functions - is_*() 2014-07-14 10:33:11 +04:00
Dmitry Stogov
6c8db864e0 Implemented builtin instruction for strlen() 2014-07-11 18:52:27 +04:00
Dmitry Stogov
de306e7088 Implement call_user_func() and call_user_func_array() using special opcodes.
In some rare cases it leads to insignificant changes in error messages.
2014-07-11 00:32:18 +04:00
Dmitry Stogov
b36aaea6ed ZEND_SEND_VAR and ZEND_SEND_VAL specialization 2014-07-08 02:13:53 +04:00
Dmitry Stogov
b7715c7e8a Refactored parameter passing mechanism.
In PHP-5.6 and below each argument passed to user function was copies on VM stack twice.
Now we always have ZEND_INIT_FCALL (or simular) opcode that pushes "call frame" on top of VM stack.
"Call frame" is actually the same zend_execute_data structure.
All the following ZEND_SEND instructions push arguments on top of the stack in a way that they directly comes into corresponding CV variables of the called frame. Extra arguments are copied at the end of stack frame (after all CV and TMP variables) on function enterance.

There are two minor incompatibilities:
1) It's not allowed to decalre functions redefining arguments e.g. "function foo($a,$a) {}".
2) func_get_arg() and func_get args() return the current value of argument and not the original value that was sent.
2014-06-30 15:43:45 +04:00
Dmitry Stogov
e499c3d259 Introduced new BIND_GLOBAL instraction instead of FETCH_W+ASSIGN_REF pair that caused a lot of useles checks 2014-06-06 15:04:30 +04:00
datibbaw
aff56f3c45 add T_POW (**) operator
Fixed recognition of the operator

Added opcode, still doing multiply instead of pow()

opcode now always returns int(42)

The right answer, but always a float

Yanked code from pow() implementation.

Should not handle negative long as exponent ourselves

Added test cases from pow()

Moved precedence higher than '~'

Added GMP operator overloading

Added ZEND_ASSIGN_POW (**=) operator.

Added pow() as a language construct.

Adjusted test cases for changed precedence.

Reduced pow() to shell function around ZEND_API pow_function()

Reduced test case to only contain edge cases
Added overloading test case

Moved unary minus above T_POW

Revert "Added pow() as a language construct."

Bad bad bad idea.

This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02.

Reverted unary minus behaviour due to previous revert.
Convert arrays to int(0)
Exponent with array as a base becomes int(0)

Rebase against master

Fixed tokenizer test case
2014-02-06 14:41:21 +01:00
Nikita Popov
2c47dfbaeb Implement argument unpacking
RFC: https://wiki.php.net/rfc/argument_unpacking
2014-01-11 12:42:08 +01:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
krakjoe
df9f2ad2e9 Merge branch 'PHP-5.6' of https://github.com/php/php-src into PHP-5.6 2013-12-22 13:17:21 +00:00
krakjoe
247ec0d81f Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  stop warnings from unused opcode map
  - BFN
2013-12-22 13:07:41 +00:00
krakjoe
b1df00a7c9 stop warnings from unused opcode map 2013-12-22 13:00:51 +00:00
Bob Weinand
129fb22b37 Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	Zend/zend_vm_opcodes.c
2013-12-22 00:55:46 +01:00
Bob Weinand
7e3af096b3 Merge branch 'PHP-5.4' into PHP-5.5
Conflicts:
	Zend/zend_vm_opcodes.c
2013-12-22 00:54:59 +01:00
Bob Weinand
97bf254385 Included new .c file in build too 2013-12-22 00:52:05 +01:00
Bob Weinand
2874eba714 Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	Zend/zend_vm_opcodes.h
2013-12-21 23:54:38 +01:00
Bob Weinand
0dd2765687 Merge branch 'PHP-5.4' into PHP-5.5
Conflicts:
	Zend/zend_vm_opcodes.h
2013-12-21 23:49:28 +01:00
Bob Weinand
61199be02f Moved to new file, killing a lot of warnings 2013-12-21 23:45:34 +01:00