Revision: 178
http://www.exim.org/viewvc/pcre2?view=rev&revision=178
Author: ph10
Date: 2014-12-31 11:15:03 +0000 (Wed, 31 Dec 2014)
Log Message:
-----------
Ensure that the function op_recurse_ovecsave is not inlined when compiled by
gcc.
Modified Paths:
--------------
code/trunk/src/pcre2_match.c
Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c 2014-12-22 17:33:10 UTC (rev 177)
+++ code/trunk/src/pcre2_match.c 2014-12-31 11:15:03 UTC (rev 178)
@@ -437,6 +437,19 @@
point to a new recursion data block, and all its fields other than ovec_save
have been set.
+This function exists so that the local vector variable ovecsave is no longer
+defined in the match() function, as it was in PCRE1. It is used only when there
+is recursion in the pattern, so it wastes a lot of stack to have it defined for
+every call of match(). We now use this function as an indirect way of calling
+match() only in the case when ovecsave is needed. (David Wheeler used to say
+"All problems in computer science can be solved by another level of
+indirection.")
+
+HOWEVER: when this file is compiled by gcc in an optimizing mode, because this
+function is called only once, and only from within match(), gcc will "inline"
+it - that is, move it inside match() - and this completely negates its reason
+for existence. Therefore, we mark it as non-inline when gcc is in use.
+
Arguments:
eptr pointer to current character in subject
callpat the recursion point in the pattern
@@ -452,6 +465,9 @@
*/
static int
+#ifdef __GNUC__
+__attribute__ ((noinline))
+#endif
op_recurse_ovecsave(REGISTER PCRE2_SPTR eptr, PCRE2_SPTR callpat,
PCRE2_SPTR mstart, PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb,
uint32_t rdepth)