@@ -363,6 +363,7 @@ ngx_http_lua_ngx_re_match_helper(lua_State *L, int wantcaps)
363
363
old_pool = ngx_http_lua_pcre_malloc_init (pool );
364
364
365
365
sd = pcre_study (re_comp .regex , PCRE_STUDY_JIT_COMPILE , & msg );
366
+ pcre_assign_jit_stack (sd , NULL , lmcf -> jit_stack );
366
367
367
368
ngx_http_lua_pcre_malloc_done (old_pool );
368
369
@@ -825,6 +826,7 @@ ngx_http_lua_ngx_re_gmatch(lua_State *L)
825
826
old_pool = ngx_http_lua_pcre_malloc_init (pool );
826
827
827
828
sd = pcre_study (re_comp .regex , PCRE_STUDY_JIT_COMPILE , & msg );
829
+ pcre_assign_jit_stack (sd , NULL , lmcf -> jit_stack );
828
830
829
831
ngx_http_lua_pcre_malloc_done (old_pool );
830
832
@@ -2478,6 +2480,22 @@ ngx_http_lua_ffi_max_regex_cache_size(void)
2478
2480
}
2479
2481
return (uint32_t ) lmcf -> regex_cache_max_entries ;
2480
2482
}
2483
+
2484
+ void
2485
+ ngx_http_lua_ffi_set_jit_stack_size (int size )
2486
+ {
2487
+ int min_size ;
2488
+ ngx_http_lua_main_conf_t * lmcf ;
2489
+
2490
+ min_size = MIN (32 * 1024 , size );
2491
+ lmcf = ngx_http_cycle_get_module_main_conf (ngx_cycle ,
2492
+ ngx_http_lua_module );
2493
+ if (lmcf == NULL ) {
2494
+ return ;
2495
+ }
2496
+ pcre_jit_stack_free (lmcf -> jit_stack );
2497
+ lmcf -> jit_stack = pcre_jit_stack_alloc (min_size , size );
2498
+ }
2481
2499
#endif /* NGX_LUA_NO_FFI_API */
2482
2500
2483
2501
0 commit comments