[m-dev.] for review: cleanup of type_ctor_infos, relative diff 1
Tyson Dowd
trd at cs.mu.OZ.AU
Thu Mar 9 21:56:15 AEDT 2000
> @@ -483,18 +535,29 @@
> Vector = create(0, MaybePseudoTypeInfos, initial(LldsTypes, none),
> must_be_static, CN, "arg_types", Reuse).
>
> -:- pred base_type_layout__generate_pseudotypeinfos(list(constructor_arg)::in,
> +% For each argument of a functor, return three items of information:
> +% its name (if any), a pseudotypeinfo describing its type (and the llds_type
> +% that describes the pseudotypeinfo), and an indication whether the type
> +% contains variables or not. The last item is encoded as an integer
> +% which contains a 1 bit in the position given by 1 << N if argument N's type
> +% contains variables (assuming that arguments are numbered starting from zero).
> +% The number of bits in the integer is given by contains_var_bit_vector_size;
> +% arguments beyond this limit do not contribute to this bit vector.
If you are going to ignore high numbered arguments, the last bit should
be set to 1 if there are contains_var_bit_vector_size arguments or more.
So there should be contains_var_bit_vector_size - 1 bits that correspond
to "ground" or "non-ground" and one bit that says
"there are more arugments that must be tested individually".
If you do it the way you have currently, someone will end up writing
incorrect code that does:
if (bitvector == 0) {
special case code that doesn't do any variable
substitutions
}
But if you pass them something with contains_var_bit_vector_size
ground arguments and a few later non-ground arguments, this could be
very bad.
> @@ -288,18 +278,49 @@
> { LayoutInfo = no_layout },
> io__write_string("{ 0 }")
> ),
> - io__write_string(",\n\t"),
> - (
> - { MaybeHashCons = yes(HashConsDataAddr) },
> - io__write_string("&"),
> - output_rtti_addr(RttiTypeId, HashConsDataAddr)
> +% io__write_string(",\n\t"),
> +% (
> +% { MaybeHashCons = yes(HashConsDataAddr) },
> +% io__write_string("&"),
> +% output_rtti_addr(RttiTypeId, HashConsDataAddr)
> +% ;
> +% { MaybeHashCons = no },
> +% io__write_string("NULL")
> +% ),
> +% io__write_string(",\n\t"),
> +% output_maybe_code_addr(Prettyprinter),
> + io__write_string("\n};\n").
You need to document why this is commented out.
Other than this I don't have any problems with the diff.
--
The quantum sort:
while (!sorted) { do_nothing(); }
Tyson Dowd <tyson at tyse.net> http://tyse.net/
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list