In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/79d51b8d94a1a8bcf282ea7b652906d0a4233bfc?hp=7cf040c1f649790a4040aec47e47b4ce8b378728>
- Log ----------------------------------------------------------------- commit 79d51b8d94a1a8bcf282ea7b652906d0a4233bfc Author: Karl Williamson <[email protected]> Date: Mon Sep 30 09:57:55 2013 -0600 Revert "Optimise if/unless wrt OP_AND/OP_OR/OP_DOR. Also optimise OP_OR/OP_DOR chains." This reverts commit 15a4d87479c14a0808c36a762bcd182890b84815 at the submitter's request. M op.c M t/op/or.t commit 62cb07ea57fef42e83258d7f489df5a5e9e86d04 Author: Karl Williamson <[email protected]> Date: Sat Sep 28 12:06:35 2013 -0600 utf8.c: Silence Win32 compiler warnings The Win32 compiler doesn't realize that the values in these places can be a max of 255. Other compilers don't warn. M utf8.c commit 104c15725ed6beabffaa103aeb2ebc4ba6139947 Author: Karl Williamson <[email protected]> Date: Sat Sep 28 12:06:07 2013 -0600 utf8.h: White-space only I believe this makes the macro easier to read M utf8.h ----------------------------------------------------------------------- Summary of changes: op.c | 20 -------------------- t/op/or.t | 19 +------------------ utf8.c | 16 ++++++++-------- utf8.h | 3 ++- 4 files changed, 11 insertions(+), 47 deletions(-) diff --git a/op.c b/op.c index 49de893..29c9467 100644 --- a/op.c +++ b/op.c @@ -10949,9 +10949,6 @@ S_inplace_aassign(pTHX_ OP *o) { defer_queue[(defer_base + ++defer_ix) % MAX_DEFERRED] = o; \ } STMT_END -#define IS_AND_OP(o) o->op_type == OP_AND -#define IS_ORISH_OP(o) (o->op_type == OP_OR || o->op_type == OP_DOR) - /* A peephole optimizer. We visit the ops in the order they're to execute. * See the comments at the top of this file for more details about when * peep() is called */ @@ -11419,23 +11416,6 @@ Perl_rpeep(pTHX_ OP *o) while (o->op_next && ( o->op_type == o->op_next->op_type || o->op_next->op_type == OP_NULL)) o->op_next = o->op_next->op_next; - /* OP_OR/OP_DOR behave the same wrt op_next */ - if (IS_ORISH_OP(o)) { - while (o->op_next && ( IS_ORISH_OP(o->op_next) - || o->op_next->op_type == OP_NULL)) - o->op_next = o->op_next->op_next; - } - /* if we're an OR/DOR and our next is a AND in void context, we'll - follow it's op_other on short circuit, same for reverse */ - if (o->op_next && - ( - (IS_AND_OP(o) && IS_ORISH_OP(o->op_next)) - || (IS_ORISH_OP(o) && IS_AND_OP(o->op_next)) - ) - && (o->op_next->op_flags & OPf_WANT) == OPf_WANT_VOID - ) { - o->op_next = ((LOGOP*)o->op_next)->op_other; - } DEFER(cLOGOP->op_other); o->op_opt = 1; diff --git a/t/op/or.t b/t/op/or.t index 2a85ff5..5260780 100644 --- a/t/op/or.t +++ b/t/op/or.t @@ -25,7 +25,7 @@ sub FETCH { package main; require './test.pl'; -plan( tests => 10 ); +plan( tests => 8 ); my ($a, $b, $c); @@ -66,20 +66,3 @@ $c = $a || $b; local $TODO = 'Double FETCH'; is($c, 1, ' $tied || $var'); } - -my $aa, $bb, $cc; -$bb = 1; - -my $res = 0; -# Well, really testing OP_DOR I guess -unless ($aa || $bb // $cc) { - $res = 1; -} -is($res, 0, "res is 0 after mixed OR/DOR"); - -$res = 0; -unless ($aa // $bb || $cc) { - $res = 1; -} -is($res, 0, "res is 0 after mixed DOR/OR"); - diff --git a/utf8.c b/utf8.c index c8bbaea..52c3143 100644 --- a/utf8.c +++ b/utf8.c @@ -2609,8 +2609,8 @@ Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } @@ -2675,8 +2675,8 @@ Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } @@ -2740,8 +2740,8 @@ Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } @@ -2870,8 +2870,8 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, b *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } diff --git a/utf8.h b/utf8.h index 76b89a4..1efa5d3 100644 --- a/utf8.h +++ b/utf8.h @@ -368,7 +368,8 @@ Perl's extended UTF-8 means we can have start bytes up to FF. * These expand identically to the TWO_BYTE versions on ASCII platforms, but * use to/from LATIN1 instead of UNI, which on EBCDIC eliminates tests */ #define UTF8_EIGHT_BIT_HI(c) I8_TO_NATIVE_UTF8((NATIVE_TO_LATIN1(c) \ - >> UTF_ACCUMULATION_SHIFT) | UTF_START_MARK(2)) + >> UTF_ACCUMULATION_SHIFT) \ + | UTF_START_MARK(2)) #define UTF8_EIGHT_BIT_LO(c) I8_TO_NATIVE_UTF8((NATIVE_TO_LATIN1(c) \ & UTF_CONTINUATION_MASK) \ | UTF_CONTINUATION_MARK) -- Perl5 Master Repository
