Re: [pcre-dev] PCRE2: PCRE2_INFO_JIT in docs, but not in pcr…

Top Page
Delete this message
Author: Zoltán Herczeg
Date:  
To: pcre-dev
CC: pcre-dev@exim.org
Subject: Re: [pcre-dev] PCRE2: PCRE2_INFO_JIT in docs, but not in pcre2.h
Hi,

>That's an error in the docs, incorrect editing of the PCRE1 document.
>What it should be saying is that you can use PCRE2_INFO_JITSIZE. If the
>result is non-zero, JIT compilation was successful. Thanks for noticing!


This gives a bit more depth to JIT complation check. In PCRE2, you can call jit_compile multiple times with different mode combinations (complete, partial soft, etc.). If a given mode is not yet compiled, the library performs the compilation. If the compilation is successful, PCRE2_INFO_JITSIZE grows.

For example lets consider the following steps:

1) Before any compilation, PCRE2_INFO_JITSIZE is 0.
2) Call jit_compile with complete mode. If the compilation is successful, PCRE2_INFO_JITSIZE will be increased. Otherwise it is unchanged.
3) Call jit_compile with partial hard mode. If the compilation is successful, PCRE2_INFO_JITSIZE will be increased. Otherwise it is unchanged.

To make the life easier, jit_compile also returns with an error code if the compilation is failed. The jit_compile returns with success if no work is required (the requested compilation modes have been already complied, or no compilation is requested). The only exception when JIT is not available, because jit_compile always return with an error code in that case.

Regards,
Zoltan