[m-dev.] New type_layout traversal code

Tyson Richard DOWD trd at students.cs.mu.oz.au
Fri Feb 21 10:15:48 AEDT 1997


> > 	return new_data;
> > process_complicated :
> > 	if (in_range(data_value)) {
> > 		Word secondary_tag = ((Word *) data_value)[0];
> > 		Word new_entry_value = ((Word *) entry_value)[secondary_tag + 
> > 				TYPELAYOUT_COMPLIC_ENTRY_OFFSET];
> > 		Word new_entry_tag = tag(entry_value);
> > 		Word new_entry_body = body(new_entry_value, new_entry_tag);
> > 		Word new_data_value  = (Word) ((Word *) data_value)[1];
> > 		data_value = new_data_value;
> > 		entry_value = new_entry_body;
> > 		goto process_simple;
> > 	} else {
> > 		return data_word;
> > 	}
> 
> That is a particularly awful kind of goto, because
> there is no indication at the label that it is the target
> of more than one goto, or that "process_simple" is in fact
> used for processing complicated tags.

The code there is also incorrect, since it doesn't seem to copy the 
secondary tag. Copying a compilicated tag data item is not the same
as copying a simple - you need to allocate arity + 1 words, not just arity,
and copy the secondary tag before the arguments.

The code that could be shared is the code to copy arguments, but that
might be better in a function.

---
       Tyson Dowd           # 
                            # Why are there no "B" batteries? 
     trd at cs.mu.oz.au        #  
http://www.cs.mu.oz.au/~trd #



More information about the developers mailing list