Skip to content

Commit

Permalink
Rename ${^RE_TRIE_MAXBUFF} to ${^RE_TRIE_MAXBUF},
Browse files Browse the repository at this point in the history
and other neatification

p4raw-id: //depot/perl@24065
  • Loading branch information
rgs committed Mar 22, 2005
1 parent a399f54 commit 0111c4f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pod/perl592delta.pod
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ effect for the regular expression engine when running under C<use re
=head2 Trie optimization for regexp engine

The regexp engine is now able to factorize common prefixes and suffixes in
regular expressions. A new special variable, ${^RE_TRIE_MAXBUFF}, has been
regular expressions. A new special variable, ${^RE_TRIE_MAXBUF}, has been
added to fine tune this optimization.

=head1 Installation and Configuration Improvements
Expand Down
2 changes: 1 addition & 1 deletion pod/perlvar.pod
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ numeric or symbolic values, eg C<$^D = 10> or C<$^D = "st">.
The current value of the regex debugging flags. Set to 0 for no debug output
even when the re 'debug' module is loaded. See L<re> for details.

=item ${^RE_TRIE_MAXBUFF}
=item ${^RE_TRIE_MAXBUF}

Controls how certain regex optimisations are applied and how much memory they
utilize. This value by default is 65536 which corresponds to a 512kB temporary
Expand Down
22 changes: 10 additions & 12 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,9 +866,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
});


re_trie_maxbuff=get_sv(RE_TRIE_MAXBUFF, 1);
re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
if (!SvIOK(re_trie_maxbuff)) {
sv_setiv(re_trie_maxbuff, TRIE_SIMPLE_MAX_BUFF);
sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
}

/* -- First loop and Setup --
Expand Down Expand Up @@ -941,8 +941,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs
/*
We now know what we are dealing with in terms of unique chars and
string sizes so we can calculate how much memory a naive
representation using a flat table will take. If its over a reasonable
limit (as specified by $^RE_TRIE_MAXBUFF) we use a more memory
representation using a flat table will take. If it's over a reasonable
limit (as specified by ${^RE_TRIE_MAXBUF}) we use a more memory
conservative but potentially much slower representation using an array
of lists.
Expand Down Expand Up @@ -1834,13 +1834,12 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
it would just call its tail, no WHILEM/CURLY needed.
*/
if (DO_TRIE) {
if (!re_trie_maxbuff) {
re_trie_maxbuff=get_sv(RE_TRIE_MAXBUFF, 1);
if (!SvIOK(re_trie_maxbuff))
sv_setiv(re_trie_maxbuff, TRIE_SIMPLE_MAX_BUFF);

}
if (DO_TRIE) {
if (!re_trie_maxbuff) {
re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
if (!SvIOK(re_trie_maxbuff))
sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
}
if ( SvIV(re_trie_maxbuff)>=0 && OP( startbranch )==BRANCH ) {
regnode *cur;
regnode *first = (regnode *)NULL;
Expand Down Expand Up @@ -1902,7 +1901,6 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
regnode *noper = NEXTOPER( cur );
regnode *noper_next = regnext( noper );


DEBUG_OPTIMISE_r({
regprop( mysv, cur);
PerlIO_printf( Perl_debug_log, "%*s%s",
Expand Down
9 changes: 4 additions & 5 deletions regcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ START_EXTERN_C
EXTCONST U8 PL_varies[];
#else
EXTCONST U8 PL_varies[] = {
BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL,
BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL,
WHILEM, CURLYM, CURLYN, BRANCHJ, IFTHEN, SUSPEND, CLUMP, 0
};
#endif
Expand Down Expand Up @@ -369,7 +369,7 @@ typedef struct re_scream_pos_data_s

/* .what is a character array with one character for each member of .data
* The character describes the function of the corresponding .data item:
* f - start-class data for regstclass optimization
* f - start-class data for regstclass optimization
* n - Root of op tree for (?{EVAL}) item
* o - Start op for (?{EVAL}) item
* p - Pad for (?{EVAL} item
Expand Down Expand Up @@ -485,9 +485,8 @@ typedef struct _reg_trie_data reg_trie_data;
#define DO_TRIE 1
#define TRIE_DEBUG 1


#define TRIE_SIMPLE_MAX_BUFF 65536
#define RE_TRIE_MAXBUFF "\022E_TRIE_MAXBUFF"
#define RE_TRIE_MAXBUF_INIT 65536
#define RE_TRIE_MAXBUF_NAME "\022E_TRIE_MAXBUF"
#define RE_DEBUG_FLAGS "\022E_DEBUG_FLAGS"

/* If you change these be sure to update ext/re/re.pm as well */
Expand Down

0 comments on commit 0111c4f

Please sign in to comment.