com php-src: Disable block pass for large functions: NEWS ext/opcache/Optimizer/block_pass.c

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    7ea261685f179a7cddcc4196fc7f3f12572c3d49
Author:    Nikita Popov <[email protected]>         Fri, 17 Mar 2017 12:48:03 +0100
Parents:   3becfb9be4cf4c6a465c6531621c3df5c358ba55
Branches:  PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=7ea261685f179a7cddcc4196fc7f3f12572c3d49

Log:
Disable block pass for large functions

This is the last fix for bug #74250.

Bugs:
https://bugs.php.net/74250

Changed paths:
  M  NEWS
  M  ext/opcache/Optimizer/block_pass.c


Diff:
diff --git a/NEWS b/NEWS
index af21109..a6e58aa 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 a4f4136..38c2ecb 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);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.