Commit Graph

140 Commits

Author SHA1 Message Date
Bob Weinand
c1e9bd27fe Fix zend_vm_call_opcode_handler (e.g. Generators throwing exceptions) with IP/FP registers 2015-08-26 00:25:25 +01:00
Dmitry Stogov
2482325b3d Assign CPU registers for GOTO and SWITCH executor as well 2015-08-25 02:38:06 +03:00
Dmitry Stogov
9b1570a378 Removed deprecated comments and added expectations (overloaded properties and array elements are less frequently used than regular ones) 2015-08-19 12:21:14 +03:00
Dmitry Stogov
fef086d113 Revert "Simplify ZEND_EXIT and count boolean values to it as exit status"
This reverts commit 7c003948c6.
2015-08-12 02:58:21 +03:00
Bob Weinand
7c003948c6 Simplify ZEND_EXIT and count boolean values to it as exit status 2015-08-11 22:36:47 +02:00
Dmitry Stogov
adcb1102e7 Fixed typo 2015-08-10 17:57:49 +03:00
Xinchen Hui
d0bea17d2e Improve the conditions(save one comparison) 2015-07-15 10:55:41 +08:00
Bob Weinand
82b1e22b57 Preserve return value in zend_vm_call_opcode_handler with global opline/ex registers enabled 2015-07-13 14:12:45 +02:00
Bogdan Andone
e27cbe6542 Hint label lookup table initialization branch on GOTO VM kind.
This initialization is performed only once so it shall be marked as unexpected.
2015-07-10 11:18:40 +03:00
Dmitry Stogov
301ee26568 Fixed situation, when CHECH_EXCEPTION() might change value of "opline" variable and the following "opline" useages would access elements of different opcode. That might lead to unpredictable behavior. (Only PHP-7 with GCC global register variables was affected).
CHECK_EXCEPTION() macro is removed. ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTIO() should be used instead. It's equivalent to old CHECK_EXCEPTION() + ZEND_VM_NEXT_OPCODE().
As a side effect, this also slightly improved performnce of builds with GCC >= 4.8.
2015-07-08 18:33:58 +03:00
Xinchen Hui
f70950d004 Fixed ZEND_VM_DEFINE_OP build when --without-specializer 2015-06-28 21:16:08 +08:00
Xinchen Hui
a486294e7d Unused ret 2015-06-28 19:16:00 +08:00
Dmitry Stogov
3e57e50fb0 Removed useless #ifdef 2015-06-16 17:17:49 +03:00
Dmitry Stogov
48ed660cdf Make CALL VM with FP and IP in global registers not to return anything from opcode handlers.
Set OPLINE to NULL to terminate VM loop instead.
This saves 1 CPU instruction for each opcode handler.
2015-06-16 14:11:16 +03:00
Dmitry Stogov
7f39ee7159 Delay checks for undefined CV variables after checks for fast paths. 2015-06-05 01:53:32 +03: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
Dmitry Stogov
690843fa37 Fixed GOTO executor 2015-04-09 18:18:10 +03: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
Xinchen Hui
8247f49fb2 Exposed ZEND_VM_KIND etc 2015-03-16 17:00:04 +08: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
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
Dmitry Stogov
2bb9a59175 Fixed ability to build unspecialized executor 2015-02-26 17:53:03 +03:00
Dmitry Stogov
ff86267632 Fixed compilation warnings 2015-02-25 23:20:47 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Anatol Belski
e112f6a04e second shot on removing TSRMLS_* 2014-12-14 14:07:59 +01:00
Dmitry Stogov
14e29f5146 Reduced size of zend_op on 64-bit systems.
the main idea - the smaller the zend_op structure, the lees memory traffic is required to load VM instructions during execution. The patch reduces the size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode, and applications use thousands of opoceds). This reduced the number of CPU cache misses by 12% and improved performance of real-life apps by 1-2%.

The patch affects how constants and jump targets are represented in VM during execution. Previously they were implemented as absolute 64-bit pointers. Now they are relative 32-bit offsets.

In run-time constant now should be accessed as:
  RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
  EX_CONSTANT(opline->op1) instead of opline->op1.zv

Jump targets:
  OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr

The patch doesn't change zend_op representation for 32-bit systems. They still use absolute addresses. The compile-time representation is also kept the same.
2014-12-12 10:19:41 +03:00
Dmitry Stogov
f70545678b Pass znode_op structure by value (it fits into one word) instead of pointer to structure. 2014-12-09 03:03:38 +03:00
Dmitry Stogov
b6c6e7960a Improved ASSIGN_DIM and ASSIGN_OBJ 2014-12-09 00:10:23 +03:00
Dmitry Stogov
c7f695f311 Get rid of duplicate handlers (where the code for IS_TMP_VAR and IS_VAR operands is the same) 2014-12-05 12:40:47 +03:00
Anatol Belski
e04971ce21 fix TS build 2014-12-03 19:50:02 +01:00
Dmitry Stogov
e5716d1b5a Get rid of duplicate handlers (ZEND_ADD_SPEC_TMP_TMP and ZEND_ADD_SPEC_VAR_VAR are absolutely the same). 2014-12-03 18:02:02 +03:00
Stanislav Malyshev
7daa97a383 Merge branch 'PHP-5.6'
* PHP-5.6:
  fix NEWS order
  update NEWS
  Update the VM generation script, per Bob.
  Update NEWS after rebase.
  Add BEGIN_EXTERN_C() and END_EXTERN_C() to .h files missing them.
2014-11-23 16:25:10 -08:00
Stanislav Malyshev
faee48506d Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  Update the VM generation script, per Bob.
  Update NEWS after rebase.
  Add BEGIN_EXTERN_C() and END_EXTERN_C() to .h files missing them.
2014-11-23 16:18:52 -08:00
Dmitry Stogov
c746dcd7fd Get rid of zend_free_op structure (use zval* instead).
Get rid of useless TSRMLS arguments.
2014-11-18 09:05:48 +03:00
Adam Harvey
4bb836be20 Update the VM generation script, per Bob. 2014-10-31 10:10:49 -07:00
Dmitry Stogov
bd9a234645 Replaced EG(This) and EX(object) with EX(This).
Internal functions now recieves zend_execute_data as the first argument.
2014-10-03 19:32:46 +04: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
Dmitry Stogov
2c8ac3a252 Replace IS_OP?_TMP_FREE() with more clear (OP?_TYPE == IS_TMP_VAR) 2014-09-22 12:47:10 +04:00
Dmitry Stogov
319ce224d2 LOAD_REGS() is not used anymore 2014-08-28 10:55:16 +04:00
Dmitry Stogov
f2b0370193 Use 'const' qualifier for pointrs to code used at run-time (the code must not be changed) 2014-08-28 02:44:06 +04:00
Dmitry Stogov
8ec40397cd Cleanup IS_VAR handling 2014-08-27 19:10:29 +04:00
Dmitry Stogov
2febfbab8e Micro optimization for the main interpreter loop 2014-07-17 11:18:44 +04:00
Stanislav Malyshev
c291033469 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Make sure the generator script also creates a newline at the end of file
  Add newline at end of file to prevent compilation warning
2014-07-06 22:15:35 -07:00
Lior Kaplan
716d2a3937 Make sure the generator script also creates a newline at the end of file
Similar to commit d6713f39 in master
2014-07-06 22:15:09 -07:00
Dmitry Stogov
0a77dcd4b9 Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. 2014-07-03 01:02:25 +04:00
Dmitry Stogov
f9927a6c97 Merge mainstream 'master' branch into refactoring
During merge I had to revert:
	Nikita's patch for php_splice() (it probably needs to be applyed again)
	Bob Weinand's patches related to constant expression handling (we need to review them carefully)
	I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)

Conflicts:
	Zend/zend.h
	Zend/zend_API.c
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_constants.c
	Zend/zend_exceptions.c
	Zend/zend_execute.c
	Zend/zend_execute.h
	Zend/zend_execute_API.c
	Zend/zend_hash.c
	Zend/zend_highlight.c
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_variables.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/date/php_date.c
	ext/dom/documenttype.c
	ext/hash/hash.c
	ext/iconv/iconv.c
	ext/mbstring/tests/zend_multibyte-10.phpt
	ext/mbstring/tests/zend_multibyte-11.phpt
	ext/mbstring/tests/zend_multibyte-12.phpt
	ext/mysql/php_mysql.c
	ext/mysqli/mysqli.c
	ext/mysqlnd/mysqlnd_reverse_api.c
	ext/mysqlnd/php_mysqlnd.c
	ext/opcache/ZendAccelerator.c
	ext/opcache/zend_accelerator_util_funcs.c
	ext/opcache/zend_persist.c
	ext/opcache/zend_persist_calc.c
	ext/pcre/php_pcre.c
	ext/pdo/pdo_dbh.c
	ext/pdo/pdo_stmt.c
	ext/pdo_pgsql/pgsql_driver.c
	ext/pgsql/pgsql.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/array.c
	ext/standard/basic_functions.c
	ext/standard/html.c
	ext/standard/mail.c
	ext/standard/php_array.h
	ext/standard/proc_open.c
	ext/standard/streamsfuncs.c
	ext/standard/user_filters.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_variables.c
	sapi/phpdbg/phpdbg.c
	sapi/phpdbg/phpdbg_bp.c
	sapi/phpdbg/phpdbg_frame.c
	sapi/phpdbg/phpdbg_help.c
	sapi/phpdbg/phpdbg_list.c
	sapi/phpdbg/phpdbg_print.c
	sapi/phpdbg/phpdbg_prompt.c
2014-04-26 00:32:51 +04:00
Dmitry Stogov
6976eb2919 Fixed support for unspecialized and GOTO and SWITCH executor 2014-04-17 02:12:06 +04:00
Dmitry Stogov
cea26aa2eb Tergets of ASSIGN and ASSIGN_REF don't have to be initialized 2014-04-04 15:22:41 +04:00