changeset 36:5577a26e56a9

remove translate_cbc_interp.pl
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 16 Nov 2018 15:29:46 +0900
parents 29dd3807070e
children 5b66cfffe9cd
files cbctools/change_OP_to_cbc.pl cbctools/translate_cbc_interp.pl
diffstat 2 files changed, 4 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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;
-}