grep: print the pcre2_jit_on value
PATCH 1/1 grep: print the pcre2_jit_on value
When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value of pcre1_jit_on.
Print the value of pcre2_jit_on instead.
--- grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grep.c +1 -1
@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *optpcre2_jit_stack_assign (p->pcre2_match_context,NULL , p->pcre2_jit_stack); }else if (p->pcre2_jit_on !=0 ) {BUG ("The pcre2_jit_on variable should be 0 or 1, not %d" , - p->pcre1_jit_on); + p->pcre2_jit_on); } }
Signature · 1 line
2.21.0.1020.gf2820cf01a
Quoted 7 lines · Beat Bolli
When
pcre2_jit_onis neither 1 nor 0, theBUG()call printed the value ofpcre1_jit_on.Print the value of
pcre2_jit_oninstead.Signed-off-by Beat Bolli <[email protected]>---
Thanks.
Quoted 15 lines
grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grep.c +1
-1@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *optpcre2_jit_stack_assign (p->pcre2_match_context,NULL , p->pcre2_jit_stack); }else if (p->pcre2_jit_on !=0 ) {BUG ("The pcre2_jit_on variable should be 0 or 1, not %d" , - p->pcre1_jit_on); + p->pcre2_jit_on); } }
Hi Beat,
Quoted 15 lines · Beat Bolli
When
pcre2_jit_onis neither 1 nor 0, theBUG()call printed the value ofpcre1_jit_on.Print the value of
pcre2_jit_oninstead.Signed-off-by Beat Bolli <[email protected]>--- grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grep.c +0
-0
grep.c static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt · line 562
Quoted 5 lines
grep.c +1
-1@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *optpcre2_jit_stack_assign (p->pcre2_match_context,NULL , p->pcre2_jit_stack); }else if (p->pcre2_jit_on !=0 ) {BUG ("The pcre2_jit_on variable should be 0 or 1, not %d" , - p->pcre1_jit_on); + p->pcre2_jit_on);
Seems obviously good.
Maybe while you're in the vicinity, you can add that information to the --debug output?
Thanks,
Dscho
Quoted 7 lines
grep.c +0
-1} } --2.21.0.1020.gf2820cf01a
Hi Dscho,
Quoted 27 lines · Johannes Schindelin
Hi Beat,
Quoted 15 lines · Beat Bolli
When
pcre2_jit_onis neither 1 nor 0, theBUG()call printed the value ofpcre1_jit_on.Print the value of
pcre2_jit_oninstead.Signed-off-by Beat Bolli <[email protected]>--- grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grep.c +0
-0grep.c static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt · line 562
Quoted 5 lines
grep.c +1
-1@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *optpcre2_jit_stack_assign (p->pcre2_match_context,NULL , p->pcre2_jit_stack); }else if (p->pcre2_jit_on !=0 ) {BUG ("The pcre2_jit_on variable should be 0 or 1, not %d" , - p->pcre1_jit_on); + p->pcre2_jit_on);Seems obviously good.
Quoted 2 lines
Maybe while you're in the vicinity, you can add that information to the
--debugoutput?
Do you mean something like this?
grep.c +0 -0
@@ -406,6 +406,8 @@ static void compile_pcre1_regexp(struct grep_pat *p,
const struct grep_opt *opt)
#ifdef GIT_PCRE1_USE_JIT
pcre_config(PCRE_CONFIG_JIT, &p->pcre1_jit_on);
+ if (opt->debug)
+ fprintf(stderr, "pcre1_jit_on=%d\n", p->pcre1_jit_on);
if (p->pcre1_jit_on == 1) {
p->pcre1_jit_stack = pcre_jit_stack_alloc(1, 1024 * 1024);
if (!p->pcre1_jit_stack)
@@ -522,6 +524,8 @@ static void compile_pcre2_pattern(struct grep_pat
*p, const struct grep_opt *opt
}
pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);
+ if (opt->debug)
+ fprintf(stderr, "pcre2_jit_on=%d\n", p->pcre2_jit_on);
if (p->pcre2_jit_on == 1) {
jitret = pcre2_jit_compile(p->pcre2_pattern,PCRE2_JIT_COMPLETE);
if (jitret)
If so, I'll wait a bit until it's clear whether Ævar's series [1] or my patch is going to be applied.
If this is missing your intentions, I need more guidance ;-)
[1] https://public-inbox.org/git/[email protected]/
Quoted 7 lines
Thanks,
DschoQuoted 3 lines
grep.c +0
-0} }
Cheers,
Beat
Hi Beat,
Quoted 27 lines · Beat Bolli
Quoted 26 lines · Johannes Schindelin
Quoted 15 lines · Beat Bolli
When
pcre2_jit_onis neither 1 nor 0, theBUG()call printed the value ofpcre1_jit_on.Print the value of
pcre2_jit_oninstead.Signed-off-by Beat Bolli <[email protected]>--- grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grep.c +0
-0grep.c static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt · line 562
Quoted 5 lines
grep.c +1
-1@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *optpcre2_jit_stack_assign (p->pcre2_match_context,NULL , p->pcre2_jit_stack); }else if (p->pcre2_jit_on !=0 ) {BUG ("The pcre2_jit_on variable should be 0 or 1, not %d" , - p->pcre1_jit_on); + p->pcre2_jit_on);Seems obviously good.
Quoted 4 lines
Quoted 2 lines
Maybe while you're in the vicinity, you can add that information to the
--debugoutput?Do you mean something like this?
Yes!
Quoted 26 lines
grep.c +2
-0@@ -406,6 +406,8 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)#ifdef GIT_PCRE1_USE_JIT pcre_config (PCRE_CONFIG_JIT , &p->pcre1_jit_on); +if (opt->debug) +fprintf (stderr,"pcre1_jit_on=%d\n" , p->pcre1_jit_on);if (p->pcre1_jit_on ==1 ) { p->pcre1_jit_stack =pcre_jit_stack_alloc (1 ,1024 *1024 );if (!p->pcre1_jit_stack)grep.c +2
-0@@ -522,6 +524,8 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt }pcre2_config (PCRE2_CONFIG_JIT , &p->pcre2_jit_on); +if (opt->debug) +fprintf (stderr,"pcre2_jit_on=%d\n" , p->pcre2_jit_on);if (p->pcre2_jit_on ==1 ) { jitret = pcre2_jit_compile(p->pcre2_pattern,
PCRE2_JIT_COMPLETE);
if (jitret)
Quoted 2 lines
If so, I'll wait a bit until it's clear whether Ævar's series [1] or my patch is going to be applied.
Sounds fair.
However, my reading of those patches is that they still keep support for JIT'ed and non-JIT'ed PCRE2 invocations (preferring the former if available, without any UI to change Git's behavior in that respect), so I would be surprised if this patch wasn't applicable after Ævar's patches.
Thanks,
Dscho
Quoted 17 lines
If this is missing your intentions, I need more guidance ;-)
[1] https://public-inbox.org/git/[email protected]/
Quoted 7 lines
Thanks,
DschoQuoted 3 lines
grep.c +0
-0} }Cheers,
Beat
Quoted 4 lines · Johannes Schindelin
Quoted 1 line · Beat Bolli
Do you mean something like this?
Yes!
Ideally, though, you want to print those values closing to the match function (pcre_exec for PCRE1
or pcre2_[jit_]match for PCRE2 as they might change after they are extracted from the PCRE configuration
with pcre[2]-config()
Quoted 4 lines
Quoted 2 lines
If so, I'll wait a bit until it's clear whether Ævar's series [1] or my patch is going to be applied.
Sounds fair
FWIW they are both applied (yours all the way to next), but Ævar's changes now in pu (but likely to be rerolled soon) will most likely remove your code (as explained on Junio's emails)
Quoted 5 lines
However, my reading of those patches is that they still keep support for JIT'ed and non-JIT'ed PCRE2 invocations (preferring the former if available, without any UI to change Git's behavior in that respect), so I would be surprised if this patch wasn't applicable after Ævar's patches.
the PCRE1 changes are significant enough that would break the current check and might
need a more convoluted check to figure out if JIT was actually used by pcre_exec.
more details in the configuration[1]
Carlo