Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ static zend_result (*orig_post_startup_cb)(void);
static zend_result accel_post_startup(void);
static zend_result accel_finish_startup(void);

#ifndef ZEND_WIN32
# define PRELOAD_SUPPORT
#endif

#ifdef PRELOAD_SUPPORT
static void preload_shutdown(void);
static void preload_activate(void);
static void preload_restart(void);
#endif

#ifdef ZEND_WIN32
# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
Expand Down Expand Up @@ -2713,9 +2719,11 @@ zend_result accel_activate(INIT_FUNC_ARGS)
}

zend_shared_alloc_restore_state();
#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_restart();
}
#endif

#ifdef HAVE_JIT
zend_jit_restart();
Expand Down Expand Up @@ -2757,9 +2765,11 @@ zend_result accel_activate(INIT_FUNC_ARGS)
zend_jit_activate();
#endif

#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_activate();
}
#endif

return SUCCESS;
}
Expand Down Expand Up @@ -3455,9 +3465,11 @@ void accel_shutdown(void)
return;
}

#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_shutdown();
}
#endif

_file_cache_only = file_cache_only;

Expand Down Expand Up @@ -3566,6 +3578,7 @@ void accelerator_shm_read_unlock(void)
}

/* Preloading */
#ifdef PRELOAD_SUPPORT
static HashTable *preload_scripts = NULL;
static zend_op_array *(*preload_orig_compile_file)(zend_file_handle *file_handle, int type);

Expand Down Expand Up @@ -4665,7 +4678,6 @@ static void preload_send_header(sapi_header_struct *sapi_header, void *server_co
{
}

#ifndef ZEND_WIN32
static zend_result accel_finish_startup_preload(bool in_child)
{
zend_result ret = SUCCESS;
Expand Down
8 changes: 7 additions & 1 deletion ext/opcache/jit/ir/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,12 @@ ir_ref ir_folding(ir_ctx *ctx, uint32_t opt, ir_ref op1, ir_ref op2, ir_ref op3,
ctx->prev_insn_chain[op] = ref;

return ref;
} else {
ctx->fold_insn.optx = opt;
ctx->fold_insn.op1 = op1;
ctx->fold_insn.op2 = op2;
ctx->fold_insn.op3 = op3;
return IR_FOLD_DO_CSE;
}
ir_fold_emit:
if (!(ctx->flags2 & IR_OPT_IN_SCCP)) {
Expand All @@ -1031,7 +1037,7 @@ ir_ref ir_folding(ir_ctx *ctx, uint32_t opt, ir_ref op1, ir_ref op2, ir_ref op3,
if (!(ctx->flags2 & IR_OPT_IN_SCCP)) {
return ir_const(ctx, val, IR_OPT_TYPE(opt));
} else {
ctx->fold_insn.type = IR_OPT_TYPE(opt);
ctx->fold_insn.opt = IR_OPT(IR_OPT_TYPE(opt), IR_OPT_TYPE(opt));
ctx->fold_insn.val.u64 = val.u64;
return IR_FOLD_DO_CONST;
}
Expand Down
5 changes: 4 additions & 1 deletion ext/opcache/jit/ir/ir_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ bool ir_check(const ir_ctx *ctx)
use = *p;
if (use != IR_UNUSED) {
if (IR_IS_CONST_REF(use)) {
if (use >= ctx->consts_count) {
if (IR_OPND_KIND(flags, j) != IR_OPND_DATA) {
fprintf(stderr, "ir_base[%d].ops[%d] reference (%d) must not be constant\n", i, j, use);
ok = 0;
} else if (use >= ctx->consts_count) {
fprintf(stderr, "ir_base[%d].ops[%d] constant reference (%d) is out of range\n", i, j, use);
ok = 0;
}
Expand Down
Loading