[m-dev.] for review: cleanup of c_modules
Peter Ross
petdr at cs.mu.OZ.AU
Wed Nov 18 15:06:38 AEDT 1998
On 17-Nov-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> This is for Peter Ross to review, and for commit after the release.
>
> Estimated hours taken: 6
>
> Change the LLDS representation of a module from containing a list of c_modules
> to containing four lists, of (a) compiler generated C code, (b) compiler
> generated data, (c) user-written C code and (d) exported C functions.
> This simplifies the several passes (e.g. transform_llds, llds_common)
> that only care about one kind of "c_module".
>
> compiler/llds.m:
> Change the definition of c_file along the lines above.
>
> compiler/llds_out.m:
> Write out the new data structure.
>
> Change some predicate names to make it clear what predicates
> handle the splitting of C files.
>
> Remove the obsolete #define of MR_USE_REDOFR
>
> compiler/base_type_info.m:
> compiler/base_type_layout.m:
> compiler/base_typeclass_info.m:
> Adapt to the new data structure.
>
> compiler/llds_common.m:
> Use the new data structure to simplify the code.
> Change the order of some arguments to conform to our usual
> conventions.
>
> compiler/transform_llds.m:
> Use the new data structure to simplify the code.
>
> compiler/mercury_compile.m:
> Adapt the gathering of the c_file components to the new data structure.
> Fix a predicate name.
>
> Fix a bug: stack layouts were always treated as static data, although
> proc layouts are only static if we have static code addresses.
>
> compiler/stackl_layout.m:
> Return the proc layouts and the label layouts in separate lists,
> since only label layouts are always static data.
>
> Zoltan.
>
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.96
diff -u -u -r1.96 llds_out.m
--- llds_out.m 1998/11/12 03:15:41 1.96
+++ llds_out.m 1998/11/13 11:14:32
> +
> +%-----------------------------------------------------------------------------%
> +
> +:- pred make_directory(string::in, io__state::di, io__state::uo) is det.
> +
> +make_directory(DirName) -->
> + { string__format("[ -d %s ] || mkdir -p %s", [s(DirName), s(DirName)],
> + Command) },
> + io__call_system(Command, _Result).
>
What happens if the mkdir fails? It would be nice if this predicate
reported whether or not the mkdir succeded.
I know that you have only moved the above code, but I still think it
should be fixed.
The rest of the change looks fine.
Pete.
More information about the developers
mailing list