PCRE2\_JIT\_COMPILE(3) Library Functions Manual PCRE2\_JIT\_COMPILE(3)

# [NAME](#NAME)

PCRE2 - Perl-compatible regular expressions (revised API)

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;pcre2.h&gt;**

```
int pcre2_jit_compile(pcre2_code *code, uint32_t options);
```

# [DESCRIPTION](#DESCRIPTION)

This function requests JIT compilation, which, if the just-in-time compiler is available, further processes a compiled pattern into machine code that executes much faster than the **pcre2\_match()** interpretive matching function. Full details are given in the **pcre2jit** documentation.

The availability of JIT support can be tested by calling **pcre2\_compile\_jit()** with a single option PCRE2\_JIT\_TEST\_ALLOC (the code argument is ignored, so a NULL value is accepted). Such a call returns zero if JIT is available and has a working allocator. Otherwise it returns PCRE2\_ERROR\_NOMEMORY if JIT is available but cannot allocate executable memory, or PCRE2\_ERROR\_JIT\_UNSUPPORTED if JIT support is not compiled.

Otherwise, the first argument must be a pointer that was returned by a successful call to **pcre2\_compile()**, and the second must contain one or more of the following bits:

PCRE2\_JIT\_COMPLETE compile code for full matching  
PCRE2\_JIT\_PARTIAL\_SOFT compile code for soft partial matching  
PCRE2\_JIT\_PARTIAL\_HARD compile code for hard partial matching

There is also an obsolete option called PCRE2\_JIT\_INVALID\_UTF, which has been superseded by the **pcre2\_compile()** option PCRE2\_MATCH\_INVALID\_UTF. The old option is deprecated and may be removed in the future.

The yield of the function when called with any of the three options above is 0 for success, or a negative error code otherwise. In particular, PCRE2\_ERROR\_JIT\_BADOPTION is returned if JIT is not supported or if an unknown bit is set in *options*. The function can also return PCRE2\_ERROR\_NOMEMORY if JIT is unable to allocate executable memory for the compiler, even if it was because of a system security restriction. In a few cases, the function may return with PCRE2\_ERROR\_JIT\_UNSUPPORTED for unsupported features.

There is a complete description of the PCRE2 native API in the **pcre2api** page and a description of the POSIX API in the **pcre2posix** page.

22 August 2024 PCRE2 10.49

---

Document: pcre2_jit_compile(3) from pcre2 10.49-r2 (Chainguard OS)
Source: https://github.com/PCRE2Project/pcre2.git
