[m-dev.] for review: cleanup of type_ctor_infos, part 0
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Mar 1 14:54:59 AEDT 2000
> > + % All the C data structures we generate which are either fully static
> > + % or static after initialization should have this prefix.
> > +:- func mercury_data_prefix = string.
>
> I don't understand why the identifier prefixing convention should
> depend on whether the data is read-only or not.
It doesn't have to, but at the moment it does; things that are intended to be
constant get the prefix mercury_data, while things intended to be updated at
runtime (e.g. tabling pointers) get the prefix mercury_var.
> > -decl_set_is_member(DeclId, DeclSet) :-
> > - map__search(DeclSet, DeclId, _).
>
> I think that change is not mentioned in the log message.
I originally moved part of llds_out to a new module, llds_util, that I thought
would be used by both llds_out.m and rtti_out.m, but it turned out that this
would either have to include too much of llds_out.m, or would have to be very
tightly intervowen with llds_out.m. I therefore stopped this movement, but
forgot that I have already moved the decl_set stuff and the definition of
the linkage type to a llds_util.m, which I didn't cvs add. The stuff is now
back in llds_out.m, and the new module deleted.
> Could you explain why that was comment deleted?
Same reason; change now undone.
> > - % If it's a type_ctor_info struct, use the MR_TypeCtorInfo_struct
> > - % type, and don't emit a definition.
> > - (
> > - { decl_id_is_type_ctor_info(DeclId) }
> > - ->
> > - io__write_string("MR_TypeCtorInfo_struct")
> > - ;
> > output_decl_id(DeclId),
> > io__write_string("_struct"),
> > (
>
> It's not immediately clear to me that this change is right.
> Probably it is, but perhaps you could explain why it is needed?
The old code was detecting what was a special case: an rval whose declared type
was not derived from the create rval arguments' values. TypeCtorInfos are no
longer generated as rvals but as rtti data structures, so this special case
will never occur again. Since I deleted the type_ctor(info) alternative from
the data_name type, the test cannot even be expressed anymore.
> > -% output_code_addr_decls(CodeAddr, ...) outputs the declarations of any
> > -% extern symbols, etc. that need to be declared before
> > -% output_code_addr(CodeAddr) is called.
> > -
> > -:- pred output_code_addr_decls(code_addr, string, string, int, int,
> > - decl_set, decl_set, io__state, io__state).
> > -:- mode output_code_addr_decls(in, in, in, in, out, in, out, di, uo) is det.
> > -
> > output_code_addr_decls(CodeAddress, FirstIndent, LaterIndent, N0, N,
> > DeclSet0, DeclSet) -->
>
> Shouldn't the comment stay?
It did, with the declaration, which is now in the interface section.
> > +:- pred output_data_addr_scope_type_name(module_name::in, data_name::in,
> > + bool::in, string::in, io__state::di, io__state::uo) is det.
>
> A comment explaining what this predicate is supposed to do would be helpful.
> I don't quite understand what the `scope' in the predicate name means
> here.
I replaced "scope" with "storage". The predicate prints the storage class,
which can be "static" or "extern" or "" (if an exported variable is being
defined).
Zoltan.
--------------------------------------------------------------------------
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