ZEND_HASH_FOREACH_BUCKET(&PCRE_G(pcre_cache), p) {
/* Remove PCRE cache entries with inconsistent keys */
- if (ZSTR_IS_INTERNED(p->key)) {
+ if (zend_accel_in_shm(p->key)) {
p->key = NULL;
zend_hash_del_bucket(&PCRE_G(pcre_cache), p);
}
} else { \
ZEND_ASSERT(IS_SERIALIZED(ptr)); \
(ptr) = (void*)((char*)buf + (size_t)(ptr)); \
- GC_FLAGS(ptr) |= IS_STR_INTERNED; \
- GC_FLAGS(ptr) &= ~IS_STR_PERMANENT; \
+ /* script->corrupted shows if the script in SHM or not */ \
+ if (EXPECTED(!script->corrupted)) { \
+ GC_FLAGS(ptr) |= IS_STR_INTERNED | IS_STR_PERMANENT; \
+ } else { \
+ GC_FLAGS(ptr) |= IS_STR_INTERNED; \
+ GC_FLAGS(ptr) &= ~IS_STR_PERMANENT; \
+ } \
} \
} \
} while (0)
ret = accel_new_interned_string(str);
if (ret == str) {
/* String wasn't interned but we will use it as interned anyway */
- GC_FLAGS(ret) |= IS_STR_INTERNED;
- GC_FLAGS(ret) &= ~IS_STR_PERMANENT;
+ GC_FLAGS(ret) |= IS_STR_INTERNED | IS_STR_PERMANENT;
}
} else {
ret = str;
}
#endif
}
+
+int zend_accel_in_shm(void *ptr)
+{
+ int i;
+
+ for (i = 0; i < ZSMMG(shared_segments_count); i++) {
+ if ((char*)ptr >= (char*)ZSMMG(shared_segments)[i]->p &&
+ (char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->size) {
+ return 1;
+ }
+ }
+ return 0;
+}
void *_zend_shared_memdup(void *p, size_t size, zend_bool free_source);
int zend_shared_memdup_size(void *p, size_t size);
+int zend_accel_in_shm(void *ptr);
+
typedef union _align_test {
void *ptr;
double dbl;