Ruby 3.5.0dev (2025-02-20 revision 34098b669c0cbc024cd08e686891f1dfe0a10aaf)
|
Ruby's regular expression. More...
#include <rregexp.h>
Data Fields | |
struct RBasic | basic |
Basic part, including flags and class. | |
struct re_pattern_buffer * | ptr |
The pattern buffer. | |
const VALUE | src |
Source code of this expression. | |
unsigned long | usecnt |
Reference count. | |
Ruby's regular expression.
A regexp is compiled into its own intermediate representation. This one holds that info. Regexp "match" operation then executes that IR.
struct RBasic RRegexp::basic |
struct re_pattern_buffer* RRegexp::ptr |
const VALUE RRegexp::src |
Source code of this expression.
Definition at line 74 of file rregexp.h.
Referenced by rb_enc_reg_new().
unsigned long RRegexp::usecnt |
Reference count.
A regexp match can take extraordinarily long time to run. Ruby's regular expression is heavily extended and not a regular language any longer; runs in NP-time in practice. Now, Ruby also has threads and GVL. In order to prevent long GVL lockup, our regexp engine can release it on occasions. This means that multiple threads can touch a regular expressions at once. That itself is okay. But their cleanup phase shall wait for all the concurrent runs, to prevent use-after-free situation. This field is used to count such threads that are executing this particular pattern buffer.