Peter Kokot
902d39a3a7
Trim trailing whitespace in source code files
2018-10-13 14:14:50 +02:00
Peter Kokot
03bbdf275a
Make PHP development tools files executable
...
This patch makes few remaining PHP development tools files
executable and adds a shebang to them.
The `#!/usr/bin/env php` shebang provides running the script via
`./script.php` and uses env to find PHP script location on the system.
At the same time it still provides running the script with a user
defined PHP location using `php script.php`. Shebang is not visible in
the output of the generated file.
2018-09-17 00:02:36 +02:00
Dmitry Stogov
1d36c3361f
Fixed support for commutative "user opcodes"
2018-09-05 22:11:10 +03:00
Dmitry Stogov
be805f146c
Added missing define
2018-07-30 13:29:09 +03:00
Peter Kokot
a5e80b22e1
Fix typos in code comments
2018-07-25 11:57:11 +02:00
Peter Kokot
8d3f8ca12a
Remove unused Git attributes ident
...
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.
In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.
This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
3fd97a5b1f
Better hot/cold code splitting
2018-07-03 11:07:39 +03:00
Dmitry Stogov
1597b56619
Inline few small opcode handlers into hybrid executor
2018-06-07 16:30:53 +03:00
Dmitry Stogov
59c2ff2543
Embed zend_leave_helper() into hybrid executor to avoid call overhead.
2018-06-05 11:33:19 +03:00
Dmitry Stogov
9e0f131d2b
Fixed ISSET/ISEMPTY bit meaning to simplify run-time checks
2018-05-31 19:02:51 +03:00
Dmitry Stogov
84aab1d4e1
Marked rarely used opcodes as "cold" (e.g. ADD_CONST_CONST ususaly optimized out).
2018-05-30 01:50:44 +03:00
Dmitry Stogov
e9e2d068b6
Fixed conditions
2018-05-14 17:23:37 +03:00
Dmitry Stogov
b8a91ac50b
Use "fastcall" calling convention
2018-05-08 01:31:49 +03:00
Dmitry Stogov
91ba1f2085
Remove "hot" mark from JMP(Z|NZ|ZNZ) with IS_CONST operand
2018-03-23 16:11:27 +03:00
Dmitry Stogov
e6c179834b
Allow extra specialisation for ISSET/ISEMPTY handlers
2018-03-22 13:02:49 +03:00
Dmitry Stogov
1735e29b7f
Reduce overhead of extra-specialization for opcode handler selection.
2018-03-22 11:33:17 +03:00
Dmitry Stogov
9dc6661976
Merge branch 'PHP-7.2'
...
* PHP-7.2:
Fixed user-opcode support
2018-03-14 09:41:55 +03:00
Dmitry Stogov
975d144027
Fixed user-opcode support
2018-03-14 09:41:25 +03:00
Dmitry Stogov
6fb9e24218
Allow generation of VM map
2018-02-22 15:31:00 +03:00
Dmitry Stogov
9c0427cada
Mark exceptional helpers as "cold"
2018-02-21 12:07:29 +03:00
Haitao Lv
764e231cc5
fix ZEND_VM_SET_OPCODE_HANDLER cannot set user opcode handler
2018-02-20 10:46:41 +03:00
Dmitry Stogov
050d62484b
Fixed typo
2018-02-19 17:57:46 +03:00
Dmitry Stogov
6d3e1bd124
Added VM instrumentation ability
2018-02-19 16:42:02 +03:00
Dmitry Stogov
190a970dd6
Elimintate duplicate error message
2018-02-19 16:11:28 +03:00
Nikita Popov
b0af9ac733
Avoid live range references in opcodes
...
Don't store the live range of the freed variable for FREE_ON_RETURN
frees, instead look it up at runtime. As this is an extremely
unlikely codepath (in particular, it requires a loop variable with
a throwing destructor), saving the runtime lookup of the live range
is not worth the extra complexity this adds everywhere else.
2018-02-16 21:30:48 +01:00
Dmitry Stogov
285bfb96fe
Optimize "backup" functions of inlined opcode handlers for size
2018-02-15 17:04:41 +03:00
Dmitry Stogov
3778abfc15
Added ability to manually sort opcode handlers (not used yet)
2018-02-15 15:56:38 +03:00
Dmitry Stogov
633d037ed5
Added simple VM instrumentation ability
2018-02-15 15:55:19 +03:00
Dmitry Stogov
23da83c8ca
Avoid inlining of rarely used handlers
2018-02-15 13:48:04 +03:00
Haitao Lv
5206f79987
fix unknown opcode overflow error
2018-02-12 09:27:55 +01:00
Dmitry Stogov
ca035f26aa
Moved "zval.u2.cache_slot" into free room of "zend_op"
2018-02-05 19:41:47 +03:00
Dmitry Stogov
3a794d39f0
Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement).
2018-02-05 19:40:06 +03:00
Dmitry Stogov
ba298725d1
Changed CATCH instruction format (extended_value moved into op2, op2 into result, result into extended_value)
2018-01-31 22:39:30 +03:00
Dmitry Stogov
9c7fb529ce
Changed FETCH_CONSTANT instruction format (extended_value moved into op1)
2018-01-31 18:15:25 +03:00
Dmitry Stogov
f67f455ef7
Changed FETCH_CLASS instruction format (extended_value moved into op1)
2018-01-31 18:14:43 +03:00
Dmitry Stogov
9701b644fa
Compress handlers table
2018-01-31 16:46:30 +03:00
Dmitry Stogov
17a3b48454
Make IS_UNUSED to be zero.
2018-01-31 11:18:41 +03:00
Dmitry Stogov
267b78550e
Use fastcall calling convention
2018-01-16 10:33:41 +03:00
Dmitry Stogov
c73a42ccec
Added abiliy to mark object specific handlers with most often used operand types as HOT. (UNUSED+CONST and CV+CONST)
2018-01-10 19:00:38 +03:00
Dmitry Stogov
83aa742dde
Removed unused array
2018-01-09 23:17:10 +03:00
Dmitry Stogov
09b1bfecee
Allow commas in specializer conditions
2018-01-09 15:08:18 +03:00
Xinchen Hui
a6519d0514
year++
2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49
year++
2018-01-02 12:55:14 +08:00
Dmitry Stogov
f860ae451a
fixed "unused function" compilation warning
2017-12-18 11:43:12 +03:00
Dmitry Stogov
b337b90bac
Fix warning in the proper place
2017-12-18 11:28:59 +03:00
Dmitry Stogov
588f1df7a2
Remove duplicate handlers for commutative operations
2017-12-15 13:42:54 +03:00
Dmitry Stogov
9e709e2fa0
Move constants into read-only data segment
2017-12-14 18:43:44 +03:00
Dmitry Stogov
91507ba6e8
Reduced VM code size.
...
Made FETCH_DIM/OBJ_FUNC_ARG to dispatch ro corresponding FETCH_DIM/OBJ_R/_W handlers.
Merged TMP and VAR specializations of ZEND_FETCH_OBJ_R.
Allowed dispatching to less specialized handelrs and helpers. (e.g. from OP_TMP_CONST to OP_TMPVAR_CONST).
2017-12-07 01:52:27 +03:00
Dmitry Stogov
d1d1aff4e5
Optimization of init_func_execute_data()
2017-12-06 02:53:30 +03:00
Nikita Popov
828d8e635b
Fix ZEND_VM_SPEC=0 build
2017-11-24 23:06:01 +01:00
Dmitry Stogov
33b094479b
TYPE_CHECK instruction changed. Now it keeps in extended_value a type mask.
...
This makes check for "boolean" cheaper and allows check combination e.g. (is_string($a) || is_null($a))
2017-11-23 15:58:34 +03:00
Dmitry Stogov
e70618aff6
Changed the way VM accesses constant operands in 64-bit builds.
2017-10-04 16:53:01 +03:00
Dmitry Stogov
bfa154448d
VM refactoring, to avoid passing "execute_data" into helper functions that can access it using global register variable.
2017-06-16 01:42:49 +03:00
Dmitry Stogov
fc927dc263
Switch to HYBRID VM
2017-05-17 15:07:33 +03:00
Dmitry Stogov
7640e0a5f9
HYBRID VM cleanup
2017-05-16 09:24:23 +03:00
Dmitry Stogov
69b4f8ed79
Fixed USER_OPCODE handling in HYBRID VM.
2017-05-15 21:17:58 +03:00
Xinchen Hui
e1c32646b4
typo
2017-05-09 17:15:42 +08:00
Dmitry Stogov
2f9d72b309
Cleanup
2017-05-09 09:37:46 +03:00
Dmitry Stogov
71bfb430af
Fixed zend_vm_call_opcode_handler(). Make phpdbg work with HYBRID VM.
2017-05-04 18:56:28 +03:00
Dmitry Stogov
b5e857b905
Added missing ZEND_VM_HOT define
2017-05-04 17:57:49 +03:00
Dmitry Stogov
27e01cd918
Implemented HYBRID VM instruction dispatch method that takes advantages of both CALL and GOTO VMs.
2017-05-03 10:01:22 +03:00
Sammy Kaye Powers
9e29f841ce
Update copyright headers to 2017
2017-01-02 09:30:12 -06:00
Sara Golemon
16758a3c66
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Remove extraneous parentheses in conditions
2016-12-25 22:18:27 -08:00
Sébastien Santoro
5d7c774bea
Remove extraneous parentheses in conditions
...
The zend_vm_gen.php generator now checks if the condition is already
enclosed by parentheses, and them only if needed.
This fixes nine clang/llvm parentheses-equality warnings.
2016-12-25 22:17:46 -08:00
Kalle Sommer Nielsen
cf24a61735
Disable C4101 warnings entirely on Windows
2016-12-08 03:50:31 +01:00
Bob Weinand
444d612b62
Use an inline handler instead of repeating logic for calling assign op helpers each time
2016-12-05 10:55:11 +01:00
Dmitry Stogov
22cebaf89a
Revert "Fix return value memory leaks upon exceptions in opcode operand freeing"
...
This reverts commit 9ad9d7ae37
.
2016-12-02 11:58:41 +03:00
Bob Weinand
9ad9d7ae37
Fix return value memory leaks upon exceptions in opcode operand freeing
2016-11-30 17:44:34 +01:00
Xinchen Hui
38f7d595c0
Remove redundant \t
2016-08-25 13:29:22 +08:00
Aaron Piotrowski
3f108f50f9
Merge branch 'pull-request/1929'
2016-07-05 02:29:53 -05:00
Dmitry Stogov
044e2718fe
Fixed executor without global register variales (gcc warnings or clang errors)
2016-06-27 10:36:41 +03:00
Dmitry Stogov
d0460d8f6b
Turn safe timeout handling into general interrupt handling ability.
2016-06-23 15:01:23 +03:00
Dmitry Stogov
a9512af810
Implemented RFC: Fix inconsistent behavior of $this variable
...
Squashed commit of the following:
commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jun 16 00:19:42 2016 +0300
Fixed GOTO VM
commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 21:01:57 2016 +0300
Removed unused variable
commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 19:06:16 2016 +0300
Protection from $this reassign through mb_parse_str()
commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 18:14:50 2016 +0300
Added type inference rule for FETCH_THIS opcode
commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 18:11:18 2016 +0300
Restored PHP-7 behavior of isset($this->foo).
It throws exception if not in object context.
Removed useless opcode handlers.
commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 31 12:25:47 2016 +0300
Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".
commit e32cc528c0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 02:02:43 2016 +0300
Throw exception on attempt to re-assign $this through extract() and parse_str().
commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon May 23 22:18:36 2016 +0300
Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Sammy Kaye Powers
6f10874bca
Remove a few references to $GLOBALS and clean up a bit
2016-06-01 01:57:33 -05:00
Dmitry Stogov
b111da96d9
Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags.
2016-05-31 04:06:00 +03:00
Dmitry Stogov
2ae21abdf7
Fixed bug #72213 (Finally leaks on nested exceptions).
...
Squashed commit of the following:
commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:34:42 2016 +0300
Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.
commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:04:53 2016 +0300
Move SAVE_OPLINE() to its original place
commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:01:10 2016 +0300
Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.
commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date: Tue May 24 14:55:27 2016 +0200
Improve finally fix
commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 10:36:08 2016 +0300
Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt
commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 02:59:27 2016 +0300
Added test
commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 00:38:20 2016 +0300
Added tests
commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon May 23 23:27:34 2016 +0300
Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Dmitry Stogov
34a6c93b25
Specialize ZEND_ASSIGN_ADD and family according to value of opline->extended_value
2016-05-17 11:46:25 +03:00
Dmitry Stogov
c19cb70dac
Revert "Refactor zval cleanup into single function"
...
This reverts commit bac6fdb0c5
.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5
Refactor zval cleanup into single function
...
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Dmitry Stogov
f484801483
Reduced amount of code generated for interrupt handling.
...
Improved ZEND_VM_INTERRUPT_CHECK() placement (always perform checks after opcode handler completion, when instruction pointer value is alredy changed to the next opcode).
2016-04-20 11:06:52 +03:00
Dmitry Stogov
fc7cbdce61
Squashed commit of the following:
...
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 21:56:04 2016 +0300
Fixed wrong constant usage
commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 21:10:23 2016 +0300
Added ability to serialize and serialize opcode handlers for file-cache
commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 10:11:59 2016 +0300
Added missed file
commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 10:00:45 2016 +0300
Transparently introduce type-specialized opcode handlers.
This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui
73e8c08788
Sorry for that... Merged by accident....
...
Revert "Transparently introduce type-specialized opcode handlers."
This reverts commit 59d00b8bcc
.
2016-03-17 11:59:15 +08:00
Dmitry Stogov
59d00b8bcc
Transparently introduce type-specialized opcode handlers.
...
This affects only PHP VM, and doesn't change anything else.
2016-03-16 03:36:58 +03:00
Dmitry Stogov
7f80514aa1
Added ability to avoid code generation for useless opcode handlers.
...
- SPEC(NO_CONST_CONST) may prevent codegeneration for handlers like ADD_SPEC_CONST_CONST. Compiler and optimizaer should care about constants folding.
- SPEC(COMMUTATIVE) generate only single handler instead of two eqivalents like ADD_SPEC_CONST_CV and ADD_SPEC_CV_CONST. Compiler and optimizer should care avout operands swapping.
2016-03-11 16:51:06 +03:00
Dmitry Stogov
afb80df631
Allow usage of "TMPVARCV" pattern for cases when there is no difference in handling for TMP, VAR and CV operands.
2016-03-11 13:38:53 +03:00
Dmitry Stogov
827a7a180b
Added possibility for extra specialization for SMART_BRANCH (e.g. IS_EQUAL+JMPZ superinstruction).
2016-03-11 12:17:03 +03:00
Xinchen Hui
c4ff3e7990
It's better to support 5.3 as well
2016-02-15 11:05:01 +08:00
Nikita Popov
5faedf5b3e
Remove EXT_TYPE_UNUSED in favor of IS_UNUSED
...
This means we no longer allocate an unused VAR for the retval of
instructions that support unused results.
Nearly all instructions already used the result variable only if
it was used. The only exception to this was the return value
variable for internal function call results. I've adjusted the code
to use a stack zval for the unused return case now. As we have
retval specialization now, we know that it doesn't matter.
2016-02-11 18:02:19 +01:00
Dmitry Stogov
2f5a119281
Use extra specialization to eliminate run-time checks for conditions known at compile time in SEND_VAL_EX and SEND_VAR_EX.
2016-02-05 15:07:58 +03:00
Bob Weinand
00a2c30c59
Add extra VM operand specialization
...
For now RETVAL and OP_DATA= are supported
2016-02-04 16:49:50 +01:00
Nikita Popov
9b57e07298
Consolidate op1/op2 vm flags
2016-01-21 21:15:05 +01:00
Xinchen Hui
563659822d
Merge branch 'PHP-7.0'
2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97
bump year which is missed in rev 49493a2
2016-01-02 17:56:11 +08:00
Nikita Popov
88eae43ff9
Remove uses of VARs in extended_value
...
The DECLARE_(ANON_)INHERITED_CLASS(_DELAYED) opcodes were
referencing the parent ce VAR through extended_value. This is
hacky and we can't track the def-use chain in SSA.
To avoid this, the layout of declaration opcodes is changed
as follows: op1 points to the lcname and rtd_key literals, in
that order. (For anon/lambda declarations only one of lcname or
rtd_key is present.) This frees up op2, which is now used to
reference the parent ce VAR in inheriting declarations. The
jmp offset for anon class declarations is moved frop op2 to
extended_value.
The changes were applied both to class and function declarations
to keep everything symmetric.
2015-12-21 14:44:42 +01:00
Dmitry Stogov
061a90f8d1
Describe special meaning of IS_UNUSED oprerand
2015-12-11 02:31:28 +03:00
Dmitry Stogov
dc36810993
Use more compact description encoding schema to free some bits
2015-12-11 01:45:26 +03:00
Dmitry Stogov
cba1a8498c
Improve Optimizer debugging facility (print the meaning of extended_value)
2015-12-11 00:47:02 +03:00
Bob Weinand
7ea1cf2e57
Improved specializer:
...
- Allow dispatching from specialized handler to unspecialized one
2015-12-10 20:46:14 +03:00
Dmitry Stogov
6f966fad0d
Improved specializer (Bob)
...
- All helpers now may be declatred and called without ZEND_VM_HELPER_EX() and ZEND_VM_DISPATCH_TO_HELPER_EX() macros
- ZEND_VM_HELPER() may declare few arguments
- ZEND_VM_DISPATCH_TO_HELPER() may pass few parameters
- ZEND_VM_INLINE_HELPER() may be used to declare inline helpers (it won't be inlined in SWITH/GOTO executors)
2015-12-10 17:17:59 +03:00
Dmitry Stogov
948b7f5421
Changed ZEND_FREE.op2.num and ZEND_FE_FREE.op2.num back to use live_range_offset (try_catch_offset does't work)
2015-11-11 11:12:44 +03:00