From 7ea261685f179a7cddcc4196fc7f3f12572c3d49 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 17 Mar 2017 12:48:03 +0100 Subject: [PATCH] Disable block pass for large functions This is the last fix for bug #74250. --- NEWS | 4 ++++ ext/opcache/Optimizer/block_pass.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index af21109b95..a6e58aa677 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #74004 (LIBXML_NOWARNING flag ingnored on loadHTML*). (somedaysummer) +- Opcache: + . Fixed bug #74250 (OPcache compilation performance regression in PHP 5.6/7 + with huge classes). (Nikita) + - OpenSSL: . Fixed bug #72333 (fwrite() on non-blocking SSL sockets doesn't work). (Jakub Zelenka) diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index a4f4136855..38c2ecb124 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1794,6 +1794,11 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx) return; } + if (cfg.blocks_count * (op_array->last_var + op_array->T) > 64 * 1024 * 1024) { + zend_arena_release(&ctx->arena, checkpoint); + return; + } + if (ctx->debug_level & ZEND_DUMP_BEFORE_BLOCK_PASS) { zend_dump_op_array(op_array, ZEND_DUMP_CFG, "before block pass", &cfg); } -- 2.50.1