Mercurial > hg > CbC > old > device
changeset 548:650717de878b
*** empty log message ***
author | kono |
---|---|
date | Tue, 03 Jan 2006 15:40:57 +0900 |
parents | 9defd9459016 |
children | 25e61d68c545 |
files | .gdbinit Changes mc-codegen.c mc-parse.c test/strinit.c |
diffstat | 5 files changed, 49 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Tue Jan 03 12:02:26 2006 +0900 +++ b/.gdbinit Tue Jan 03 15:40:57 2006 +0900 @@ -44,6 +44,5 @@ # run -s test/inline.c # run -s test/code-gen-inline.c # run -s -DINLINE=inline test/basic.c -run -s test/too-long-argument.c - - +# run -s test/too-long-argument.c +# run -s test/strinit.c
--- a/Changes Tue Jan 03 12:02:26 2006 +0900 +++ b/Changes Tue Jan 03 15:40:57 2006 +0900 @@ -7783,3 +7783,7 @@ decl_data で、構造体の中身の代入には assign_data で代入文が 出てしまうらしい。でも、それでもemit_dataに飛ぶ理由は不明だな。 +Tue Jan 3 15:39:54 JST 2006 + +あぁ、なんか、union のdispの問題が今ごろ明らかになっているらしい。 +
--- a/mc-codegen.c Tue Jan 03 12:02:26 2006 +0900 +++ b/mc-codegen.c Tue Jan 03 15:40:57 2006 +0900 @@ -2959,6 +2959,10 @@ return 2; // allow override keep unique } +// +// generate constant on global memory +// + static void emit_data(int e, int t, NMTBL *n) { @@ -3033,6 +3037,10 @@ error(INERR); } +// +// local variable initialization +// + extern int assign_data(int e, int t, NMTBL *n,int offset) { @@ -3066,8 +3074,9 @@ if (!is_const(e)) error(INERR); else emit_data(e,t,n); } else if(mode==SFDINIT) { +printf("## %d sfdinit c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset); decl_str_init=insert_ascend(decl_str_init, - list4(offset,0,e,t),str_init_eq); + list4(offset,0,e,list2(t,type)),str_init_eq); } else { error(DCERR); return offset; @@ -3093,24 +3102,26 @@ int offset; int offset0=0; int e; - int type,sz,offset1=0; + int t,sz,offset1=0; int smode=mode; mode = STADECL; sz = size(n->ty); /* decl_str_init output delayed decl data - list4(offset,next,expression,type); + list4(offset,next,expression,list2(type0,type1)); */ while (decl_str_init) { offset= car(decl_str_init); e=caddr(decl_str_init); - type=cadddr(decl_str_init); + t=car(cadddr(decl_str_init)); if (offset!=offset0) { // make space assign_data(list2(CONST,offset-offset0),EMPTY,n,offset0); } - offset0 = assign_data(e,type,n,offset); + type=cadr(cadddr(decl_str_init)); +printf("## %d flush c0(e)=%d type=%d t=%d offset=%d\n",lineno,car(e),type,t,offset); + offset0 = assign_data(e,t,n,offset); decl_str_init = cadr(decl_str_init); } offset = offset0;
--- a/mc-parse.c Tue Jan 03 12:02:26 2006 +0900 +++ b/mc-parse.c Tue Jan 03 15:40:57 2006 +0900 @@ -1388,7 +1388,7 @@ local_struct_static(NMTBL *n) { NMTBL *nptr0; - int t,sz = size(type),offset=0; + int sz = size(type),offset=0; int smode = mode; // uninitialized part should be 0. // local var init cannot postponed because of assign_expr0/type @@ -1397,11 +1397,12 @@ if (local_nptr) error(-1); local_nptr = n; // will be clear in flush + mode=STADECL; nptr0=new_static_name("__lstruct",'_'); - nptr0->next = local_static_list; local_static_list = nptr0; - nptr0->sc = STATIC; - nptr0->ty = t = type; - mode=STADECL; + def(nptr0,0); + //nptr0->next = local_static_list; local_static_list = nptr0; + //nptr0->sc = STATIC; + //nptr0->ty = t = type; decl_data_field(type,nptr0,offset); // do struct assignment before flushed assignment expression init_vars = list2(
--- a/test/strinit.c Tue Jan 03 12:02:26 2006 +0900 +++ b/test/strinit.c Tue Jan 03 15:40:57 2006 +0900 @@ -139,10 +139,31 @@ printf("%d %d\n",fl.oif,fl.uli_u.ports.dport); } +static +int ip_route_connect0(/* struct rtable **rp, */ u32 dst, + u32 src, u32 tos, int oif, u8 protocol, + u16 sport, u16 dport /*, struct sock *sk */) +{ + struct flowi fl = { .oif = oif, + .iif = 55, + .nl_u = { .ip4_u = { .daddr = dst, + .saddr = 66, + .tos = tos } }, + .proto = protocol, + .uli_u = { .ports = + { .sport = sport, + .dport = dport } } }; + + printf("%d %d\n",fl.oif,fl.uli_u.ports.dport); + printf("%d %d\n",fl.iif,fl.nl_u.ip4_u.saddr); +} + void linux_kernel() { + ip_route_connect0(1,2,3,4,5,6,7); ip_route_connect(1,2,3,4,5,6,7); + ip_route_connect(11,12,13,14,15,16,17); } // end