[m-rev.] for review: use bytecode for procedure body representations
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Mar 31 10:40:06 AEST 2005
On 30-Mar-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> s/output_bytecode/output_bytecodes
>
> Out of curiosity, which grades don't allow output_bytecodes to be tail
> recursive?
All forms of debugging destroy tail recursion, as does deep profiling,
for the same reason: they need to grab control at procedure exit.
> > +goal_expr_to_byte_list(par_conj(_), _, _, _) = _ :-
> > + error("Sorry, not yet implemented:\n\
> > + parallel conjunctions and declarative debugging").
>
> Shouldn't you call sorry/2 instead?
Done.
> > + error("goal_expr_to_byte_list: complicated_unify")
>
> Should complicated unification have been converted to procedure calls by this
> point?
Yes. That's why this code calls error.
> > +:- func sym_name_to_byte_list(sym_name) = list(int).
> > +
> > +sym_name_to_byte_list(SymName) =
> > + string_to_byte_list(prog_rep__sym_name_to_string(SymName)).
> > +
>
> The above function doesn't appear to be used anywhere.
Deleted.
> > +:- func sym_name_to_string(sym_name) = string.
> > +
> > +sym_name_to_string(unqualified(String)) = String.
> > +sym_name_to_string(qualified(_, String)) = String.
> > +
>
> Are you sure it's okay to throw away any module qualifiers here?
The declarative debugger *could* in theory use the module qualifier,
but doesn't do so now. When it is needed, we can add it back in.
> I suggest you give sym_name_to_string a different name to more
> easily distinguish is from the predicate with the same name in
> mdbcomp.prim_data.
It is now called sym_base_name_to_string.
>
> > +:- func cases_to_byte_list(list(case), instmap, prog_rep__info) = list(int).
>
> I think "switch_arms_to_byte_list" would be a better name.
There are many predicates in the compiler (code generator etc) which call
them cases, so I will keep the current name.
> > +determinism_representation(erroneous_rep, 4).
>
> In the reference manual it says that erroneous procedures never produce any
> solutions, so why is the 4 bit set here? I think you should include a comment
> about erroneous being a special case.
Because the determinism components of erroneous include at_least_one
as well as at_most_zero.
I added a pointer to the place where the encoding scheme is documented.
I followed your other suggestions.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list