diff options
author | dgp <dgp@users.sourceforge.net> | 2015-10-21 14:10:13 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-10-21 14:10:13 (GMT) |
commit | 0a228666ae8b3189ae92ff7624263de1455c24ff (patch) | |
tree | b94406997a6f24475e63321603e9d6912d5a7880 /generic/regguts.h | |
parent | 742b7cee05467846b9ad80a57eacf888dffa845f (diff) | |
parent | 4e08431e8790a66cea86d33c8c770626396509c0 (diff) | |
download | tcl-0a228666ae8b3189ae92ff7624263de1455c24ff.zip tcl-0a228666ae8b3189ae92ff7624263de1455c24ff.tar.gz tcl-0a228666ae8b3189ae92ff7624263de1455c24ff.tar.bz2 |
[1080042][8f245009b0] Big bundle of regexp engine fixes and improvements contributed from Tom Lane of the postgres project.
Diffstat (limited to 'generic/regguts.h')
-rw-r--r-- | generic/regguts.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/generic/regguts.h b/generic/regguts.h index de760b0..1ac2465 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -254,9 +254,11 @@ struct arc { struct state *from; /* where it's from (and contained within) */ struct state *to; /* where it's to */ struct arc *outchain; /* link in *from's outs chain or free chain */ -#define freechain outchain - struct arc *inchain; /* link in *to's ins chain */ - struct arc *colorchain; /* link in color's arc chain */ + struct arc *outchainRev; /* back-link in *from's outs chain */ +#define freechain outchain /* we do not maintain "freechainRev" */ + struct arc *inchain; /* *to's ins chain */ + struct arc *inchainRev; /* back-link in *to's ins chain */ + struct arc *colorchain; /* color's arc chain */ struct arc *colorchainRev; /* back-link in color's arc chain */ }; @@ -294,9 +296,6 @@ struct nfa { struct colormap *cm; /* the color map */ color bos[2]; /* colors, if any, assigned to BOS and BOL */ color eos[2]; /* colors, if any, assigned to EOS and EOL */ - size_t size; /* Current NFA size; differs from nstates as - * it also counts the number of states created - * by children of this state. */ struct vars *v; /* simplifies compile error reporting */ struct nfa *parent; /* parent NFA, if any */ }; @@ -340,11 +339,16 @@ struct cnfa { #define NULLCNFA(cnfa) ((cnfa).nstates == 0) /* - * Used to limit the maximum NFA size to something sane. [Bug 1810264] + * This symbol limits the transient heap space used by the regex compiler, + * and thereby also the maximum complexity of NFAs that we'll deal with. + * Currently we only count NFA states and arcs against this; the other + * transient data is generally not large enough to notice compared to those. + * Note that we do not charge anything for the final output data structures + * (the compacted NFA and the colormap). */ - -#ifndef REG_MAX_STATES -# define REG_MAX_STATES 100000 +#ifndef REG_MAX_COMPILE_SPACE +#define REG_MAX_COMPILE_SPACE \ + (100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch)) #endif /* |