changeset 729:07dce42b67af ia32

examples for gcc
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 29 Sep 2009 19:15:37 +0900
parents c02a35845a70
children 9bad72e27174
files test/conv.c test/conv1.c test/test1.c
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/conv.c	Thu Aug 20 17:24:43 2009 +0900
+++ b/test/conv.c	Tue Sep 29 19:15:37 2009 +0900
@@ -71,6 +71,7 @@
 char main_stack[STACK_SIZE];
 #define stack_last (&main_stack[STACK_SIZE])
 
+int
 main()
 {
     struct main_continuation *cont;
@@ -84,6 +85,8 @@
     cont->main_ret = __return;
     cont->env = __environment;
     goto f(233,sp);
+
+    return 0;
 }
 
 /* end */
--- a/test/conv1.c	Thu Aug 20 17:24:43 2009 +0900
+++ b/test/conv1.c	Tue Sep 29 19:15:37 2009 +0900
@@ -37,6 +37,8 @@
     __code (*ret)();
 };
 
+__code f_g0(int i,int k,stack sp) ;
+
 __code f(int i,stack sp) {
     int k,j;
     k = 3+i;
@@ -49,6 +51,7 @@
 };
 
 __code f_g1(int j,stack sp);
+__code g(int i,stack sp) ;
 
 __code f_g0(int i,int k,stack sp) { // Caller
     struct f_g0_interface *c = 
@@ -70,6 +73,7 @@
 }
 
 __code g_h1(int j,stack sp);
+__code h(int i,stack sp) ;
 
 __code g(int i,stack sp) { // Caller
     struct f_g0_interface *c = 
@@ -96,7 +100,7 @@
 
 struct main_continuation { // General Return Continuation
     __code (*ret)();
-    __code (*main_ret)();
+    __code (*main_ret)(int,void *);
     void *env;
 };
 
@@ -110,17 +114,23 @@
 
 /* little optimzation without stack continuation (2) */
 
+__code g2(int i,int k,int j,char *sp) ;
+
 __code f2(int i,char *sp) {
     int k,j;
     k = 3+i;
     goto g2(i,k,i+3,sp);
 }
 
+__code h2(int i,int k,char *sp) ;
+
 __code g2(int i,int k,int j,char *sp) {
     j = j+4;
     goto h2(i,k+4+j,sp);
 }
 
+__code main_return2(int i,stack sp) ;
+
 __code h2_1(int i,int k,int j,char *sp) {
     goto main_return2(i+j,sp);
 }
@@ -139,12 +149,16 @@
 
 /* little optimizaed case (3) */
 
+__code g2_1(int k,int i,char *sp) ;
+
 __code f2_1(int i,char *sp) {
     int k,j;
     k = 3+i;
     goto g2_1(k,i+3,sp);
 }
 
+__code h2_11(int i,int k,char *sp) ;
+
 __code g2_1(int k,int i,char *sp) {
     goto h2_11(k,i+4,sp);
 }
--- a/test/test1.c	Thu Aug 20 17:24:43 2009 +0900
+++ b/test/test1.c	Tue Sep 29 19:15:37 2009 +0900
@@ -85,6 +85,8 @@
 	goto f(i,sp);
 }
 
+__code print(int i,int j,__code (*exit1)(),void*exit1env);
+
 __code f1(int i,void *sp) {
 	int j;
 	int *exit2env;