[m-dev.] for review: RTTI & split c files
Zoltan Somogyi
zs at ender.cs.mu.oz.au
Tue Mar 14 14:28:44 AEDT 2000
Estimated hours taken: 3
Make the RTTI system operate with --split-c-files.
compiler/rtti_out.m:
Generate declarations of the other entities referenced by an RTTI
structure before the definition of that structure is output.
compiler/llds_out.m:
Add a new output predicate for use by rtti_out.m
library/std_util.m:
Add a new utility predicate for use by rtti_out.m.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.136
diff -u -b -r1.136 llds_out.m
--- compiler/llds_out.m 2000/03/10 13:37:44 1.136
+++ compiler/llds_out.m 2000/03/13 23:32:40
@@ -19,7 +19,7 @@
:- import_module llds, builtin_ops, prog_data, hlds_data, rl_file.
:- import_module globals.
-:- import_module set_bbbtree, bool, io, std_util.
+:- import_module list, set_bbbtree, bool, io, std_util.
% Given a 'c_file' structure, output the LLDS code inside it
% into one or more .c files, depending on the setting of the
@@ -61,6 +61,10 @@
decl_set, decl_set, io__state, io__state).
:- mode output_code_addr_decls(in, in, in, in, out, in, out, di, uo) is det.
+:- pred output_code_addrs_decls(list(code_addr), string, string, int, int,
+ decl_set, decl_set, io__state, io__state).
+:- mode output_code_addrs_decls(in, in, in, in, out, in, out, di, uo) is det.
+
:- pred output_code_addr(code_addr, io__state, io__state).
:- mode output_code_addr(in, di, uo) is det.
@@ -247,7 +251,7 @@
:- import_module export, mercury_to_mercury, modules.
:- import_module c_util.
-:- import_module int, list, char, string, std_util.
+:- import_module int, char, string, std_util.
:- import_module map, set, bintree_set, assoc_list, require.
:- import_module varset, term.
:- import_module library. % for the version number.
@@ -2686,6 +2690,14 @@
DeclSet0, DeclSet) -->
output_rval_decls(Rval, FirstIndent, LaterIndent, N0, N,
DeclSet0, DeclSet).
+
+output_code_addrs_decls([], _, _, N, N, DeclSet, DeclSet) --> [].
+output_code_addrs_decls([CodeAddress | CodeAddresses], FirstIndent, LaterIndent,
+ N0, N, DeclSet0, DeclSet) -->
+ output_code_addr_decls(CodeAddress, FirstIndent, LaterIndent, N0, N1,
+ DeclSet0, DeclSet1),
+ output_code_addrs_decls(CodeAddresses, FirstIndent, LaterIndent, N1, N,
+ DeclSet1, DeclSet).
output_code_addr_decls(CodeAddress, FirstIndent, LaterIndent, N0, N,
DeclSet0, DeclSet) -->
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.1
diff -u -b -r1.1 rtti_out.m
--- compiler/rtti_out.m 2000/03/10 13:37:52 1.1
+++ compiler/rtti_out.m 2000/03/13 23:32:40
@@ -204,8 +204,14 @@
CtorRep, Solver, Init, Version, NumPtags, NumFunctors,
FunctorsInfo, LayoutInfo, _MaybeHashCons, _Prettyprinter),
DeclSet0, DeclSet) -->
+ { MaybeCodeAddrs = [Unify, Index, Compare, Solver, Init] },
+ { list__filter_map(if_yes, MaybeCodeAddrs, CodeAddrs) },
+ output_code_addrs_decls(CodeAddrs, "", "", 0, _, DeclSet0, DeclSet1),
+ output_functors_info_decl(RttiTypeId, FunctorsInfo,
+ DeclSet1, DeclSet2),
+ output_layout_info_decl(RttiTypeId, LayoutInfo, DeclSet2, DeclSet3),
output_generic_rtti_data_defn_start(RttiTypeId,
- type_ctor_info, DeclSet0, DeclSet),
+ type_ctor_info, DeclSet3, DeclSet),
io__write_string(" = {\n\t"),
{ RttiTypeId = rtti_type_id(Module, Type, TypeArity) },
io__write_int(TypeArity),
@@ -293,6 +299,44 @@
% io__write_string(",\n\t"),
% output_maybe_code_addr(Prettyprinter),
io__write_string("\n};\n").
+
+:- pred output_functors_info_decl(rtti_type_id::in,
+ type_ctor_functors_info::in, decl_set::in, decl_set::out,
+ io__state::di, io__state::uo) is det.
+
+output_functors_info_decl(RttiTypeId, enum_functors(EnumFunctorsInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, EnumFunctorsInfo,
+ DeclSet0, DeclSet).
+output_functors_info_decl(RttiTypeId, notag_functors(NotagFunctorsInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, NotagFunctorsInfo,
+ DeclSet0, DeclSet).
+output_functors_info_decl(RttiTypeId, du_functors(DuFunctorsInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, DuFunctorsInfo,
+ DeclSet0, DeclSet).
+output_functors_info_decl(_RttiTypeId, no_functors, DeclSet, DeclSet) --> [].
+
+:- pred output_layout_info_decl(rtti_type_id::in, type_ctor_layout_info::in,
+ decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
+
+output_layout_info_decl(RttiTypeId, enum_layout(EnumLayoutInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, EnumLayoutInfo,
+ DeclSet0, DeclSet).
+output_layout_info_decl(RttiTypeId, notag_layout(NotagLayoutInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, NotagLayoutInfo,
+ DeclSet0, DeclSet).
+output_layout_info_decl(RttiTypeId, du_layout(DuLayoutInfo),
+ DeclSet0, DeclSet) -->
+ output_generic_rtti_data_decl(RttiTypeId, DuLayoutInfo,
+ DeclSet0, DeclSet).
+output_layout_info_decl(_RttiTypeId, equiv_layout(EquivRval),
+ DeclSet0, DeclSet) -->
+ output_rval_decls(EquivRval, "", "", 0, _, DeclSet0, DeclSet).
+output_layout_info_decl(_RttiTypeId, no_layout, DeclSet, DeclSet) --> [].
:- pred output_ptag_layout_decls(list(du_ptag_layout)::in, rtti_type_id::in,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.183
diff -u -b -r1.183 std_util.m
--- library/std_util.m 2000/03/13 04:24:15 1.183
+++ library/std_util.m 2000/03/13 12:21:05
@@ -223,6 +223,8 @@
:- pred maybe_pred(pred(T1, T2), T1, maybe(T2)).
:- mode maybe_pred(pred(in, out) is semidet, in, out) is det.
+:- pred if_yes(maybe(T)::in, T::out) is semidet.
+
%-----------------------------------------------------------------------------%
% `semidet_succeed' is exactly the same as `true', except that
@@ -519,6 +521,8 @@
;
Y = no
).
+
+if_yes(yes(Value), Value).
%-----------------------------------------------------------------------------%
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
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