summaryrefslogtreecommitdiff
path: root/regint.h
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2022-11-08 15:05:52 +0900
committerYusuke Endoh <mame@ruby-lang.org>2022-11-09 23:21:26 +0900
commit22294731a82642ac63ed6708e0015361d05d6677 (patch)
tree665b7b1a52a9a6b3130009c01aed59877534832c /regint.h
parent0a14825f731afc468481569d332027abdd58cd4e (diff)
Refactor field names
Diffstat (limited to 'regint.h')
-rw-r--r--regint.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/regint.h b/regint.h
index 12b5d5c70a..e1e48c0951 100644
--- a/regint.h
+++ b/regint.h
@@ -45,8 +45,8 @@
#define USE_CACHE_MATCH_OPT
#ifdef USE_CACHE_MATCH_OPT
-# define NUM_CACHE_OPCODE_FAIL -1
-# define NUM_CACHE_OPCODE_UNINIT -2
+# define NUM_CACHE_INDEX_FAIL -1
+# define NUM_CACHE_INDEX_UNINIT -2
#endif
#if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
@@ -874,10 +874,11 @@ typedef struct _OnigStackType {
#ifdef USE_CACHE_MATCH_OPT
typedef struct {
- UChar *addr;
- int num;
- int outer_repeat;
+ UChar* addr; /* pointer to corresponding opcode. */
+ int point; /* cache point number (in outer repeat if `outer_repeat != -1`) */
+ int outer_repeat; /* outer repeat index number */
} OnigCacheIndex;
+#define NO_OUTER_REPEAT -1
#endif
typedef struct {
@@ -903,12 +904,12 @@ typedef struct {
uint64_t end_time;
#endif
#ifdef USE_CACHE_MATCH_OPT
- int num_fail;
- int enable_cache_match_opt;
- int num_cache_opcode;
- int num_cache_table;
- OnigCacheIndex *cache_index_table;
- uint8_t *match_cache;
+ int num_fail; /* counter of failure (backtrack) number for switching cache optimization. */
+ int num_cache_point; /* number of cache point in program */
+ int num_cache_index; /* size of cache index array */
+ int enable_cache_opt; /* whether cache optimization is enabled */
+ OnigCacheIndex* cache_index; /* cache index array for computing cache point number */
+ uint8_t* cache; /* bit array for cache optimization */
#endif
} OnigMatchArg;