Commit Graph

946 Commits

Author SHA1 Message Date
Dmitry Stogov
1f432c85b0 Micro optimization 2014-11-13 17:36:08 +03:00
Xinchen Hui
84cd04fca0 A better fix(do the convertion in compile time) 2014-11-10 23:35:45 +08:00
Xinchen Hui
249e3de5da Fixed segfault in bug62500.phpt 2014-11-10 17:54:18 +08:00
Dmitry Stogov
75041379a6 Improved object property access. 2014-11-06 14:50:03 +03:00
Andrea Faulds
faa4c6155e Respect flags when fetching class by name 2014-11-04 00:15:26 +00:00
Xinchen Hui
fced6e6148 Save memory allocating 2014-10-30 16:55:40 +08:00
Xinchen Hui
af22cd665c Fixed memory leak in ZEND_JMPZ_EX (op1 and result may share same slot) 2014-10-30 16:00:08 +08:00
Dmitry Stogov
6e396961c5 Fixed "instanceof" with undefined classes 2014-10-23 14:50:57 +04:00
Dmitry Stogov
4fd435abab Embed FETCH_CLASS <string> into the following NEW 2014-10-23 11:52:34 +04:00
Dmitry Stogov
8dedd863bc Get rid of ZEND_FETCH_MAKE_REF 2014-10-22 21:45:02 +04:00
Dmitry Stogov
534d854fb2 Embed FETCH_CLASS <string> into the following INSTANCEOF 2014-10-22 17:23:43 +04:00
Dmitry Stogov
779ca61e32 Don't use opline->extended_value for FETCH_CLASS flags where it's unnecessary 2014-10-22 17:22:21 +04:00
Dmitry Stogov
36fa572aaa ZEND_RECV didn't really use opline->extended_value for FETCH_CLASS flags 2014-10-22 15:22:30 +04:00
Dmitry Stogov
fe8577efb1 Optimized ASSIGN_DIM and related opcodes 2014-10-21 19:30:43 +04:00
Dmitry Stogov
33645f4f55 micro optimization 2014-10-21 16:18:06 +04:00
Dmitry Stogov
5d9792de9a Avoid "goto" 2014-10-21 11:43:13 +04:00
Dmitry Stogov
089f496799 Moved proxy object support in ASSIGN_ADD (and family) from VM to slow paths of corresponding operators 2014-10-21 03:24:20 +04:00
Dmitry Stogov
ae127faf5b Simplification 2014-10-21 00:56:48 +04:00
Dmitry Stogov
176b8d7ca3 Micro optimizations for isset/empty 2014-10-17 00:17:13 +04:00
Dmitry Stogov
ed18d67c5e Fixed bug #68215 (Behavior of foreach has changed) 2014-10-15 17:02:54 +04:00
Nikita Popov
5d94ba6ec3 More fixes for array/object casts with temporary variables 2014-10-13 15:31:59 +02:00
Nikita Popov
e62edf2e58 Fix array/object cast of refcounted tmp var 2014-10-13 15:31:59 +02:00
Nikita Popov
2622cfc2fb Deref right value for compound assign ops
Currently we do not support IS_REFERENCE operands for most of our
*_function's (should we?), so we need to deref here.
2014-10-13 15:31:59 +02:00
Nikita Popov
b7e139a59c Fix incdec of referenced properties
I thought these SEPARATE_ZVAL_IF_NOT_REF usages were safe at first,
because incdec op supports reference variables. However this
violates the constraint that IS_TMP_VAR variables may not be
references (which is an issue if you use the result of the incdec
op).

Still need to fix the cases where read_property/write_property is
used.
2014-10-12 20:55:52 +02:00
Dmitry Stogov
af3354dc43 Improved specialisation $this variable accessed through IS_UNUSED operand must be IS_OBJECT, so we don't have to check for its type or perform dereference. 2014-10-10 16:36:12 +04:00
Dmitry Stogov
2c434470a6 Help to CPU branch predictor 2014-10-09 23:58:41 +04:00
Nikita Popov
c061c82945 Remove Z_OBJ_CLASS_NAME_P
Doesn't make much sense anymore, now that get_class_entry is
gone.
2014-10-09 20:48:27 +02:00
Nikita Popov
e5e9d8346f Remove zend_get_class_entry function 2014-10-09 14:17:30 +02:00
Nikita Popov
ee5b30fa19 Remove support for classes without class entries
get_class_entry must be non-NULL and return non-NULL.
2014-10-09 13:58:14 +02:00
Nikita Popov
e919caca86 Fix bug #68191: Broken reference across objects 2014-10-09 12:05:56 +02:00
Dmitry Stogov
fe501914f0 Micro optimization 2014-10-07 23:48:55 +04:00
Dmitry Stogov
2ea97c6f5a Improved return by reference handling 2014-10-07 22:38:37 +04:00
Dmitry Stogov
67be34ec95 Remove useless parts of EX(old_error_reporting) 2014-10-07 17:54:24 +04:00
Dmitry Stogov
33e137d409 Merged EX(frame_kind) and EX(flags) into single word 2014-10-07 17:12:12 +04:00
Nikita Popov
e24c24c108 Fix bug #68162: isset($$varname) always true 2014-10-06 20:39:00 +02:00
Nikita Popov
390900cbcb Fix isset/unset on by-ref names as well 2014-10-06 18:56:23 +02:00
Tjerk Meesters
82523c0752 Merge branch 'pr/647'
* pr/647: (33 commits)
  zend_uint -> uint32_t
  Fix nesting for *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414223)
  Add tests for calls to nested, *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414362)
  Make list of opcodes used for nesting calculation consistent   with `zend_do_convert_call_user_func()` in Zend/zend_compile.c
  Rewrite code to use ZEND_VM_JMP() instead of repeated ZEND_VM_INC_OPCODE() calls
  QA: Simplify code to find matching ZEND_DO_FCALL_BY_NAME CG(context).nested_calls is stored inside the initializer's result.num and inside the finalizer's op2.num, by comparing these we don't need to count manually, and are thus safer from future expansion with specialized opcodes e.g.
  Fix expected fatal error, now is catchable fatal
  Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
  Check for memory leaks when not using return value
  Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
  Add tests with arrays as parameters
  Handle ZEND_NEW nesting
  Also verify nesting with dynamically called static methods
  Handle ZEND_INIT_NS_FCALL_BY_NAME nesting
  QA: Refactor: Split tests a bit to make them more comprehendable
  Support nested static calls
  Handle ZEND_EXT_FCALL_END, skipping if necessary Verified with running tests with new "-e" run-tests arg: $ make test TESTS=Zend/tests/*-on-non-objects-*phpt TEST_PHP_ARGS=-e # Tests passed    :   11 (100.0%)
  Add support for PHP's 'extended information for debugger/profiler' mode
  Verify non-CV-operands also work See discussion https://github.com/php/php-src/pull/647#issuecomment-48050551
  Only allocate NULL return value if it's actually used
  ...

Conflicts:
	ext/date/tests/bug67118.phpt
2014-10-06 05:52:43 +08: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
Dmitry Stogov
2e1b8ba4b7 Moved checks and error reporting related to static methods from DO_FCALL inti INTI_FCALL* opcodes that may really deal with static methods. (In some rare cases it may lead to different order of warning messages). 2014-10-04 14:55:44 +04:00
Nikita Popov
e7623f470f Fix bug #68133 and bug #68135 2014-10-03 21:06:26 +02: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
5c63a4f72b Micro optimization for the most frequency case 2014-10-03 12:18:15 +04:00
Dmitry Stogov
8857af8494 Use inline finction for OBJ_RELEASE() macro 2014-10-01 16:35:56 +04:00
Dmitry Stogov
9f7564b12b Removed zend_execute_data->prev_nested_call. Reuse prev_execute_data instead. 2014-10-01 10:46:13 +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
Timm Friebe
0a9e207a77 zend_uint -> uint32_t 2014-09-25 21:42:19 +02:00
Timm Friebe
e83580c1f0 Merge branch 'master' into catchable-fatals/methods-on-non-objects 2014-09-25 19:45:05 +02:00
Dmitry Stogov
1833ab0230 Use macro 2014-09-25 17:00:17 +04:00
Dmitry Stogov
8b034ec69a Optimized (PRE|POST)_(INC|DEC) handlers. Moved proxy object handling into helper function. 2014-09-25 13:42:46 +04:00
Dmitry Stogov
8ea2409e44 Fixed immutable arrays support 2014-09-24 15:39:54 +04:00
Dmitry Stogov
73275a55f5 Avoid double checks 2014-09-24 12:20:46 +04:00
Dmitry Stogov
d429e87d18 Removed useless helper 2014-09-23 23:26:39 +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
826abe9d62 Specialization (only IS_VAR ad IS_CV operands may be references) 2014-09-22 16:17:35 +04:00
Dmitry Stogov
a057f060e8 Optimized unset() 2014-09-22 14:41:44 +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
Nikita Popov
98891ee118 Simplify foreach flags
* FE_RESET_VARIABLE and FE_RESET_REFERENCE were always set
   together.
 * In some places the code checked FE_FETCH_BYREF instead of
   FE_RESET_REFERENCE and relied on them having the same value.
 * Now the FE_RESET_* flags are dropped and everything uses
   FE_FETCH_BYREF
2014-09-20 12:56:05 +02:00
Nikita Popov
1027f0d978 Fix leak in foreach with by-ref iteration of ref array 2014-09-20 12:46:05 +02:00
Dmitry Stogov
bccc653185 Avoid double IS_INTERNED() check 2014-09-19 17:32:50 +04:00
Dmitry Stogov
551ee4165b Use runtime-cache to avoid hash lookups in BIND_GLOBAL instruction 2014-09-17 00:52:45 +04:00
Anatol Belski
65c401672e redo the fix with cast to size_t 2014-09-16 21:17:22 +02:00
Nikita Popov
69e7c9d89c Initial coalesce operator implementation 2014-09-16 19:14:46 +01:00
Dmitry Stogov
ca37c02520 code optimization 2014-09-16 13:52:50 +04:00
Dmitry Stogov
d17487f827 We don't have to check for undefined CV if we fetch it for isset() operation 2014-09-16 09:15:47 +04:00
Nikita Popov
079409bbc2 Switch (un)mangle property name to size_t and zend_string
Also use the _ex variants where possible.
2014-09-16 00:31:27 +02:00
Dmitry Stogov
6991780793 Optimized FE_RESET and FE_FETCH 2014-09-16 01:34:27 +04:00
Anatol Belski
ea94210e8c fix most of signed/unsigned warnings in vm def 2014-09-15 19:46:24 +02:00
Dmitry Stogov
8527657ca6 Fixed refcounting for references 2014-09-11 19:12:12 +04:00
Dmitry Stogov
b8c36e199e Simplify ASSIGN code 2014-09-11 17:00:06 +04: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
e85545eca5 Removed IS_STR_OFFSET type and corresponding macros. Optimized string offset handling in ASSIGN_DIM opcode. 2014-09-08 15:46:45 +04:00
Anatol Belski
cfa2b3bf63 fixed string index handling with references 2014-09-07 13:34:18 +02:00
Anatol Belski
acad6f4700 fix 64 bit string index usage 2014-09-07 00:55:36 +02:00
Dmitry Stogov
9a958a086d Simplify BEGIN_SILENCE/END_SILENCE to not modify ini entry value back and force 2014-09-03 15:17:50 +04:00
Dmitry Stogov
b0f0211b1a Revert "Fixed memory leaks"
This reverts commit 0940e54ffc.
2014-09-03 02:38:04 +04:00
Dmitry Stogov
0940e54ffc Fixed memory leaks 2014-09-03 02:07:38 +04:00
Dmitry Stogov
f0ad7472b0 Avoid memory allocation/deallocation in BEGIN_SILENCE/END_SILENCE opcode handlers. 2014-09-02 22:13:24 +04:00
Dmitry Stogov
88d7ca44f6 Refactored INI subsystem to use zend_string* instead of char* 2014-09-01 20:57:33 +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
b1f53ca415 Use efree_size() instead of efree() where posible 2014-08-27 20:49:56 +04:00
Dmitry Stogov
8ec40397cd Cleanup IS_VAR handling 2014-08-27 19:10:29 +04:00
Tjerk Meesters
a79b933384 Fixed corruption of execute_data when ZEND_STRLEN has to cast an object to string. 2014-08-27 23:00:11 +08:00
Nikita Popov
d2a3bf9daf Fix compiler warnings 2014-08-25 23:08:01 +02:00
Nikita Popov
899a1ed59a Merge branch 'ast'
Conflicts:
	Zend/zend_compile.c
2014-08-25 22:04:33 +02:00
Nikita Popov
6db293d5e0 Merge remote-tracking branch 'php-src/master' into ast
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_globals.h
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner.l
	Zend/zend_types.h
2014-08-25 21:52:18 +02:00
Anatol Belski
af59e92b24 master renames phase 7 2014-08-25 21:51:49 +02:00
Anatol Belski
6f9f0bf205 master renames phase 2 2014-08-25 19:28:33 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
6d54e89916 Merge remote-tracking branch 'php/master' 2014-08-20 21:29:49 +02:00
Dmitry Stogov
9507aa99fc Fixed immutable array support 2014-08-20 21:42:49 +04:00
Anatol Belski
66e7090e61 Merge remote-tracking branch 'php/master' 2014-08-20 18:19:37 +02:00
Dmitry Stogov
04aa96d28d Removed a hack that allowed passing of function return value by reference depending on value of reference-counter (Fixed Zend/tests/bug35393.phpt test failure) 2014-08-20 15:04:40 +04:00
Anatol Belski
07359785c3 Merge remote-tracking branch 'php/master' 2014-08-20 08:48:43 +02:00
Dmitry Stogov
8ea7e4e4e2 fixed memory leak 2014-08-20 10:43:37 +04:00
Anatol Belski
53a8d8e627 Merge remote-tracking branch 'php/master' 2014-08-20 00:34:17 +02:00
Dmitry Stogov
14439b79b4 Fixed referenced value separation 2014-08-20 00:00:59 +04:00
Anatol Belski
c586133d07 rename zval_get_long and fixes to some string functions 2014-08-18 08:39:39 +02:00