PCRE2_JIT_STACK_CREATE(3)
π PCRE2_JIT_STACK_CREATE π
okay bestie, so this page lives in the Library Functions Manual, and it's all about PCRE2 β yes, that's Perl-compatible regular expressions (revised API), the whole entire vibe. Sit down, grab a strawberry π, we're talking JIT stacks.
β¨ SYNOPSIS β¨
like, here's the whole thing, exactly as it appears:
#include <pcre2.h>
pcre2_jit_stack *pcre2_jit_stack_create(size_t startsize,
size_t maxsize, pcre2_general_context *gcontext);
no cap, that's it π«Ά
π DESCRIPTION π
so, what does this icon actually do? this function creates a stack for the code that the JIT compiler compiled. yep. the JIT-compiled code needs somewhere to put its stuff, and this is how you make that somewhere. π
the first two arguments are the glow-up plan for the stack: startsize is the starting size, and maxsize is the maximum size it's allowed to grow to. it's giving "start small, dream big" β¨
the final argument is a general context β that's for the memory allocation functions β or NULL if you want standard memory allocation. honestly? NULL is fine, she's easy like that.
the result can be handed off to the JIT runtime code by calling pcre2_jit_stack_assign(), which associates the stack with a compiled pattern, and that pattern can then be processed by pcre2_match() or pcre2_jit_match(). the whole friend group, matching together π«Ά
π‘ real talk: a maximum stack size of 512KiB to 1MiB should be more than enough for any pattern. like, any. don't overthink it, don't over-allocate it, she doesn't need it.
and if the stack couldn't be allocated, or the values you passed were not reasonable?? NULL comes back. π that's the fail state, bestie, no workaround here, just check for it.
for more details, the manpage says to see the pcre2jit page β that's where the deep lore lives π§
there's also a complete description of the PCRE2 native API in the pcre2api page, and a description of the POSIX API in the pcre2posix page. go read them when you're ready to level up π
and that's the page, periodt π this whole thing is from PCRE2 10.47, dated 23 January 2023, and it's PCRE2_JIT_STACK_CREATE(3) β she ate, no crumbs, mwah π
π¦ where this page comes from
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms