[m-rev.] for review: full implementation of RTTI for equivalence types
Peter Ross
pro at missioncriticalit.com
Fri Jun 1 14:12:20 AEST 2007
On Fri, Jun 01, 2007 at 01:27:20PM +1000, Peter Wang wrote:
> On 2007-06-01, Peter Ross <pro at missioncriticalit.com> wrote:
>
> > Index: compiler/elds_to_erlang.m
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/compiler/elds_to_erlang.m,v
> > retrieving revision 1.7
> > diff -u -r1.7 elds_to_erlang.m
> > --- compiler/elds_to_erlang.m 31 May 2007 08:12:53 -0000 1.7
> > +++ compiler/elds_to_erlang.m 1 Jun 2007 02:39:16 -0000
> > @@ -514,20 +514,35 @@
> > output_rtti_id(ModuleInfo, RttiId, !IO) :-
> > module_info_get_name(ModuleInfo, CurModuleName),
> > (
> > - (
> > - RttiId = elds_rtti_type_ctor_id(ModuleName, TypeName, Arity),
> > - Prefix = "TypeCtorInfo_"
> > - ;
> > - RttiId = elds_rtti_type_info_id(ModuleName, TypeName, Arity),
> > - Prefix = "TypeInfo_"
> > - ),
> > + RttiId = elds_rtti_type_ctor_id(RttiTypeCtor),
> > + RttiTypeCtor = rtti_type_ctor(ModuleName, _, _),
> > +
> > % The only things with an empty module name should be the builtins.
> > ( ModuleName = unqualified("") ->
> > InstanceModule = mercury_public_builtin_module
> > ;
> > InstanceModule = ModuleName
> > ),
> > - Atom = Prefix ++ TypeName ++ "_" ++ string.from_int(Arity)
> > +
> > + CRttiId = ctor_rtti_id(RttiTypeCtor, type_ctor_type_ctor_info),
> > + id_to_c_identifier(CRttiId, Atom)
>
> Module qualify that.
>
Done.
> >
> > + %
> > + % These three types should never actually be used in
> > + % an Erlang program.
> > + %
> > +erlang_type_ctor_rep(erlang_impl_artifact(erlang_impl_ctor_hp)) =
> > + elds_term(make_enum_alternative("hp")).
> > +erlang_type_ctor_rep(erlang_impl_artifact(erlang_impl_ctor_subgoal)) =
> > + elds_term(make_enum_alternative("subgoal")).
> > +erlang_type_ctor_rep(erlang_impl_artifact(erlang_impl_ctor_ticket)) =
> > + elds_term(make_enum_alternative("ticket")).
>
> Should you throw exceptions for these?
>
No because compiling the library generates these, but we should never
call any of the library routines which use these.
> > :- pred gen_init_special_pred(module_info::in, maybe(rtti_proc_label)::in,
> > elds_expr::out, prog_varset::in, prog_varset::out) is det.
> > @@ -559,6 +712,49 @@
> > WrapperFun = elds_fun(elds_clause(terms_from_vars(WrapperInputVars),
> > DoCall)).
> >
> > +
> > + %
> > + % erlang_type_ctor_details(MI, D, E, Defns)
> > + %
>
> Use full names for these variables.
>
Done.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list