Commit Graph

1116 Commits

Author SHA1 Message Date
Dmitry Stogov
d6bea5bb1e Fixed use after free on the following code
sapi/cli/php -r 'function hello(string $world) : string { var_dump(bin2hex($world)); return $world; } echo "foo" . hello(6) . "\n";'
2015-02-10 15:51:16 +00:00
Andrea Faulds
5a7ac0fade Implement per-file strictness for scalar return types 2015-02-10 15:48:09 +00:00
Andrea Faulds
6b6b2b4b7c Implement scalar return types (strict only for now) 2015-02-10 15:48:09 +00:00
Andrea Faulds
fe663cc404 Partial ZPP strictness implementation 2015-02-10 15:48:06 +00:00
Andrea Faulds
cc01e37e54 It Begins 2015-02-10 15:48:06 +00:00
Andrea Faulds
a13d13429a Refactor scalar type hints implementation per Dmitry's patch 2015-02-10 15:48:05 +00:00
Andrea Faulds
d4dd2a9baf Use new names of arg parsing functions 2015-02-10 15:48:05 +00:00
Andrea Faulds
c3c0f531a2 Scalar type hints with ZPP casting rules 2015-02-10 15:48:04 +00:00
Dmitry Stogov
f5a9cfc33a Merge branch 'internal-function-return-types' of github.com:reeze/php-src into test
* 'internal-function-return-types' of github.com:reeze/php-src:
  Add load time return type checking to match user land logic
  Add test function arguments
  Implemented internal function return types
2015-02-05 11:01:07 +03:00
Reeze Xia
bff4c47fa7 Implemented internal function return types 2015-02-05 01:04:54 +08:00
Dmitry Stogov
8b46d45a9d Simplify code and add comments 2015-02-04 17:56:14 +03:00
Levi Morrison
c8576c5a46 Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Dmitry Stogov
371dc9b6a6 Fixed bug #68896 (Changing ArrayObject value cause Segment Fault) 2015-01-26 11:25:05 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Dmitry Stogov
5a24ac8853 Improved access to object properties (cache property offset instead of pointer to property_info). 2015-01-13 11:33:00 +03:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Dmitry Stogov
ab0b15b8ff Optimized destruction of extra arguments passed to user functions.
If no refcounted arguments are passed, then destruction code is not triggered at all.
(Full rebuild required)
2014-12-26 22:34:44 +03:00
Dmitry Stogov
fd4844e079 Removed useless checks 2014-12-22 19:04:29 +03:00
Dmitry Stogov
2646f7bcb9 Don't count variadic argument in zend_func.common.num_args. This allows faster CALL/RETURN code. 2014-12-22 16:44:39 +03:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Dmitry Stogov
3893c1fc3d Fixed compilation warnings 2014-12-12 21:57:34 +03:00
Dmitry Stogov
68cfeed70f Removed unnecessary checks 2014-12-12 21:57:12 +03: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
Anatol Belski
da78550006 fix TS build and C89 compat 2014-12-10 12:23:46 +01:00
Dmitry Stogov
5b3a69c29f Improved ASSIGN_<OP>, ASSIGN_DIM and UNSET_DIM 2014-12-09 15:15:24 +03:00
Dmitry Stogov
98e81e13cf simplified code 2014-12-09 12:17:55 +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
11f7854e75 Move checks for references into slow paths. 2014-12-09 01:09:44 +03:00
Dmitry Stogov
b6c6e7960a Improved ASSIGN_DIM and ASSIGN_OBJ 2014-12-09 00:10:23 +03:00
Dmitry Stogov
db4271d332 Move checks for references into slow paths of handlers or helpers. Remove duplicate opcode handlers. 2014-12-08 18:11:14 +03:00
Dmitry Stogov
a417ebfc48 Get rid of duplicare FETCH_DIM_* handlers 2014-12-05 13:45:03 +03:00
Dmitry Stogov
5dd427eac2 Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*. 2014-12-03 16:56:09 +03:00
Dmitry Stogov
1da14c9f81 Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" into "call_kind" and VM_FRAME_... into ZEND_CALL_... 2014-11-28 10:33:03 +03:00
Dmitry Stogov
11384ba77b Pack EX(num_args) into EX(This).u2.num_args 2014-11-28 10:28:49 +03:00
Dmitry Stogov
9a36cb1a07 Get rid of EX(scope). In most cases we use EG(scope) anyway. EX(scope) was used to switch EG(scope) back after call, but it's possibleto use EX(func)->common.scope instead. 2014-11-28 10:21:18 +03:00
Dmitry Stogov
109baa0394 Fixed compilation warnings 2014-11-27 12:52:31 +03:00
Dmitry Stogov
216ef32173 Changed "finally" handling. Removed EX(fast_ret) and EX(delayed_exception). Allocate and use additional IS_TMP_VAR slot on VM stack instead. 2014-11-27 09:56:43 +03:00
Dmitry Stogov
303d73ecd2 Reimplemented silence operator (@) handling on exceptions. Now each silence region is stored in op_array->brk_cont_array. On exception ZEND_HANDLE_EXCEPTION handler traverse this array and restore original EG(error_reporting) if exception occured inside a "silence" region. 2014-11-26 22:44:58 +03:00
Anatol Belski
d36bf0e8ee fix TS build 2014-11-25 17:58:20 +01:00
Dmitry Stogov
1c569b41d5 Merge branch 'PHP-5.6'
* PHP-5.6:
  Better fix for bug #68446
2014-11-25 18:12:30 +03:00
Dmitry Stogov
e116595e63 Better fix for bug #68446 2014-11-25 18:09:08 +03:00
Dmitry Stogov
83ce1d9a78 Revert "Merge remote-tracking branch 'origin/PHP-5.6'"
This reverts commit 38229d13d1, reversing
changes made to 77f172725a.
2014-11-25 15:40:08 +03:00
Bob Weinand
aba95c2399 Revert "Fix bug #68446 (bug with constant defaults and type hints)"
This reverts commit 5ef138b0c7.
2014-11-25 12:24:29 +01:00
Dmitry Stogov
3727e26456 Improved zend_hash_clean() and added new optimized zend_symtable_clean() 2014-11-25 14:17:21 +03:00
Dmitry Stogov
85d04a48d9 Improved assignment to object property 2014-11-24 23:19:24 +03:00
Dmitry Stogov
42d33a9fc6 Reuse zend_assign_to_variable() in zend_std_write_property() 2014-11-24 20:33:27 +03:00
Bob Weinand
38229d13d1 Merge remote-tracking branch 'origin/PHP-5.6'
Conflicts:
	Zend/zend_compile.c
	Zend/zend_execute.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2014-11-23 23:50:47 +01:00
Bob Weinand
5ef138b0c7 Fix bug #68446 (bug with constant defaults and type hints) 2014-11-23 21:10:41 +01: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
Dmitry Stogov
54fa424751 Micro optimization 2014-11-17 08:36:14 +03:00