mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
aff56f3c45
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
198 lines
4.5 KiB
C
198 lines
4.5 KiB
C
/*
|
|
+----------------------------------------------------------------------+
|
|
| Zend Engine |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 1998-2014 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> |
|
|
+----------------------------------------------------------------------+
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <zend.h>
|
|
|
|
const char *zend_vm_opcodes_map[168] = {
|
|
"ZEND_NOP",
|
|
"ZEND_ADD",
|
|
"ZEND_SUB",
|
|
"ZEND_MUL",
|
|
"ZEND_DIV",
|
|
"ZEND_MOD",
|
|
"ZEND_SL",
|
|
"ZEND_SR",
|
|
"ZEND_CONCAT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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",
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
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",
|
|
"ZEND_RAISE_ABSTRACT_ERROR",
|
|
"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",
|
|
"ZEND_QM_ASSIGN_VAR",
|
|
"ZEND_JMP_SET_VAR",
|
|
"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_API const char* zend_get_opcode_name(zend_uchar opcode) {
|
|
return zend_vm_opcodes_map[opcode];
|
|
}
|