changeset 801:6b93d95a1564

lvar align
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 24 Nov 2010 13:28:11 +0900
parents c3957d127e17
children bdb63568ca08
files .gdbinit mc-inline.c test/ps2.c
diffstat 3 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Wed Nov 24 10:50:18 2010 +0900
+++ b/.gdbinit	Wed Nov 24 13:28:11 2010 +0900
@@ -27,7 +27,8 @@
 # r -s test/float.c
 # r -s test/strinit.c
 # r -s test/bitfield.c
-r -s test/tstdarg.c
+# r -s test/tstdarg.c
+r -s test/ps2.c
 # r -s test/arg.c
 # r -s test/obsf2.c
 # r -s test/putenemy.c
--- a/mc-inline.c	Wed Nov 24 10:50:18 2010 +0900
+++ b/mc-inline.c	Wed Nov 24 13:28:11 2010 +0900
@@ -993,8 +993,12 @@
 	}
 	if (n->sc==FLABEL)
 	    v = list3n(LVAR,fwdlabel(),n);
-	else
-	    v = list3n(LVAR,new_lvar(size(n->ty)),n);
+	else {
+	    NMTBL tn;
+	    tn = *n;
+	    code_lvar_alignment(disp,&tn,n->ty,size(n->ty));
+	    v = list3n(LVAR,tn.dsp,n);
+	}
     }
     if (n->sc!=FLABEL)
 	inline_lvars = glist2(v,inline_lvars);
--- a/test/ps2.c	Wed Nov 24 10:50:18 2010 +0900
+++ b/test/ps2.c	Wed Nov 24 13:28:11 2010 +0900
@@ -76,8 +76,8 @@
     if(!this) return;
     if(this->mtd)  this->mtd( this );
     if(this->draw) this->draw( this, work, base );
-    printf("#0078:offset draw %d\n",((char*)(&this->draw) - ((char*)&this->object)));
-    printf("#0079:offset next %d\n",((char*)(&this->next) - ((char*)&this->object)));
+    printf("#0078:offset draw %ld\n",((char*)(&this->draw) - ((char*)&this->object)));
+    printf("#0079:offset next %ld\n",((char*)(&this->next) - ((char*)&this->object)));
 
     if(this->child) graphic_ObjNode_draw( this->child, work );
     if(this->next)  graphic_ObjNode_draw( this->next,  base );
@@ -92,7 +92,7 @@
 }
 
 
-#define mod16(a) (((int)(&a))%16)
+#define mod16(a) (((long)(&a))%16)
 
 int
 align16(int i, FMATRIX a, FMATRIX b) {
@@ -102,9 +102,9 @@
    FMATRIX o;
    if (i==0) return i;
 #ifdef OFFSET
-   printf("#0104:offset %d\n",((char*)a) - ((char*)(&m)));
+   printf("#0104:offset %ld\n",((char*)a) - ((char*)(&m)));
 #endif
-   printf("#0106:%d %d %d\n",mod16(m),mod16(n),mod16(o));
+   printf("#0106:%ld %ld %ld\n",mod16(m),mod16(n),mod16(o));
    align16(i-1,m,n);
    return k;
 }
@@ -117,9 +117,9 @@
    FMATRIX1 o;
    if (i==0) return i;
 #ifdef OFFSET
-   printf("#0119:offset %d\n",((char*)a) - ((char*)(&m)));
+   printf("#0119:offset %ld\n",((char*)a) - ((char*)(&m)));
 #endif
-   printf("#0121:%d %d %d\n",mod16(m),mod16(n),mod16(o));
+   printf("#0121:%ld %ld %ld\n",mod16(m),mod16(n),mod16(o));
    align16_1(i-1,m,n);
    return k;
 }
@@ -139,13 +139,13 @@
     align16_1(2,m,m);
     graphic_ObjNode_draw( &p, m);
 
-    printf("#0141:sizeof(aligns)==%d %d\n",
+    printf("#0141:sizeof(aligns)==%ld %ld\n",
 	sizeof(aligns),sizeof(aligns1));
-    printf("#0143:sizeof(aligns)/sizeof(void *)==%d\n",
+    printf("#0143:sizeof(aligns)/sizeof(void *)==%ld\n",
 	sizeof(aligns)/sizeof(void *));
 
     for(i=0;i<sizeof(aligns)/sizeof(void *);i++) {
-	printf("#0147:align10%d %d\n",i,mod16(aligns[i]));
+	printf("#0147:align10%ld %ld\n",i,mod16(aligns[i]));
     }
 
 }