Browse Source

Fix: wrong offsets for locals when < -32768

ceriel 28 years ago
parent
commit
121acff9d8
2 changed files with 24 additions and 17 deletions
  1. 15 15
      util/ego/ra/ra.c
  2. 9 2
      util/ego/ra/ra_xform.c

+ 15 - 15
util/ego/ra/ra.c

@@ -251,6 +251,21 @@ STATIC bool useful_item(item)
 }
 
 
+STATIC cleantimeset(s)
+	lset s;
+{
+	register Lindex i;
+	register time_p t;
+
+	for (i = Lfirst(s); i != (Lindex) 0; i = Lnext(i,s)) {
+		t = (time_p) Lelem(i);
+		oldtime(t);
+	}
+	Ldeleteset(s);
+}
+
+
+
 STATIC item_p cat_items(items)
 	item_p items[];
 {
@@ -296,21 +311,6 @@ STATIC clean_interval(list)
 
 
 
-STATIC cleantimeset(s)
-	lset s;
-{
-	register Lindex i;
-	register time_p t;
-
-	for (i = Lfirst(s); i != (Lindex) 0; i = Lnext(i,s)) {
-		t = (time_p) Lelem(i);
-		oldtime(t);
-	}
-	Ldeleteset(s);
-}
-
-
-
 STATIC clean_allocs(list)
 	alloc_p list;
 {

+ 9 - 2
util/ego/ra/ra_xform.c

@@ -268,7 +268,14 @@ STATIC apply_alloc(b,l,alloc)
 	line_p newcode;
 
 	if (alloc->al_item->it_type == LOCALVAR) {
-		SHORT(l) = alloc->al_dummy;
+		if ((short) (alloc->al_dummy) == alloc->al_dummy) {
+			TYPE(l) = OPSHORT;
+			SHORT(l) = alloc->al_dummy;
+		}
+		else {
+			TYPE(l) = OPOFFSET;
+			OFFSET(l) = alloc->al_dummy;
+		}
 	} else {
 		newcode = repl_code(l,alloc->al_dummy);
 		replace_line(l,b,newcode);
@@ -491,7 +498,7 @@ xform_proc(p,alloclist,nrinstrs,instrmap)
 
 
 
-STATIC bool always_in_reg(off,allocs,size_out)
+bool always_in_reg(off,allocs,size_out)
 	offset off;
 	alloc_p allocs;
 	short *size_out;