# HG changeset patch # User Takahiro SHIMIZU # Date 1542349786 -32400 # Node ID 5577a26e56a9a94395c036d49819723b01ca7114 # Parent 29dd3807070e0480c5f7b821d090c6936dadd60c remove translate_cbc_interp.pl diff -r 29dd3807070e -r 5577a26e56a9 cbctools/change_OP_to_cbc.pl --- a/cbctools/change_OP_to_cbc.pl Wed Nov 14 14:09:08 2018 +0900 +++ b/cbctools/change_OP_to_cbc.pl Fri Nov 16 15:29:46 2018 +0900 @@ -117,8 +117,10 @@ sub change_i { my $str = shift; - $str =~ s/^op/i->op/g; - $str =~ s/cur_op/i->cur_op/g; + #$str =~ s/^op/i->op/g; + $str =~ s/(\A)op|([\s,(])op/$2 i->op/g; + $str =~ s/(\A)cu|([\s,(])cu/$2 i->cu/g; + $str =~ s/(\A)cur_op|([\s,(])cur_op/i->cur_op/g; $str =~ s/([,(])cu/$1i->tc/g; $str =~ s/tc/i->tc/g; $str =~ s/cur_callsite/i->cur_callsite/g; diff -r 29dd3807070e -r 5577a26e56a9 cbctools/translate_cbc_interp.pl --- a/cbctools/translate_cbc_interp.pl Wed Nov 14 14:09:08 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -my $interpfile = shift or die; - -open my $fh, '<',$interpfile; -my @interp_lines = <$fh>; -close $fh; - - -my @translated = (); -my $none_left_blanket = 0; -my $index = 0; - -while ( $interp_lines[$index] !~ /\/\* This is the interpreter run loop. We have one of these per thread. \*\//){ - if ($interp_lines[$index] =~ /GET_(REG|LEX)/){ - $interp_lines[$index] = insert_i_4_GET_R_L($interp_lines[$index]); - } - - if ($interp_lines[$index] =~ /NEXT_OP/){ - $interp_lines[$index] = change_i($interp_lines[$index]); - } - - # マクロ部分の置き換え - if ( $interp_lines[$index] =~ /#if MVM_CGOTO/){ - while ($interp_lines[$index] !~ /#endif/){ - $index++; - } - $index++; - print insert_CbC_macro(); - } - print "$interp_lines[$index]"; - $index++; -} - -sub change_i { - my $str = shift; - $str =~ s/^op/i->op/g; - $str =~ s/cur_op/i->cur_op/g; - $str =~ s/([,(])cu/$1i->tc/g; - $str =~ s/tc/i->tc/g; - $str =~ s/cur_callsite/i->cur_callsite/g; - $str =~ s/NEXT;/cbc_next(i);/; - $str =~ s/ / /g; - return $str; -} - -sub insert_i_4_GET_R_L { - my $str = shift; - $str =~ s/tc/i->tc/g; - $str =~ s/reg_base/i->reg_base/g; - $str =~ s/GET_(REG|LEX)\((.*?)\)/GET_$1($2,i)/g; - return $str; -} - -sub insert_CbC_macro { - my $msg = << 'EOF'; -#define DISPATCH(op) {goto (CODES[op])(i);} -#define OP(name) OP_ ## name -#define NEXT(i) CODES[NEXT_OP(i)](i) -EOF - return $msg; -}