changeset 4:535bf528d68f ansi-copy-free

copy free jump
author kono
date Thu, 13 Jan 2000 11:10:10 +0900
parents ca8e268dd7d4
children 3db1b6d78412
files mc-nop-386.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mc-nop-386.c	Thu Jan 13 10:54:33 2000 +0900
+++ b/mc-nop-386.c	Thu Jan 13 11:10:10 2000 +0900
@@ -815,9 +815,9 @@
 	emit_push();
     }
     /* compute arguments in reverse order */
-printf("# jump code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset);
+/* printf("# jump code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */
     regs = 0;
-    i=0;
+    i=MAX_REGISTER_VAR;
     for (e3=nargs; e3;e3 =cadr(e3)) {
 	n=(NMTBL *)(e5=(cadr(e4 = caddr(e3))));
 	switch(car(e4)) {
@@ -831,19 +831,23 @@
 	    break;
 	case RLVAR:
 	case CRLVAR:
-	    if (env==0) {
-		 if (e5<0 && e5==car(e3)) {
+	    if (env==0 && fnptr->sc==CODE) {
+/* printf("# e5=%d car(e3)=%d\n",e5,car(e3)); */
+		if (e5<=0 && e5==car(e3)) {
 		/* The same positioned local variable. No need to copy */
 		    reg_stack[reg_sp++] = -2;
 		}
+		break;
 	    }
 	    g_expr(e4);
 	    emit_push();
 	    break;
 	case REGISTER:
-	    if (i<MAX_REGISTER_VAR && rname[e5]==REG_ESI+i++) {
+/* printf("# i=%d rname[e5]=%d\n",i,rname[e5]); */
+	    if (i>0 && rname[e5]==REG_ESI+ --i) {
 		/* The same register variable. No need to copy */
 		reg_stack[reg_sp++] = e5;
+		break;
 	    }
 	default:
 	    g_expr(e4);
@@ -862,7 +866,7 @@
     scode = fnptr->sc; fnptr->sc = CODE;
     scode_arg_offset  = code_arg_offset;
     code_arg_offset  = new_disp;
-printf("# jump2 code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset);
+/* printf("# jump2 code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */
     /* copy arguments to destination environment if necessary */
     nargs = reverse0(nargs); /* pop in normal order */
     i=0;
@@ -1305,7 +1309,7 @@
 	printf("\tsubl $%d,%%esp\n",-disp);
     }
     code_arg_offset  = -args;
-printf("# args %d code_arg_offset=%d code_disp_offset=%d\n",args,code_arg_offset,code_disp_offset);
+/* printf("# args %d code_arg_offset=%d code_disp_offset=%d\n",args,code_arg_offset,code_disp_offset); */
 }
 
 void