changeset 158:7bc02f0800a9

fix conv1
author kono
date Thu, 14 Aug 2003 01:37:19 +0900
parents d5310a5cc8fa
children b80e9737c3ce
files Changes Makefile test/conv1.c
diffstat 3 files changed, 70 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Tue Aug 05 14:50:37 2003 +0900
+++ b/Changes	Thu Aug 14 01:37:19 2003 +0900
@@ -3304,3 +3304,64 @@
 関数scope 内の staticの初期化が通らないんですけど。
 
 直りました。対応してなかったみたいね。
+
+Wed Aug  6 12:07:07 JST 2003
+
+[kono@pw001 ~/device]% ./mc -s test/conv1.c
+[kono@pw001 ~/device]% gcc test/conv1.s
+[kono@pw001 ~/device]% time ./a.out 1
+セグメントエラー (coreを出力しました)
+0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 73pf+0w
+[kono@pw001 ~/device]% time ./a.out 2
+470
+0.350u 0.000s 0:00.35 100.0%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.650u 0.010s 0:00.65 101.5%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 1
+セグメントエラー (coreを出力しました)
+0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 73pf+0w
+[kono@pw001 ~/device]% time ./a.out 2
+470
+0.350u 0.000s 0:00.35 100.0%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 3
+720
+0.380u 0.000s 0:00.38 100.0%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 4
+0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 77pf+0w
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.660u 0.000s 0:00.65 101.5%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 1
+セグメントエラー (coreを出力しました)
+0.010u 0.000s 0:00.00 0.0%      0+0k 0+0io 73pf+0w
+[kono@pw001 ~/device]% time ./a.out 2
+470
+0.350u 0.010s 0:00.35 102.8%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 3
+720
+0.390u 0.000s 0:00.38 102.6%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% time ./a.out 4
+0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 77pf+0w
+[kono@pw001 ~/device]% gcc test/conv1.c
+[kono@pw001 ~/device]% time ./a.out 1
+0.000u 0.000s 0:00.00 0.0%      0+0k 0+0io 77pf+0w
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.430u 0.000s 0:00.42 102.3%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% gcc -O test/conv1.c
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.370u 0.000s 0:00.36 102.7%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% gcc -O2 test/conv1.c
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.370u 0.000s 0:00.37 100.0%    0+0k 0+0io 88pf+0w
+[kono@pw001 ~/device]% gcc -O6 test/conv1.c
+[kono@pw001 ~/device]% time ./a.out 0
+720
+0.240u 0.010s 0:00.25 100.0%    0+0k 0+0io 88pf+0w
+
+Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.95.3/specs
+gcc version 2.95.3 20010315 (release)
+Intel Architecture だと、結構、良い線いっているみたい。
--- a/Makefile	Tue Aug 05 14:50:37 2003 +0900
+++ b/Makefile	Thu Aug 14 01:37:19 2003 +0900
@@ -52,6 +52,7 @@
 	make check TARGET=test/tmp7
 	make check TARGET=test/tmp8
 	make check TARGET=test/tmp9
+	make check TARGET=test/static
 
 check: $(MC)
 	-gcc $(TARGET).c -o b.out $(MLIB)
--- a/test/conv1.c	Tue Aug 05 14:50:37 2003 +0900
+++ b/test/conv1.c	Thu Aug 14 01:37:19 2003 +0900
@@ -62,8 +62,9 @@
 code f_g1(int j,stack sp) {  // Continuation 
     struct f_g0_interface *c = sp;
     int k = c->k_;
-    sp += sizeof(struct f_g0_interface);
-    goto (( (struct cont_interface *)sp)->ret)(k+4+j,sp);
+    sp+=sizeof(struct f_g0_interface);
+    c = (struct f_g0_interface *)sp;
+    goto (c->ret)(k+4+j,sp);
 }
 
 code g(int i,stack sp) { // Caller
@@ -79,12 +80,14 @@
 code g_h1(int j,stack sp) {  // Continuation 
     struct f_g0_interface *c = sp;
     int i = c->i_;
-    sp += sizeof(struct f_g0_interface);
-    goto (( (struct cont_interface *)sp)->ret)(j+i,sp);
+    sp+=sizeof(struct f_g0_interface);
+    c = (struct f_g0_interface *)sp;
+    goto (c->ret)(j+i,sp);
 }
 
 code h(int i,stack sp) {
-    goto (( (struct cont_interface *)sp)->ret)(i+4,sp);
+    struct f_g0_interface *c = sp;
+    goto (c->ret)(i+4,sp);
 }
 
 struct main_continuation { // General Return Continuation