70static void zend_lazy_object_info_dtor_func(
zval *pElement)
100 zval *
zv = zend_hash_index_add_new_ptr(&
EG(lazy_objects_store).infos, obj->
handle, info);
115static bool zend_lazy_object_has_stale_info(
zend_object *obj)
117 return zend_hash_index_find_ptr(&
EG(lazy_objects_store).infos, obj->
handle);
146 if (zend_object_is_lazy_proxy(obj)) {
159 return zend_lazy_object_get_info(obj)->flags;
202static int zlo_hash_remove_dyn_props_func(
zval *pDest)
216 if (zend_object_is_lazy_proxy(
object)
217 && zend_lazy_object_initialized(
object)) {
233 ZEND_ASSERT(!obj || (!zend_object_is_lazy(obj) || zend_lazy_object_initialized(obj)));
234 ZEND_ASSERT(!obj || instanceof_function(obj->
ce, reflection_ce));
244 zend_throw_error(
NULL,
"Cannot make instance of internal class lazy: %s inherits internal class %s",
250 int lazy_properties_count = 0;
281 lazy_properties_count++;
285 if (zlo_is_iterating(obj)) {
289 if (zend_object_is_lazy(obj)) {
290 ZEND_ASSERT(zend_object_is_lazy_proxy(obj) && zend_lazy_object_initialized(obj));
294 if (zend_lazy_object_has_stale_info(obj)) {
343 lazy_properties_count++;
368 zend_lazy_object_set_info(obj, info);
395 ZVAL_COPY_PROP(&properties_table[i], &default_properties_table[i]);
405static void zend_lazy_object_revert_init(
zend_object *obj,
zval *properties_table_snapshot,
HashTable *properties_snapshot)
428 efree(properties_table_snapshot);
430 if (properties_snapshot) {
453 if (!instanceof_function(lazy_object->
ce, real_object->
ce)) {
492 zend_call_known_fcc(initializer, &
retval, argc, &
zobj, named_params);
501 zend_type_error(
"Lazy proxy factory must return an instance of a class compatible with %s, %s returned",
510 zend_type_error(
"The real instance class %s is not compatible with the proxy class %s. The proxy must be a instance of the same class as the real instance, or a sub-class with no additional properties, and no overrides of the __destructor or __clone methods.",
535 for (
int i = 0; i <
Z_OBJ(
retval)->ce->default_properties_count; i++) {
570 if (zend_lazy_object_initialized(obj)) {
574 if (zend_object_is_lazy(info->
u.
instance)) {
584 if (zend_object_is_lazy_proxy(obj)) {
585 return zend_lazy_object_init_proxy(obj);
598 if (properties_snapshot) {
602 zval *properties_table_snapshot =
NULL;
612 ZVAL_COPY_PROP(&properties_table_snapshot[i], &properties_table[i]);
614 ZVAL_COPY_PROP(&properties_table[i], &default_properties_table[i]);
628 zend_call_known_fcc(initializer, &
retval, argc, &
zobj, named_params);
631 zend_lazy_object_revert_init(obj, properties_table_snapshot, properties_snapshot);
636 zend_lazy_object_revert_init(obj, properties_table_snapshot, properties_snapshot);
638 zend_type_error(
"Lazy object initializer must return NULL or no value");
642 if (properties_table_snapshot) {
644 zval *
p = &properties_table_snapshot[i];
650 efree(properties_table_snapshot);
653 if (properties_snapshot) {
699 return object->properties;
707 return zend_std_get_properties_ex(
object);
726 if (!zend_object_is_lazy_proxy(old_obj)) {
753 zend_lazy_object_set_info(new_proxy, new_info);
762 if (zend_object_is_lazy_proxy(
object)) {
763 if (zend_lazy_object_initialized(
object)) {
785 if (zend_lazy_object_initialized(
zobj)) {
787 zend_get_gc_buffer_add_obj(gc_buffer, info->
u.
instance);
788 zend_get_gc_buffer_use(gc_buffer, table,
n);
795 zend_get_gc_buffer_add_obj(gc_buffer, fcc->
object);
798 zend_get_gc_buffer_add_obj(gc_buffer, fcc->
closure);
804 zval *prop =
zobj->properties_table;
805 zval *
end = prop +
zobj->ce->default_properties_count;
806 for ( ; prop <
end; prop++) {
807 zend_get_gc_buffer_add_zval(gc_buffer, prop);
810 zend_get_gc_buffer_use(gc_buffer, table,
n);
821 if (table[prop_num]) {
822 return table[prop_num];
828 if (!zend_lazy_object_initialized(obj)) {
833 return zend_get_property_info_for_slot(obj, slot);
unsigned const char * end
#define zend_hash_str_add(...)
HashTable properties_info
int default_properties_count
struct _zend_property_info ** properties_info_table
zend_class_entry * parent
zend_function * destructor
zend_fcall_info_cache fcc
int lazy_properties_count
zend_lazy_object_flags_t flags
struct _zend_lazy_object_info::@072225263375046243115374153365053243337217100056::@150272324151245360342176347254272073155373217166 initializer
union _zend_lazy_object_info::@072225263375046243115374153365053243337217100056 u
zend_object_dtor_obj_t dtor_obj
const zend_object_handlers * handlers
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API zend_class_entry * zend_standard_class_def
ZEND_API ZEND_COLD void zend_type_error(const char *format,...)
ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type)
ZEND_API const char * zend_zval_value_name(const zval *arg)
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
struct _zend_fcall_info_cache zend_fcall_info_cache
#define CE_DEFAULT_PROPERTIES_TABLE(ce)
exit(string|int $status=0)
#define OBJ_PROP_TO_NUM(offset)
#define ZEND_ACC_UNINSTANTIABLE
#define ZEND_ACC_READONLY
struct _zend_property_info zend_property_info
#define ZEND_ACC_CONSTANTS_UPDATED
#define ZEND_INTERNAL_CLASS
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
#define ZEND_REF_ADD_TYPE_SOURCE(ref, source)
ZEND_API zend_get_gc_buffer * zend_get_gc_buffer_create(void)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API void ZEND_FASTCALL zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func)
ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h)
ZEND_API HashTable *ZEND_FASTCALL zend_array_dup(HashTable *source)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_APPLY_STOP
#define ZEND_HASH_APPLY_REMOVE
#define HT_ITERATORS_COUNT(ht)
#define zend_new_array(size)
HashTable * zend_lazy_object_debug_info(zend_object *object, int *is_temp)
ZEND_API bool zend_class_can_be_lazy(zend_class_entry *ce)
ZEND_API zend_object * zend_lazy_object_mark_as_initialized(zend_object *obj)
zend_object * zend_lazy_object_get_instance(zend_object *obj)
HashTable * zend_lazy_object_get_gc(zend_object *zobj, zval **table, int *n)
zend_lazy_object_flags_t zend_lazy_object_get_flags(zend_object *obj)
ZEND_API zend_object * zend_lazy_object_init(zend_object *obj)
struct _zend_lazy_object_info zend_lazy_object_info
ZEND_API zend_object * zend_object_make_lazy(zend_object *obj, zend_class_entry *reflection_ce, zval *initializer_zv, zend_fcall_info_cache *initializer_fcc, zend_lazy_object_flags_t flags)
zend_property_info * zend_lazy_object_get_property_info_for_slot(zend_object *obj, zval *slot)
void zend_lazy_object_realize(zend_object *obj)
ZEND_API HashTable * zend_lazy_object_get_properties(zend_object *object)
bool zend_lazy_object_decr_lazy_props(zend_object *obj)
void zend_lazy_objects_init(zend_lazy_objects_store *store)
zval * zend_lazy_object_get_initializer_zv(zend_object *obj)
zend_object * zend_lazy_object_clone(zend_object *old_obj)
void zend_lazy_object_del_info(zend_object *obj)
void zend_lazy_objects_destroy(zend_lazy_objects_store *store)
uint8_t zend_lazy_object_flags_t
#define ZEND_LAZY_OBJECT_STRATEGY_MASK
#define ZEND_LAZY_OBJECT_STRATEGY_GHOST
#define ZEND_LAZY_OBJECT_USER_MASK
struct _zend_lazy_objects_store zend_lazy_objects_store
#define ZEND_LAZY_OBJECT_SKIP_DESTRUCTOR
#define ZEND_LAZY_OBJECT_INITIALIZED
#define ZEND_LAZY_OBJECT_STRATEGY_PROXY
ZEND_API HashTable * zend_get_properties_no_lazy_init(zend_object *zobj)
#define zend_release_properties(ht)
ZEND_API zend_object *ZEND_FASTCALL zend_objects_new(zend_class_entry *ce)
ZEND_API void zend_objects_destroy_object(zend_object *object)
void zend_object_dtor_property(zend_object *object, zval *p)
ZEND_API zend_object * zend_objects_clone_obj(zend_object *old_object)
void zend_object_dtor_dynamic_properties(zend_object *object)
ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object)
ZEND_API ZEND_COLD zend_property_info * zend_get_property_info_for_slot_slow(zend_object *obj, zval *slot)
#define EXPECTED(condition)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
#define Z_ISREF_P(zval_p)
#define IS_OBJ_LAZY_PROXY
#define ZVAL_COPY_VALUE_PROP(z, v)
struct _zend_array HashTable
#define IS_PROP_REINITABLE
#define OBJ_EXTRA_FLAGS(obj)
#define IS_OBJ_DESTRUCTOR_CALLED
#define ZEND_TYPE_IS_SET(t)
struct _zend_refcounted zend_refcounted
ZEND_RESULT_CODE zend_result
#define IS_ARRAY_IMMUTABLE
#define ZVAL_COPY_PROP(z, v)
#define IS_OBJ_LAZY_UNINITIALIZED
#define GC_DEL_FLAGS(p, flags)
#define GC_ADD_FLAGS(p, flags)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
zend_property_info * prop_info