Skip to content

Commit f5a939a

Browse files
committed
Add support for disk OPcache
1 parent fb35d1e commit f5a939a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ext/opcache/zend_file_cache.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ static void zend_file_cache_serialize_hash(HashTable *ht,
343343
}
344344
}
345345

346+
static void zend_file_cache_serialize_func(zval *zv,
347+
zend_persistent_script *script,
348+
zend_file_cache_metainfo *info,
349+
void *buf);
350+
346351
static void zend_file_cache_serialize_ast(zend_ast *ast,
347352
zend_persistent_script *script,
348353
zend_file_cache_metainfo *info,
@@ -363,6 +368,8 @@ static void zend_file_cache_serialize_ast(zend_ast *ast,
363368
zend_file_cache_serialize_ast(tmp, script, info, buf);
364369
}
365370
}
371+
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
372+
zend_file_cache_serialize_func(&((zend_ast_zval*)ast)->val, script, info, buf);
366373
} else {
367374
uint32_t children = zend_ast_get_num_children(ast);
368375
for (i = 0; i < children; i++) {
@@ -468,7 +475,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
468475

469476
/* Check whether this op_array has already been serialized. */
470477
if (IS_SERIALIZED(op_array->opcodes)) {
471-
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
478+
// ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
472479
return;
473480
}
474481

@@ -1226,6 +1233,10 @@ static void zend_file_cache_unserialize_hash(HashTable *ht,
12261233
}
12271234
}
12281235

1236+
static void zend_file_cache_unserialize_func(zval *zv,
1237+
zend_persistent_script *script,
1238+
void *buf);
1239+
12291240
static void zend_file_cache_unserialize_ast(zend_ast *ast,
12301241
zend_persistent_script *script,
12311242
void *buf)
@@ -1242,6 +1253,8 @@ static void zend_file_cache_unserialize_ast(zend_ast *ast,
12421253
zend_file_cache_unserialize_ast(list->child[i], script, buf);
12431254
}
12441255
}
1256+
} else if (ast->kind == ZEND_AST_OP_ARRAY) {
1257+
zend_file_cache_unserialize_func(&((zend_ast_zval*)ast)->val, script, buf);
12451258
} else {
12461259
uint32_t children = zend_ast_get_num_children(ast);
12471260
for (i = 0; i < children; i++) {
@@ -1355,7 +1368,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
13551368

13561369
/* Check whether this op_array has already been unserialized. */
13571370
if (IS_UNSERIALIZED(op_array->opcodes)) {
1358-
ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
1371+
//ZEND_ASSERT(op_array->scope && "Only method op_arrays should be shared");
13591372
return;
13601373
}
13611374

0 commit comments

Comments
 (0)