LONGLONG restart_in;
#endif
zend_bool restart_in_progress;
- /* Interned Strings Support */
- char *interned_strings_start;
- char *interned_strings_top;
- char *interned_strings_end;
- char *interned_strings_saved_top;
- HashTable interned_strings;
+
+ /* uninitialized HashTable Support */
+ uint32_t uninitialized_bucket[-HT_MIN_MASK];
++
+ /* Interned Strings Support (must be the last element) */
+ zend_string_table interned_strings;
} zend_accel_shared_globals;
extern zend_bool accel_startup_ok;
uint32_t idx, nIndex;
Bucket *p;
+ HT_FLAGS(ht) |= HASH_FLAG_STATIC_KEYS;
ht->pDestructor = NULL;
- if (!(ht->u.flags & HASH_FLAG_INITIALIZED)) {
+ if (!(HT_FLAGS(ht) & HASH_FLAG_INITIALIZED)) {
- HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ if (EXPECTED(!ZCG(current_persistent_script)->corrupted)) {
+ HT_SET_DATA_ADDR(ht, &ZCSG(uninitialized_bucket));
+ } else {
+ HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ }
return;
}
if (ht->nNumUsed == 0) {
efree(HT_GET_DATA_ADDR(ht));
ht->nTableMask = HT_MIN_MASK;
- HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ if (EXPECTED(!ZCG(current_persistent_script)->corrupted)) {
+ HT_SET_DATA_ADDR(ht, &ZCSG(uninitialized_bucket));
+ } else {
+ HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ }
- ht->u.flags &= ~HASH_FLAG_INITIALIZED;
+ HT_FLAGS(ht) &= ~HASH_FLAG_INITIALIZED;
return;
}
- if (ht->u.flags & HASH_FLAG_PACKED) {
+ if (HT_FLAGS(ht) & HASH_FLAG_PACKED) {
void *data = HT_GET_DATA_ADDR(ht);
zend_accel_store(data, HT_USED_SIZE(ht));
HT_SET_DATA_ADDR(ht, data);
uint32_t idx, nIndex;
Bucket *p;
+ HT_FLAGS(ht) |= HASH_FLAG_STATIC_KEYS;
ht->pDestructor = NULL;
- if (!(ht->u.flags & HASH_FLAG_INITIALIZED)) {
+ if (!(HT_FLAGS(ht) & HASH_FLAG_INITIALIZED)) {
- HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ if (EXPECTED(!ZCG(current_persistent_script)->corrupted)) {
+ HT_SET_DATA_ADDR(ht, &ZCSG(uninitialized_bucket));
+ } else {
+ HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ }
return;
}
if (ht->nNumUsed == 0) {
efree(HT_GET_DATA_ADDR(ht));
ht->nTableMask = HT_MIN_MASK;
- HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ if (EXPECTED(!ZCG(current_persistent_script)->corrupted)) {
+ HT_SET_DATA_ADDR(ht, &ZCSG(uninitialized_bucket));
+ } else {
+ HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
+ }
- ht->u.flags &= ~HASH_FLAG_INITIALIZED;
+ HT_FLAGS(ht) &= ~HASH_FLAG_INITIALIZED;
return;
}
- if (ht->u.flags & HASH_FLAG_PACKED) {
+ if (HT_FLAGS(ht) & HASH_FLAG_PACKED) {
HT_SET_DATA_ADDR(ht, zend_accel_memdup(HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht)));
} else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) {
/* compact table */
zend_hash_apply(class_table, (apply_func_t) zend_update_parent_ce);
}
- zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key, unsigned int key_length)
-zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length, int for_shm)
++zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key, unsigned int key_length, int for_shm)
{
script->mem = ZCG(mem);
+ script->corrupted = 0;
+ ZCG(current_persistent_script) = script;
+
+ if (!for_shm) {
+ /* script is not going to be saved in SHM */
+ script->corrupted = 1;
+ }
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
zend_shared_alloc_clear_xlat_table();
#define ZEND_PERSIST_H
int zend_accel_script_persistable(zend_persistent_script *script);
-uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, char *key, unsigned int key_length, int for_shm);
-zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length, int for_shm);
+uint32_t zend_accel_script_persist_calc(zend_persistent_script *script, const char *key, unsigned int key_length, int for_shm);
- zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key, unsigned int key_length);
++zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, const char **key, unsigned int key_length, int for_shm);
#endif /* ZEND_PERSIST_H */