Immutable clases and op_arrays.

Squashed commit of the following:

commit cd0c36c3f9
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 4740dabb84
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 ad7a78b253
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:46:30 2018 +0300

    Added comment

commit 0276ea5187
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:42:43 2018 +0300

    Added type cast

commit c63fc5d5f1
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 b945548e93
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:21:03 2018 +0300

    Removed redundand assertion

commit d5a4108840
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:19:13 2018 +0300

    Removed duplicate code

commit 8dadca8864
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 9ef07c88bd
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:48:29 2018 +0300

    typo

commit a06f0f3d3a
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 94099586ec
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Oct 15 23:34:01 2018 +0300

    Immutable clases and op_arrays
This commit is contained in:
Dmitry Stogov 2018-10-17 15:52:50 +03:00
parent ad6738e886
commit d57cd36e47
31 changed files with 838 additions and 348 deletions

View file

@ -347,7 +347,7 @@ int zend_shared_memdup_size(void *source, size_t size)
return ZEND_ALIGNED_SIZE(size);
}
static zend_always_inline void *_zend_shared_memdup(void *source, size_t size, zend_bool get_xlat, zend_bool set_xlat, zend_bool free_source)
static zend_always_inline void *_zend_shared_memdup(void *source, size_t size, zend_bool arena, zend_bool get_xlat, zend_bool set_xlat, zend_bool free_source)
{
void *old_p, *retval;
zend_ulong key;
@ -360,8 +360,13 @@ static zend_always_inline void *_zend_shared_memdup(void *source, size_t size, z
return old_p;
}
}
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
if (arena) {
retval = ZCG(arena_mem);
ZCG(arena_mem) = (void*)(((char*)ZCG(arena_mem)) + ZEND_ALIGNED_SIZE(size));
} else {
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size));
}
memcpy(retval, source, size);
if (set_xlat) {
if (!get_xlat) {
@ -378,32 +383,42 @@ static zend_always_inline void *_zend_shared_memdup(void *source, size_t size, z
void *zend_shared_memdup_get_put_free(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 1, 1, 1);
return _zend_shared_memdup(source, size, 0, 1, 1, 1);
}
void *zend_shared_memdup_put_free(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 0, 1, 1);
return _zend_shared_memdup(source, size, 0, 0, 1, 1);
}
void *zend_shared_memdup_free(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 0, 0, 1);
return _zend_shared_memdup(source, size, 0, 0, 0, 1);
}
void *zend_shared_memdup_get_put(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 1, 1, 0);
return _zend_shared_memdup(source, size, 0, 1, 1, 0);
}
void *zend_shared_memdup_put(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 0, 1, 0);
return _zend_shared_memdup(source, size, 0, 0, 1, 0);
}
void *zend_shared_memdup(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 0, 0, 0);
return _zend_shared_memdup(source, size, 0, 0, 0, 0);
}
void *zend_shared_memdup_arena_put(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 1, 0, 1, 0);
}
void *zend_shared_memdup_arena(void *source, size_t size)
{
return _zend_shared_memdup(source, size, 1, 0, 0, 0);
}
void zend_shared_alloc_safe_unlock(void)
@ -483,6 +498,16 @@ void zend_shared_alloc_clear_xlat_table(void)
zend_hash_clean(&ZCG(xlat_table));
}
uint32_t zend_shared_alloc_checkpoint_xlat_table(void)
{
return ZCG(xlat_table).nNumUsed;
}
void zend_shared_alloc_restore_xlat_table(uint32_t checkpoint)
{
zend_hash_discard(&ZCG(xlat_table), checkpoint);
}
void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
{
zend_ulong key = (zend_ulong)old;