php-src/Zend/zend_vm_opcodes.c

201 lines
4.7 KiB
C
Raw Normal View History

/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
2015-01-15 23:27:30 +08:00
| Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
2013-12-22 07:52:05 +08:00
#include <stdio.h>
2013-12-22 21:00:51 +08:00
#include <zend.h>
2013-12-22 07:52:05 +08:00
2015-01-19 15:12:39 +08:00
const char *zend_vm_opcodes_map[171] = {
"ZEND_NOP",
"ZEND_ADD",
"ZEND_SUB",
"ZEND_MUL",
"ZEND_DIV",
"ZEND_MOD",
"ZEND_SL",
"ZEND_SR",
"ZEND_CONCAT",
"ZEND_BW_OR",
"ZEND_BW_AND",
"ZEND_BW_XOR",
"ZEND_BW_NOT",
"ZEND_BOOL_NOT",
"ZEND_BOOL_XOR",
"ZEND_IS_IDENTICAL",
"ZEND_IS_NOT_IDENTICAL",
"ZEND_IS_EQUAL",
"ZEND_IS_NOT_EQUAL",
"ZEND_IS_SMALLER",
"ZEND_IS_SMALLER_OR_EQUAL",
"ZEND_CAST",
"ZEND_QM_ASSIGN",
"ZEND_ASSIGN_ADD",
"ZEND_ASSIGN_SUB",
"ZEND_ASSIGN_MUL",
"ZEND_ASSIGN_DIV",
"ZEND_ASSIGN_MOD",
"ZEND_ASSIGN_SL",
"ZEND_ASSIGN_SR",
"ZEND_ASSIGN_CONCAT",
"ZEND_ASSIGN_BW_OR",
"ZEND_ASSIGN_BW_AND",
"ZEND_ASSIGN_BW_XOR",
"ZEND_PRE_INC",
"ZEND_PRE_DEC",
"ZEND_POST_INC",
"ZEND_POST_DEC",
"ZEND_ASSIGN",
"ZEND_ASSIGN_REF",
"ZEND_ECHO",
NULL,
"ZEND_JMP",
"ZEND_JMPZ",
"ZEND_JMPNZ",
"ZEND_JMPZNZ",
"ZEND_JMPZ_EX",
"ZEND_JMPNZ_EX",
"ZEND_CASE",
NULL,
"ZEND_BRK",
"ZEND_CONT",
"ZEND_BOOL",
NULL,
"ZEND_ADD_CHAR",
"ZEND_ADD_STRING",
"ZEND_ADD_VAR",
"ZEND_BEGIN_SILENCE",
"ZEND_END_SILENCE",
"ZEND_INIT_FCALL_BY_NAME",
"ZEND_DO_FCALL",
"ZEND_INIT_FCALL",
"ZEND_RETURN",
"ZEND_RECV",
"ZEND_RECV_INIT",
"ZEND_SEND_VAL",
"ZEND_SEND_VAR_EX",
"ZEND_SEND_REF",
"ZEND_NEW",
"ZEND_INIT_NS_FCALL_BY_NAME",
"ZEND_FREE",
"ZEND_INIT_ARRAY",
"ZEND_ADD_ARRAY_ELEMENT",
"ZEND_INCLUDE_OR_EVAL",
"ZEND_UNSET_VAR",
"ZEND_UNSET_DIM",
"ZEND_UNSET_OBJ",
Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach Squashed commit of the following: commit 1e41295097576dbce6c197ddb7507c07ccae3cbe 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 5406f21b11e563069d64045e599693b51c444b63 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:43 2015 +0300 Reduced alghorithms complexity commit b37f1d58d2a141b6e1d980a461ccb588d4317d2e Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:30 2015 +0300 Fixed test name commit fb2d079645829b12ed4e55a461034df6400bc430 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:05 2015 +0300 API cleanup commit 08302c0d6d1cab279b9f2129df03a057baddf2ff Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 14:20:46 2015 +0300 Make array_splice() to preserve foreach hash position commit cc4b7be41e2e2b9b0d7a3c8e98466b8886692e6e 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 5aa9712b0a30303aadfe3bdd8ae1f072ca3e6ba1 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 4c5b385ff53ae9f0b52572e98c4db801f56603b0 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 07:56:37 2015 +0300 More careful iterators update. commit 721fc9e80d2ee8f2cd79c8c3cdceffae2c72de92 Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Jan 29 21:43:28 2015 +0300 Added new test commit 15a23b1218b3e38630d677751a975907daa2cd54 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 10a3260b1f16b6075fd8140f673dfef4d5efea91 Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Jan 29 21:04:44 2015 +0300 New test commit eef80c583762d1e98d177cdbb27e3a8a6b0c4539 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Jan 28 16:52:21 2015 +0300 Fixed foreach by reference iteration over constant array commit 61e739187391661e2d541947bec25d7dcc4479f3 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Jan 28 14:59:54 2015 +0300 Fixed temporary variable re-allocation pass commit 92e90c09f085c22707ff4a59201f016f56e0ef8b 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 dd2a36a2074bbb0cb31de00b66dcf2812d6d753f 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 4638f7b91407c48710007af82a68da0007c820f2 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 18:57:12 +08:00
"ZEND_FE_RESET_R",
"ZEND_FE_FETCH_R",
"ZEND_EXIT",
"ZEND_FETCH_R",
"ZEND_FETCH_DIM_R",
"ZEND_FETCH_OBJ_R",
"ZEND_FETCH_W",
"ZEND_FETCH_DIM_W",
"ZEND_FETCH_OBJ_W",
"ZEND_FETCH_RW",
"ZEND_FETCH_DIM_RW",
"ZEND_FETCH_OBJ_RW",
"ZEND_FETCH_IS",
"ZEND_FETCH_DIM_IS",
"ZEND_FETCH_OBJ_IS",
"ZEND_FETCH_FUNC_ARG",
"ZEND_FETCH_DIM_FUNC_ARG",
"ZEND_FETCH_OBJ_FUNC_ARG",
"ZEND_FETCH_UNSET",
"ZEND_FETCH_DIM_UNSET",
"ZEND_FETCH_OBJ_UNSET",
"ZEND_FETCH_LIST",
"ZEND_FETCH_CONSTANT",
"ZEND_GOTO",
"ZEND_EXT_STMT",
"ZEND_EXT_FCALL_BEGIN",
"ZEND_EXT_FCALL_END",
"ZEND_EXT_NOP",
"ZEND_TICKS",
"ZEND_SEND_VAR_NO_REF",
"ZEND_CATCH",
"ZEND_THROW",
"ZEND_FETCH_CLASS",
"ZEND_CLONE",
"ZEND_RETURN_BY_REF",
"ZEND_INIT_METHOD_CALL",
"ZEND_INIT_STATIC_METHOD_CALL",
"ZEND_ISSET_ISEMPTY_VAR",
"ZEND_ISSET_ISEMPTY_DIM_OBJ",
"ZEND_SEND_VAL_EX",
"ZEND_SEND_VAR",
"ZEND_INIT_USER_CALL",
"ZEND_SEND_ARRAY",
"ZEND_SEND_USER",
"ZEND_STRLEN",
"ZEND_DEFINED",
"ZEND_TYPE_CHECK",
"ZEND_VERIFY_RETURN_TYPE",
Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach Squashed commit of the following: commit 1e41295097576dbce6c197ddb7507c07ccae3cbe 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 5406f21b11e563069d64045e599693b51c444b63 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:43 2015 +0300 Reduced alghorithms complexity commit b37f1d58d2a141b6e1d980a461ccb588d4317d2e Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:30 2015 +0300 Fixed test name commit fb2d079645829b12ed4e55a461034df6400bc430 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 18:08:05 2015 +0300 API cleanup commit 08302c0d6d1cab279b9f2129df03a057baddf2ff Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 14:20:46 2015 +0300 Make array_splice() to preserve foreach hash position commit cc4b7be41e2e2b9b0d7a3c8e98466b8886692e6e 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 5aa9712b0a30303aadfe3bdd8ae1f072ca3e6ba1 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 4c5b385ff53ae9f0b52572e98c4db801f56603b0 Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Jan 30 07:56:37 2015 +0300 More careful iterators update. commit 721fc9e80d2ee8f2cd79c8c3cdceffae2c72de92 Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Jan 29 21:43:28 2015 +0300 Added new test commit 15a23b1218b3e38630d677751a975907daa2cd54 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 10a3260b1f16b6075fd8140f673dfef4d5efea91 Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Jan 29 21:04:44 2015 +0300 New test commit eef80c583762d1e98d177cdbb27e3a8a6b0c4539 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Jan 28 16:52:21 2015 +0300 Fixed foreach by reference iteration over constant array commit 61e739187391661e2d541947bec25d7dcc4479f3 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Jan 28 14:59:54 2015 +0300 Fixed temporary variable re-allocation pass commit 92e90c09f085c22707ff4a59201f016f56e0ef8b 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 dd2a36a2074bbb0cb31de00b66dcf2812d6d753f 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 4638f7b91407c48710007af82a68da0007c820f2 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 18:57:12 +08:00
"ZEND_FE_RESET_RW",
"ZEND_FE_FETCH_RW",
"ZEND_FE_FREE",
"ZEND_INIT_DYNAMIC_CALL",
NULL,
NULL,
NULL,
"ZEND_PRE_INC_OBJ",
"ZEND_PRE_DEC_OBJ",
"ZEND_POST_INC_OBJ",
"ZEND_POST_DEC_OBJ",
"ZEND_ASSIGN_OBJ",
NULL,
"ZEND_INSTANCEOF",
"ZEND_DECLARE_CLASS",
"ZEND_DECLARE_INHERITED_CLASS",
"ZEND_DECLARE_FUNCTION",
NULL,
"ZEND_DECLARE_CONST",
"ZEND_ADD_INTERFACE",
"ZEND_DECLARE_INHERITED_CLASS_DELAYED",
"ZEND_VERIFY_ABSTRACT_CLASS",
"ZEND_ASSIGN_DIM",
"ZEND_ISSET_ISEMPTY_PROP_OBJ",
"ZEND_HANDLE_EXCEPTION",
"ZEND_USER_OPCODE",
NULL,
"ZEND_JMP_SET",
"ZEND_DECLARE_LAMBDA_FUNCTION",
"ZEND_ADD_TRAIT",
"ZEND_BIND_TRAITS",
"ZEND_SEPARATE",
NULL,
NULL,
"ZEND_DISCARD_EXCEPTION",
"ZEND_YIELD",
"ZEND_GENERATOR_RETURN",
"ZEND_FAST_CALL",
"ZEND_FAST_RET",
"ZEND_RECV_VARIADIC",
"ZEND_SEND_UNPACK",
"ZEND_POW",
"ZEND_ASSIGN_POW",
"ZEND_BIND_GLOBAL",
"ZEND_COALESCE",
2015-01-19 15:12:39 +08:00
"ZEND_SPACESHIP",
};
2013-12-22 21:00:51 +08:00
ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
return zend_vm_opcodes_map[opcode];
}