summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-01-05 19:44:48 -0600
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-01-06 14:35:38 +0000
commit3edf23ff129b6c5edde184cb3b63953432223591 (patch)
tree778d37e2ba800ef9dffb218e6f442b67543d78ab
parente05f6b2748347b09803ee2a25d063e2d15378ffb (diff)
downloadperl-3edf23ff129b6c5edde184cb3b63953432223591.tar.gz
performance tweaking op.c
Message-ID: <20060106074448.GB3401@petdance.com> p4raw-id: //depot/perl@26674
-rw-r--r--op.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/op.c b/op.c
index b9b144083c..065c684dfa 100644
--- a/op.c
+++ b/op.c
@@ -209,10 +209,11 @@ PADOFFSET
Perl_allocmy(pTHX_ char *name)
{
PADOFFSET off;
+ const bool is_our = (PL_in_my == KEY_our);
/* complain about "my $<special_var>" etc etc */
if (*name &&
- !(PL_in_my == KEY_our ||
+ !(is_our ||
isALPHA(name[1]) ||
(USE_UTF8_IN_NAMES && UTF8_IS_START(name[1])) ||
(name[1] == '_' && (*name == '$' || name[2]))))
@@ -241,22 +242,19 @@ Perl_allocmy(pTHX_ char *name)
}
/* check for duplicate declaration */
- pad_check_dup(name,
- (bool)(PL_in_my == KEY_our),
- (PL_curstash ? PL_curstash : PL_defstash)
- );
+ pad_check_dup(name, is_our, (PL_curstash ? PL_curstash : PL_defstash));
if (PL_in_my_stash && *name != '$') {
yyerror(Perl_form(aTHX_
"Can't declare class for non-scalar %s in \"%s\"",
- name, PL_in_my == KEY_our ? "our" : "my"));
+ name, is_our ? "our" : "my"));
}
/* allocate a spare slot and store the name in that slot */
off = pad_add_name(name,
PL_in_my_stash,
- (PL_in_my == KEY_our
+ (is_our
/* $_ is always in main::, even with our */
? (PL_curstash && !strEQ(name,"$_") ? PL_curstash : PL_defstash)
: NULL
@@ -507,19 +505,25 @@ Perl_op_refcnt_unlock(pTHX)
OP *
Perl_linklist(pTHX_ OP *o)
{
+ OP *first;
if (o->op_next)
return o->op_next;
/* establish postfix order */
- if (cUNOPo->op_first) {
+ first = cUNOPo->op_first;
+ if (first) {
register OP *kid;
- o->op_next = LINKLIST(cUNOPo->op_first);
- for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) {
- if (kid->op_sibling)
+ o->op_next = LINKLIST(first);
+ kid = first;
+ for (;;) {
+ if (kid->op_sibling) {
kid->op_next = LINKLIST(kid->op_sibling);
- else
+ kid = kid->op_sibling;
+ } else {
kid->op_next = o;
+ break;
+ }
}
}
else