Skip to content

Commit e0dff3d

Browse files
committed
Remove CE cache from non-interned file cache strings
1 parent 76e26c6 commit e0dff3d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ext/opcache/zend_file_cache.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,23 @@ static int zend_file_cache_flock(int fd, int type)
134134
(ptr) = (void*)((char*)buf + (size_t)(ptr)); \
135135
} \
136136
} while (0)
137+
137138
#define SERIALIZE_STR(ptr) do { \
138139
if (ptr) { \
139140
if (IS_ACCEL_INTERNED(ptr)) { \
140141
(ptr) = zend_file_cache_serialize_interned((zend_string*)(ptr), info); \
141142
} else { \
142143
ZEND_ASSERT(IS_UNSERIALIZED(ptr)); \
144+
(ptr) = (void*)((char*)(ptr) - (char*)script->mem); \
145+
zend_string *__new_str = (zend_string*)((char*)buf + (uintptr_t)(ptr)); \
143146
/* script->corrupted shows if the script in SHM or not */ \
144147
if (EXPECTED(script->corrupted)) { \
145-
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
146-
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
148+
GC_ADD_FLAGS(__new_str, IS_STR_INTERNED); \
149+
GC_DEL_FLAGS(__new_str, IS_STR_PERMANENT); \
150+
} else { \
151+
GC_ADD_FLAGS(__new_str, IS_STR_INTERNED | IS_STR_PERMANENT); \
147152
} \
148-
(ptr) = (void*)((char*)(ptr) - (char*)script->mem); \
153+
GC_DEL_FLAGS(__new_str, IS_STR_CLASS_NAME_MAP_PTR); \
149154
} \
150155
} \
151156
} while (0)
@@ -156,13 +161,6 @@ static int zend_file_cache_flock(int fd, int type)
156161
} else { \
157162
ZEND_ASSERT(IS_SERIALIZED(ptr)); \
158163
(ptr) = (void*)((char*)buf + (size_t)(ptr)); \
159-
/* script->corrupted shows if the script in SHM or not */ \
160-
if (EXPECTED(!script->corrupted)) { \
161-
GC_ADD_FLAGS(ptr, IS_STR_INTERNED | IS_STR_PERMANENT); \
162-
} else { \
163-
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
164-
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
165-
} \
166164
} \
167165
} \
168166
} while (0)

0 commit comments

Comments
 (0)