# New Ticket Created by Leopold Toetsch # Please include the string: [perl #17158] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17158 >
This patch eliminates identical function bodies in core_ops_prederef.* thus saving ~ 160 KB per executable. s. also comment in patch. Please apply. leo PS tested with $ perl6 --test -r -RGP -O2 ...... All tests successful, 2 subtests skipped. -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/37197/30122/261a45/ops2c.pl.diff
--- ops2c.pl Fri Sep 6 10:07:59 2002 +++ /home/lt/src/parrot-leo/ops2c.pl Wed Sep 11 17:50:10 2002 @@ -152,6 +152,7 @@ my @op_func_table; my $index = 0; +my ($prev_source, $prev_func_name); foreach my $op ($ops->ops) { my $func_name = $op->func_name; @@ -162,9 +163,34 @@ my $source = $op->source($trans); # print HEADER "$prototype;\n"; - - push @op_func_table, sprintf(" %-50s /* %6ld */\n", "$func_name,", $index++); +# +# for predereferenced code all variants of one op with or without +# "c" suffix generate the same function body +# +# e.g. +# +# set i,i,i +# set i,ic,i +# set i,i,ic +# set i,ic,ic +# +# have all the same function body, and thus we generate only the +# first one and change the op_func_table accordingly + + if ($prev_source && $prev_source eq $source) { + push @op_func_table, sprintf(" %-50s /* %6ld */\n", + "$prev_func_name,", $index++); + push @op_funcs, <<"EOF"; + /* $func_name => $prev_func_name */ +EOF + } + else { + push @op_func_table, sprintf(" %-50s /* %6ld */\n", + "$func_name,", $index++); push @op_funcs, "$definition {\n$source}\n\n"; + $prev_source = $source; + $prev_func_name = $func_name; + } } print SOURCE <<END_C;