[3.0] ebba85f Disable the PCRE JIT compiler by default

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 22 13:27:00 CEST 2013


commit ebba85fe7832318083ddd2ba04def6947f15eb37
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Tue Sep 4 08:16:50 2012 +0200

    Disable the PCRE JIT compiler by default
    
    The JIT compiler is broken on some versions of PCRE, at least on i386,
    so disable it by default.  It can be enabled using --enable-pcre-jit
    to configure.
    
    Fixes #1191

diff --git a/configure.ac b/configure.ac
index 9e68374..403e301 100644
--- a/configure.ac
+++ b/configure.ac
@@ -556,6 +556,17 @@ fi
 
 AC_DEFINE_UNQUOTED([VCC_CC],"$VCC_CC",[C compiler command line for VCL code])
 
+# --enable-pcre-jit
+AC_ARG_ENABLE(pcre-jit,
+    AS_HELP_STRING([--enable-pcre-jit],
+	[use the PCRE JIT compiler (default is NO)]),
+    ,
+    [enable_pcre_jit=no])
+
+if test "$enable_pcre_jit" = yes; then
+   AC_DEFINE([USE_PCRE_JIT],[1],[use the PCRE JIT compiler])
+fi
+
 # Generate output
 AC_CONFIG_FILES([
     Makefile
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index 03626bf..5207a57 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -33,8 +33,10 @@
 #include "miniobj.h"
 #include "vre.h"
 
-#ifndef PCRE_STUDY_JIT_COMPILE
-#define PCRE_STUDY_JIT_COMPILE 0
+#if USE_PCRE_JIT
+#define VRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE
+#else
+#define VRE_STUDY_JIT_COMPILE 0
 #endif
 
 #if PCRE_MAJOR < 8 || (PCRE_MAJOR == 8 && PCRE_MINOR < 20)
@@ -74,7 +76,7 @@ VRE_compile(const char *pattern, int options,
 		VRE_free(&v);
 		return (NULL);
 	}
-	v->re_extra = pcre_study(v->re, PCRE_STUDY_JIT_COMPILE, errptr);
+	v->re_extra = pcre_study(v->re, VRE_STUDY_JIT_COMPILE, errptr);
 	if (*errptr != NULL) {
 		VRE_free(&v);
 		return (NULL);



More information about the varnish-commit mailing list