diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-10-17 15:52:50 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-10-17 15:52:50 +0300 |
commit | d57cd36e47b627dee5b825760163f8e62e23ab28 (patch) | |
tree | 250b3c1176663a2030d68f20a5f485e44aacf71d /Zend/zend_map_ptr.h | |
parent | ad6738e886cbeb69dcd440ecc88727feaaccbe78 (diff) | |
download | php-git-d57cd36e47b627dee5b825760163f8e62e23ab28.tar.gz |
Immutable clases and op_arrays.
Squashed commit of the following:
commit cd0c36c3f943849e5b97a8dbe2dd029fbeab3df9
Merge: 4740dabb84 ad6738e886
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 14:43:38 2018 +0300
Merge branch 'master' into immutable
* master:
Remove the "auto" encoding
Fixed bug #77025
Add vtbls for EUC-TW encoding
commit 4740dabb843c6d4f7f866b4a2456073c9eaf4c77
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 14:12:28 2018 +0300
Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes.
commit ad7a78b253be970db70c2251e66f9297d8e7f829
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:46:30 2018 +0300
Added comment
commit 0276ea51875bab37be01a4dc5e5a047c5698c571
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:42:43 2018 +0300
Added type cast
commit c63fc5d5f19c58498108d1698055b2b442227eb3
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:36:51 2018 +0300
Moved static class members initialization into the proper place.
commit b945548e9306b1826c881918858b5e5aa3eb3002
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:21:03 2018 +0300
Removed redundand assertion
commit d5a41088401814c829847db212488f8aae39bcd2
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:19:13 2018 +0300
Removed duplicate code
commit 8dadca8864e66de70a24bdf1181bcf7dd8fb27d7
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 11:05:43 2018 +0300
Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros.
commit 9ef07c88bd76801e2d4fbfeab3ebfd6e6a67ac5f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 10:48:29 2018 +0300
typo
commit a06f0f3d3aba53e766046221ee44fb9720389ecc
Merge: 94099586ec 3412345ffe
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Oct 17 10:47:07 2018 +0300
Merge branch 'master' into immutable
* master:
Remove unused variable makefile_am_files
Classify object handlers are required/optional
Add support for getting SKIP_TAGSTART and SKIP_WHITE options
Remove some obsolete config_vars.mk occurrences
Remove bsd_converted from .gitignore
Remove configuration parser and scanners ignores
Remove obsolete buildconf.stamp from .gitignore
[ci skip] Add magicdata.patch exception to .gitignore
Remove outdated ext/spl/examples items from .gitignore
Remove unused test.inc in ext/iconv/tests
commit 94099586ec599117581ca01c15b1f6c5f749e23a
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Oct 15 23:34:01 2018 +0300
Immutable clases and op_arrays
Diffstat (limited to 'Zend/zend_map_ptr.h')
-rw-r--r-- | Zend/zend_map_ptr.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/Zend/zend_map_ptr.h b/Zend/zend_map_ptr.h new file mode 100644 index 0000000000..88872ab1fe --- /dev/null +++ b/Zend/zend_map_ptr.h @@ -0,0 +1,95 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2018 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Dmitry Stogov <dmitry@zend.com> | + +----------------------------------------------------------------------+ +*/ + +#ifndef ZEND_MAP_PTR_H +#define ZEND_MAP_PTR_H + +#include "zend_portability.h" + +#define ZEND_MAP_PTR_KIND_PTR 0 +#define ZEND_MAP_PTR_KIND_PTR_OR_OFFSET 1 + +//#if defined(ZTS) || defined(TSRM_WIN32) +# define ZEND_MAP_PTR_KIND ZEND_MAP_PTR_KIND_PTR_OR_OFFSET +//#else +//# define ZEND_MAP_PTR_KIND ZEND_MAP_PTR_KIND_PTR +//#endif + +#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR +# define ZEND_MAP_PTR(ptr) \ + ptr ## __ptr +# define ZEND_MAP_PTR_DEF(type, name) \ + type * ZEND_MAP_PTR(name) +# define ZEND_MAP_PTR_GET(ptr) \ + (*(ZEND_MAP_PTR(ptr))) +# define ZEND_MAP_PTR_SET(ptr, val) do { \ + (*(ZEND_MAP_PTR(ptr))) = (val); \ + } while (0) +# define ZEND_MAP_PTR_INIT(ptr, val) do { \ + ZEND_MAP_PTR(ptr) = (val); \ + } while (0) +# define ZEND_MAP_PTR_NEW(ptr) do { \ + ZEND_MAP_PTR(ptr) = zend_map_ptr_new(); \ + } while (0) +#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET +# define ZEND_MAP_PTR(ptr) \ + ptr ## __ptr +# define ZEND_MAP_PTR_DEF(type, name) \ + type * ZEND_MAP_PTR(name) +# define ZEND_MAP_PTR_IS_OFFSET(ptr) \ + (((uintptr_t)ZEND_MAP_PTR(ptr)) & 1L) +# define ZEND_MAP_PTR_OFFSET2PTR(ptr) \ + ((void**)((char*)CG(map_ptr_base) + (uintptr_t)ZEND_MAP_PTR(ptr) - 1)) +# define ZEND_MAP_PTR_PTR2OFFSET(ptr) \ + ((void*)((uintptr_t)(((char*)(ptr)) - ((char*)CG(map_ptr_base))) | 1L)) +# define ZEND_MAP_PTR_GET(ptr) \ + (ZEND_MAP_PTR_IS_OFFSET(ptr) ? \ + *(ZEND_MAP_PTR_OFFSET2PTR(ptr)) : \ + (void*)(*(ZEND_MAP_PTR(ptr)))) +# define ZEND_MAP_PTR_SET(ptr, val) do { \ + if (ZEND_MAP_PTR_IS_OFFSET(ptr)) { \ + *(ZEND_MAP_PTR_OFFSET2PTR(ptr)) = (val); \ + } else { \ + *(ZEND_MAP_PTR(ptr)) = (val); \ + } \ + } while (0) +# define ZEND_MAP_PTR_INIT(ptr, val) do { \ + ZEND_MAP_PTR(ptr) = (val); \ + } while (0) +# define ZEND_MAP_PTR_NEW(ptr) do { \ + ZEND_MAP_PTR(ptr) = zend_map_ptr_new(); \ + } while (0) +#else +# error "Unknown ZEND_MAP_PTR_KIND" +#endif + +ZEND_API void zend_map_ptr_reset(void); +ZEND_API void *zend_map_ptr_new(void); +ZEND_API void zend_map_ptr_extend(size_t last); + +#endif /* ZEND_MAP_PTR_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ |