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

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

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

Log:
Disable block pass for large functions

(Backport of 7ea261685f179a7cddcc4196fc7f3f12572c3d49 to 7.0.)

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


Diff:
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index f69199b..413b8b1 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -2000,6 +2000,10 @@ void optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
 		return;
 	}
 
+	if ((uint64_t) op_array->last * (op_array->last_var + op_array->T) > 512 * 1024 * 1024) {
+		return;
+	}
+
     /* Build CFG */
 	checkpoint = zend_arena_checkpoint(ctx->arena);
 	if (!find_code_blocks(op_array, &cfg, ctx)) {
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.