ruby-changes:43128
From: naruse <ko1@a...>
Date: Sun, 29 May 2016 22:56:45 +0900 (JST)
Subject: [ruby-changes:43128] naruse:r55202 (trunk): * regexec.c (match_at): make compilers optimize harder.
naruse 2016-05-29 22:56:38 +0900 (Sun, 29 May 2016) New Revision: 55202 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55202 Log: * regexec.c (match_at): make compilers optimize harder. Modified files: trunk/ChangeLog trunk/regexec.c Index: ChangeLog =================================================================== --- ChangeLog (revision 55201) +++ ChangeLog (revision 55202) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun May 29 22:44:19 2016 NARUSE, Yui <naruse@r...> + + * regexec.c (match_at): make compilers optimize harder. + Sun May 29 12:08:42 2016 Nobuyoshi Nakada <nobu@r...> * ext/-test-/auto_ext.rb (auto_ext): utitily method to create Index: regexec.c =================================================================== --- regexec.c (revision 55201) +++ regexec.c (revision 55202) @@ -1561,9 +1561,6 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L1561 mem_start_stk = (OnigStackIndex* )(repeat_stk + reg->num_repeat); mem_end_stk = mem_start_stk + (num_mem + 1); - for (i = 0; i <= num_mem; i++) { - mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX; - } #else /* USE_SUBEXP_CALL */ /* Stack #0 not is used. */ n = reg->num_repeat + reg->num_mem * 2; @@ -1579,10 +1576,14 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L1576 mem_start_stk[1]..mem_start_stk[num_mem] */ mem_end_stk--; /* for index start from 1, mem_end_stk[1]..mem_end_stk[num_mem] */ - for (i = 1; i <= num_mem; i++) { - mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX; - } #endif /* USE_SUBEXP_CALL */ + { + OnigStackIndex *pp = mem_start_stk; + for (; pp < (repeat_stk + n); pp+=2) { + pp[0] = INVALID_STACK_INDEX; + pp[1] = INVALID_STACK_INDEX; + } + } #ifdef ONIG_DEBUG_MATCH fprintf(stderr, "match_at: str: %"PRIdPTR" (%p), end: %"PRIdPTR" (%p), start: %"PRIdPTR" (%p), sprev: %"PRIdPTR" (%p)\n", -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/