From 08567145763f25aae3882f682d41d1b50cd9e666 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 26 Aug 2013 19:06:36 +0200 Subject: Always pass return_value_ptr to internal functions Previous some places passed return_value_ptr only if the function returned by reference. Now return_value_ptr is always set, even for functions returning by-value. This allows you to return zvals without copying their contents. For this purpose two new macros RETVAL_ZVAL_FAST and RETURN_ZVAL_FAST are added: RETVAL_ZVAL_FAST(zv); /* Analog to RETVAL_ZVAL(zv, 1, 0) */ RETURN_ZVAL_FAST(zv); /* Analog to RETURN_ZVAL(zv, 1, 0) */ These macros behave similarly to the non-FAST versions with copy=1 and dtor=0, with the difference that the FAST versions will try return the zval without copying by utilizing return_value_ptr. --- UPGRADING.INTERNALS | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'UPGRADING.INTERNALS') diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 566f310998..7cb5539fc1 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,7 @@ UPGRADE NOTES - PHP X.Y 1. Internal API changes a. Addition of do_operation and compare object handlers + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros 2. Build system changes a. Unix build system changes @@ -43,6 +44,20 @@ UPGRADE NOTES - PHP X.Y Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros + + The return_value_ptr argument to internal functions is now always set. + Previously it was only available for functions returning by-reference. + return_value_ptr can now be used to return zvals without copying them. + For this purpose two new macros are provided: + + RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */ + RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */ + + The macros behave similarly to the non-FAST variants with copy=1 and + dtor=0, but will try to return the zval without making a copy by utilizing + return_value_ptr. + ======================== 2. Build system changes ======================== -- cgit v1.2.1