OK then, here is the patch, of course I don't expect this to be commited since it's crap but if you test it (please do it) and it's ok for everyone I will rewrite it more efficiently.
*PLEASE* test it and give me some feedback. Thanks in advance. On Thu, 1 Nov 2001, Simon Cozens wrote: > On Thu, Nov 01, 2001 at 10:31:07AM -0500, Dan Sugalski wrote: > > So it looks like about a 2.5 speedup with computed goto. Cool. > > Looks really good to me, too. Where's the patch? This should probably > go in as an alternate runops core. > > -- > The problem with big-fish-little-pond situations is that you > have to put up with all these fscking minnows everywhere. > -- Rich Lafferty >
39c39 < while (pc) { DO_OP(pc, interpreter); } --- > just_do_it(interpreter,pc);
107a108,109 > my @op_labels; > my @op_addr; 116a119 > my $label = "PC_$index:\n"; 117a121 > my $source_goto= $op->source(\&map_ret_abs_goto, \&map_ret_rel_goto, \&map_arg, >\&map_res_abs, \&map_res_rel); 118a123 > push @op_addr, " &&PC_$index,\n"; 121a127 > push @op_labels, "$label {\n$source_goto}\n\n"; 129c135,136 < print SOURCE <<END_C; --- > if ($ARGV[0] eq "core.ops") { > print SOURCE <<END_C; 132a140 > int just_do_it(struct Parrot_Interp *, opcode_t *); 137a146,150 > int > just_do_it(struct Parrot_Interp *interpreter, opcode_t * cur_opcode) > { > > static void *ops_l[] = { 140c153,157 < print SOURCE @op_funcs; --- > print SOURCE @op_addr; > > print SOURCE <<END_C; > }; > goto *ops_l[*cur_opcode]; 141a159,171 > END_C > > print SOURCE @op_labels; > > print SOURCE "}\n"; > } else { > print SOURCE <<END_C; > NULL > }; > END_C > } > > print SOURCE @op_funcs; 188a219,242 > > # > # map_ret_abs_goto() > # > > sub map_ret_abs_goto > { > my ($addr) = @_; > if ($addr eq '0') { > return "return (0);" > } else { > return "goto *ops_l[*(cur_opcode = $addr)]"; > } > } > > # > # map_ret_rel_goto() > # > > sub map_ret_rel_goto > { > my ($offset) = @_; > return "goto *ops_l[*(cur_opcode += $offset)]"; > }