@@ -735,6 +735,7 @@ static BOOL restrict_for_perl_test = FALSE;
735
735
static BOOL show_memory = FALSE;
736
736
737
737
static int code_unit_size ; /* Bytes */
738
+ static int jitrc ; /* Return from JIT compile */
738
739
static int test_mode = DEFAULT_TEST_MODE ;
739
740
static int timeit = 0 ;
740
741
static int timeitm = 0 ;
@@ -936,10 +937,10 @@ are supported. */
936
937
else \
937
938
a = pcre2_get_startchar_32(G(b,32))
938
939
939
- #define PCRE2_JIT_COMPILE (a ,b ) \
940
- if (test_mode == PCRE8_MODE) pcre2_jit_compile_8(G(a,8),b); \
941
- else if (test_mode == PCRE16_MODE) pcre2_jit_compile_16(G(a,16),b); \
942
- else pcre2_jit_compile_32(G(a,32),b)
940
+ #define PCRE2_JIT_COMPILE (r , a ,b ) \
941
+ if (test_mode == PCRE8_MODE) r = pcre2_jit_compile_8(G(a,8),b); \
942
+ else if (test_mode == PCRE16_MODE) r = pcre2_jit_compile_16(G(a,16),b); \
943
+ else r = pcre2_jit_compile_32(G(a,32),b)
943
944
944
945
#define PCRE2_JIT_FREE_UNUSED_MEMORY (a ) \
945
946
if (test_mode == PCRE8_MODE) pcre2_jit_free_unused_memory_8(G(a,8)); \
@@ -1379,11 +1380,11 @@ the three different cases. */
1379
1380
else \
1380
1381
a = G(pcre2_get_startchar_,BITTWO)(G(b,BITTWO))
1381
1382
1382
- #define PCRE2_JIT_COMPILE (a ,b ) \
1383
+ #define PCRE2_JIT_COMPILE (r , a ,b ) \
1383
1384
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
1384
- G(pcre2_jit_compile_,BITONE)(G(a,BITONE),b); \
1385
+ r = G(pcre2_jit_compile_,BITONE)(G(a,BITONE),b); \
1385
1386
else \
1386
- G(pcre2_jit_compile_,BITTWO)(G(a,BITTWO),b)
1387
+ r = G(pcre2_jit_compile_,BITTWO)(G(a,BITTWO),b)
1387
1388
1388
1389
#define PCRE2_JIT_FREE_UNUSED_MEMORY (a ) \
1389
1390
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
@@ -1690,7 +1691,7 @@ the three different cases. */
1690
1691
r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size))
1691
1692
#define PCRE2_GET_OVECTOR_COUNT (a ,b ) a = pcre2_get_ovector_count_8(G(b,8))
1692
1693
#define PCRE2_GET_STARTCHAR (a ,b ) a = pcre2_get_startchar_8(G(b,8))
1693
- #define PCRE2_JIT_COMPILE (a ,b ) pcre2_jit_compile_8(G(a,8),b)
1694
+ #define PCRE2_JIT_COMPILE (r , a ,b ) r = pcre2_jit_compile_8(G(a,8),b)
1694
1695
#define PCRE2_JIT_FREE_UNUSED_MEMORY (a ) pcre2_jit_free_unused_memory_8(G(a,8))
1695
1696
#define PCRE2_JIT_MATCH (a ,b ,c ,d ,e ,f ,g ,h ) \
1696
1697
a = pcre2_jit_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),h)
@@ -1783,7 +1784,7 @@ the three different cases. */
1783
1784
r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))
1784
1785
#define PCRE2_GET_OVECTOR_COUNT (a ,b ) a = pcre2_get_ovector_count_16(G(b,16))
1785
1786
#define PCRE2_GET_STARTCHAR (a ,b ) a = pcre2_get_startchar_16(G(b,16))
1786
- #define PCRE2_JIT_COMPILE (a ,b ) pcre2_jit_compile_16(G(a,16),b)
1787
+ #define PCRE2_JIT_COMPILE (r , a ,b ) r = pcre2_jit_compile_16(G(a,16),b)
1787
1788
#define PCRE2_JIT_FREE_UNUSED_MEMORY (a ) pcre2_jit_free_unused_memory_16(G(a,16))
1788
1789
#define PCRE2_JIT_MATCH (a ,b ,c ,d ,e ,f ,g ,h ) \
1789
1790
a = pcre2_jit_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),h)
@@ -1876,7 +1877,7 @@ the three different cases. */
1876
1877
r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
1877
1878
#define PCRE2_GET_OVECTOR_COUNT (a ,b ) a = pcre2_get_ovector_count_32(G(b,32))
1878
1879
#define PCRE2_GET_STARTCHAR (a ,b ) a = pcre2_get_startchar_32(G(b,32))
1879
- #define PCRE2_JIT_COMPILE (a ,b ) pcre2_jit_compile_32(G(a,32),b)
1880
+ #define PCRE2_JIT_COMPILE (r , a ,b ) r = pcre2_jit_compile_32(G(a,32),b)
1880
1881
#define PCRE2_JIT_FREE_UNUSED_MEMORY (a ) pcre2_jit_free_unused_memory_32(G(a,32))
1881
1882
#define PCRE2_JIT_MATCH (a ,b ,c ,d ,e ,f ,g ,h ) \
1882
1883
a = pcre2_jit_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),h)
@@ -3976,11 +3977,22 @@ if ((pat_patctl.control & CTL_INFO) != 0)
3976
3977
if (FLD (compiled_code , executable_jit ) != NULL )
3977
3978
fprintf (outfile , "JIT compilation was successful\n" );
3978
3979
else
3980
+ {
3979
3981
#ifdef SUPPORT_JIT
3980
- fprintf (outfile , "JIT compilation was not successful\n" );
3982
+ int len ;
3983
+ fprintf (outfile , "JIT compilation was not successful" );
3984
+ if (jitrc != 0 )
3985
+ {
3986
+ fprintf (outfile , " (" );
3987
+ PCRE2_GET_ERROR_MESSAGE (len , jitrc , pbuffer );
3988
+ PCHARSV (CASTVAR (void * , pbuffer ), 0 , len , FALSE, outfile );
3989
+ fprintf (outfile , ")" );
3990
+ }
3991
+ fprintf (outfile , "\n" );
3981
3992
#else
3982
3993
fprintf (outfile , "JIT support is not available in this version of PCRE2\n" );
3983
3994
#endif
3995
+ }
3984
3996
}
3985
3997
}
3986
3998
@@ -4191,7 +4203,7 @@ switch(cmd)
4191
4203
SET (compiled_code , patstack [-- patstacknext ]);
4192
4204
if (pat_patctl .jit != 0 )
4193
4205
{
4194
- PCRE2_JIT_COMPILE (compiled_code , pat_patctl .jit );
4206
+ PCRE2_JIT_COMPILE (jitrc , compiled_code , pat_patctl .jit );
4195
4207
}
4196
4208
if ((pat_patctl .control & CTL_MEMORY ) != 0 ) show_memory_info ();
4197
4209
if ((pat_patctl .control & CTL_ANYINFO ) != 0 )
@@ -4776,7 +4788,7 @@ if (pat_patctl.jit != 0)
4776
4788
pat_patctl .options |forbid_utf , & errorcode , & erroroffset ,
4777
4789
use_pat_context );
4778
4790
start_time = clock ();
4779
- PCRE2_JIT_COMPILE (compiled_code , pat_patctl .jit );
4791
+ PCRE2_JIT_COMPILE (jitrc , compiled_code , pat_patctl .jit );
4780
4792
time_taken += clock () - start_time ;
4781
4793
}
4782
4794
total_jit_compile_time += time_taken ;
@@ -4786,7 +4798,7 @@ if (pat_patctl.jit != 0)
4786
4798
}
4787
4799
else
4788
4800
{
4789
- PCRE2_JIT_COMPILE (compiled_code , pat_patctl .jit );
4801
+ PCRE2_JIT_COMPILE (jitrc , compiled_code , pat_patctl .jit );
4790
4802
}
4791
4803
}
4792
4804
0 commit comments