[m-dev.] Re: functor and arg break encapsulation

Tyson Richard DOWD trd at students.cs.mu.oz.au
Tue Feb 11 11:28:31 AEDT 1997


> 
> There is another issue this problem raises - dead procedure elimination
> assumes that if the definition of a type is local, then we can eliminate
> the Unify, Index and Compare predicates for that type if no type_info is
> used. This now gets more complex - if any type in the module that is
> exported is built up out of local types, those types can be extracted
> from the exported type using arg/3. So the definition of liveness for
> procedures has to be extended to include references from the
> pseudo_type_infos for exported types (for baffled readers, a
> pseudo_type_info is just like a type info, but might contain variables
> in its type arguments, they get generated as part of the
> base_type_layouts, describing the types of arguments of constructors).
> I'll be fixing this problem soon.

This problem is a touch more complex than I previously thought - pragma
C code will probably want to be able to reference base_type_layouts
and base_type_infos (for instance, solutions needs to deep copy a list,
so it refers to the base_type_info for lists). If dead_proc_elim decides
to eliminate them, or even just to neuter them (remove references to
procs in them), then you'll get link errors, or runtime errors.
The link errors aren't so bad, but the runtime errors might be hidden
for quite some time.

So I think for the moment, until someone wants to tackle this problem,
I'll assume all base_type_infos are needed, and cannot be removed, hence
all Unify Index and Compare predicates are needed.

If we introduce a more comprehensive foreign language interface, we can
probably do this analysis properly...
	:- pragma c_code_uses_type(list/1).

-- 
       Tyson Dowd           #          Another great idea from the 
                            #            people who brought you
      trd at .cs.mu.oz.au      #               Beer Milkshakes!
http://www.cs.mu.oz.au/~trd #	         Confidence --- Red Dwarf



More information about the developers mailing list