--- Faster/Faster.pm 2006/03/12 21:36:00 1.29 +++ Faster/Faster.pm 2006/03/13 16:59:36 1.30 @@ -73,7 +73,7 @@ $COMPILE =~ s/-f(?:PIC|pic)//g if $Config{archname} =~ /^(i[3456]86)-/; -my $opt_assert = $ENV{FASTER_DEBUG}; +my $opt_assert = $ENV{FASTER_DEBUG} > 1; my $verbose = $ENV{FASTER_VERBOSE}+0; warn "Faster: CACHEDIR is $CACHEDIR\n" if $verbose > 2; @@ -147,21 +147,21 @@ mapstart grepstart match entereval enteriter entersub leaveloop - pushmark nextstate + pushmark nextstate caller const stub unstack - last next redo seq + last next redo goto seq padsv padav padhv padany aassign sassign orassign rv2av rv2cv rv2gv rv2hv refgen gv gvsv add subtract multiply divide - complement cond_expr and or not + complement cond_expr and or not bit_and bit_or bit_xor defined method method_named bless preinc postinc predec postdec aelem aelemfast helem delete exists - pushre subst list join split concat + pushre subst list lslice join split concat length substr stringify ord push pop shift unshift eq ne gt lt ge le @@ -227,7 +227,7 @@ } sub op_pushmark { - $source .= " PUSHMARK (PL_stack_sp);\n"; + $source .= " faster_PUSHMARK (PL_stack_sp);\n"; out_next; } @@ -517,6 +517,7 @@ my %opsseen; my @todo = $cv->START; my %op_target; + my $numpushmark; while (my $op = shift @todo) { for (; $$op; $op = $op->next) { @@ -560,8 +561,14 @@ push @todo, @targ; $op_target{$$_}++ for @targ; + } elsif ($class eq "COP") { $insn->{bblock}++ if defined $op->label; + + } else { + if ($name eq "pushmark") { + $numpushmark++; + } } } } @@ -574,6 +581,9 @@ register OP *nextop = (OP *)${$ops[0]->{op}}L; EOF + $source .= " faster_PUSHMARK_PREALLOC ($numpushmark);\n" + if $numpushmark; + while (@ops) { $insn = shift @ops; @@ -683,6 +693,14 @@ #include "perl.h" #include "XSUB.h" +#if 1 +# define faster_PUSHMARK_PREALLOC(count) while (PL_markstack_ptr + (count) >= PL_markstack_max) markstack_grow () +# define faster_PUSHMARK(p) *++PL_markstack_ptr = (p) - PL_stack_base +#else +# define faster_PUSHMARK_PREALLOC(count) 1 +# define faster_PUSHMARK(p) PUSHMARK(p) +#endif + #define RUNOPS_TILL(op) \\ while (nextop != (op)) \\ { \\ @@ -703,7 +721,7 @@ close $fh; system "$COMPILE -o $stem$_o $stem.c"; - unlink "$stem.c"; + unlink "$stem.c" unless $ENV{FASTER_DEBUG} > 0; system "$LINK -o $stem$_so $stem$_o $LIBS"; unlink "$stem$_o"; } @@ -803,8 +821,8 @@ =item FASTER_DEBUG Add debugging code when set to values higher than C<0>. Currently, this -adds 1-3 C's per perl op, to ensure that opcode order and C -execution order are compatible. +adds 1-3 C's per perl op (FASTER_DEBUG > 1), to ensure that opcode +order and C execution order are compatible. =item FASTER_CACHE