[m-rev.] for post-commit review: mdprof and >2^15 vars

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Oct 11 11:48:39 AEDT 2010


For post-commit review by Paul.

Zoltan.

Allow more than 2^15 vars in a procedure representation.

mdbcomp/program_representation.m:
	Allow a variable number to be represented by four bytes as well as
	two and one. This means that we also have to represent the number
	of variables in a procedure using a four-byte number, not a two-byte
	number.

	Use four bytes to represent line numbers. Programs that overflow
	16-bit var numbers may also overflow 16 bit line numbers.

	These requires a change in the deep profiler data's binary
	compatibility version number.

compiler/prog_rep.m:
	Encode vars using four bytes if necessary. Be consistent in using
	only signed 8-bit as well as signed 16-bit numbers.

compiler/implicit_parallelism.m:
	Conform to the change in program_representation.m.

deep_profiler/profile.m:
deep_profiler/read_profile.m:
	Add a compression flag to the set of flags read from the data file.
	Put the flags into the profile_stats as a group, not one-by-one.

deep_profiler/canonical.m:
deep_profiler/create_report.m:
deep_profiler/dump.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
deep_profiler/query.m:
	Conform to the change in profile.m.

runtime/mercury_deep_profiling.c:
	Prepare for compression of profiling data files being implemented.

runtime/mercury_stack_layout.h:
	Fix some documentation rot.

runtime/mercury_conf_param.h:
	Add an implication between debug flags to make debugging easier.

cvs diff: Diffing .
cvs diff: Diffing analysis
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/doc
cvs diff: Diffing boehm_gc/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/implicit_parallelism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/implicit_parallelism.m,v
retrieving revision 1.22
diff -u -b -r1.22 implicit_parallelism.m
--- compiler/implicit_parallelism.m	9 Oct 2010 01:26:55 -0000	1.22
+++ compiler/implicit_parallelism.m	10 Oct 2010 09:23:58 -0000
@@ -282,9 +282,9 @@
             Context = goal_info_get_context(Goal0 ^ hlds_goal_info),
             term.context_file(Context, FileName),
             proc_info_get_vartypes(ProcInfo0, VarTypes),
-            % VarNumRep is not used by goal_to_goal_rep, byte is an arbitrary
-            % value.
-            VarNumRep = byte,
+            % VarNumRep is not used by goal_to_goal_rep, var_num_1_byte
+            % is an arbitrary value. XXX zs: I don't think this is true.
+            VarNumRep = var_num_1_byte,
             proc_info_get_headvars(ProcInfo0, HeadVars),
             proc_info_get_varset(ProcInfo0, VarSet),
             compute_var_number_map(HeadVars, VarSet, [], Goal0, VarNumMap),
Index: compiler/prog_rep.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.69
diff -u -b -r1.69 prog_rep.m
--- compiler/prog_rep.m	4 Jul 2010 10:24:08 -0000	1.69
+++ compiler/prog_rep.m	1 Oct 2010 07:04:15 -0000
@@ -123,12 +123,12 @@
 
     % Create bytecodes for the variable table.
     %
-    % If a variable table is not requested, an empty table is created.  The
-    % variable table also includes information about the representation of
-    % variable numbers within the bytecode.
+    % If a variable table is not requested, an empty table is created.
+    % The variable table also includes information about the representation
+    % of variable numbers within the bytecode.
     %
     % The representation of variables and the variable table restricts the
-    % number of possible variables in a procedure to 2^15.
+    % number of possible variables in a procedure to 2^31.
     %
 :- pred represent_var_table_as_bytecode(include_variable_table::in,
     var_num_map::in, var_num_rep::out, list(int)::out, 
@@ -137,10 +137,12 @@
 represent_var_table_as_bytecode(IncludeVarTable, VarNumMap, VarNumRep,
         ByteList, !StringTable) :-
     map.foldl(max_var_num, VarNumMap, 0) = MaxVarNum,
-    ( MaxVarNum =< 255 ->
-        VarNumRep = byte
+    ( MaxVarNum =< 127 ->
+        VarNumRep = var_num_1_byte
+    ; MaxVarNum =< 32767 ->
+        VarNumRep = var_num_2_bytes
     ;
-        VarNumRep = short
+        VarNumRep = var_num_4_bytes
     ),
     var_num_rep_byte(VarNumRep, VarNumRepByte),
     (
@@ -152,7 +154,7 @@
         NumVars = 0,
         VarTableEntriesBytes = []
     ),
-    short_to_byte_list(NumVars, NumVarsBytes),
+    int32_to_byte_list(NumVars, NumVarsBytes),
     ByteList = [VarNumRepByte] ++ NumVarsBytes ++ VarTableEntriesBytes.
 
 :- func max_var_num(prog_var, pair(int, string), int) = int.
@@ -169,7 +171,7 @@
         !NumVars, !VarTableBytes, !StringTable) :-
     (
         % Some variables that the compiler creates are named automatically,
-        % these and unamed variables should not be included in the variable
+        % these and unnamed variables should not be included in the variable
         % table.
         compiler_introduced_varname(VarName)
     ->
@@ -177,11 +179,14 @@
     ;
         !:NumVars = !.NumVars + 1,
         (
-            VarNumRep = byte,
+            VarNumRep = var_num_1_byte,
             VarBytes = [VarNum]
         ;
-            VarNumRep = short,
+            VarNumRep = var_num_2_bytes,
             short_to_byte_list(VarNum, VarBytes)
+        ;
+            VarNumRep = var_num_4_bytes,
+            int32_to_byte_list(VarNum, VarBytes)
         ),
         string_to_byte_list(VarName, VarNameBytes, !StringTable),
         !:VarTableBytes = VarBytes ++ VarNameBytes ++ !.VarTableBytes
@@ -697,11 +702,14 @@
 
 var_rep_to_byte_list(Info, Var) = Bytes :-
     (
-        Info ^ pri_var_num_rep = byte,
+        Info ^ pri_var_num_rep = var_num_1_byte,
         Bytes = [Var]
     ; 
-        Info ^ pri_var_num_rep = short,
+        Info ^ pri_var_num_rep = var_num_2_bytes,
         short_to_byte_list(Var, Bytes)
+    ; 
+        Info ^ pri_var_num_rep = var_num_4_bytes,
+        int32_to_byte_list(Var, Bytes)
     ).
 
 :- func maybe_var_reps_to_byte_list(prog_rep_info, list(maybe(var_rep))) =
@@ -771,12 +779,12 @@
 :- func length_to_byte_list(list(T)) = list(int).
 
 length_to_byte_list(List) = Bytes :-
-    short_to_byte_list(list.length(List), Bytes).
+    int32_to_byte_list(list.length(List), Bytes).
 
 :- func lineno_to_byte_list(int) = list(int).
 
 lineno_to_byte_list(VarNum) = Bytes :-
-    short_to_byte_list(VarNum, Bytes).
+    int32_to_byte_list(VarNum, Bytes).
 
 :- func method_num_to_byte_list(int) = list(int).
 
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
Index: deep_profiler/canonical.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/canonical.m,v
retrieving revision 1.19
diff -u -b -r1.19 canonical.m
--- deep_profiler/canonical.m	21 Sep 2010 01:09:16 -0000	1.19
+++ deep_profiler/canonical.m	30 Sep 2010 04:44:11 -0000
@@ -848,20 +848,21 @@
     list.map(extract_user_quanta, AllInitDeeps, UserQuantas),
     list.foldl(int_add, InstrumentQuantas, 0, InstrumentQuanta),
     list.foldl(int_add, UserQuantas, 0, UserQuanta),
-    WordSize = BaseInitDeep ^ init_profile_stats ^ word_size,
     extract_num_callseqs(BaseInitDeep, BaseNumCallSeqs),
     list.map(extract_num_callseqs, OtherInitDeeps, OtherNumCallSeqs),
     list.foldl(int_add, OtherNumCallSeqs, BaseNumCallSeqs, ConcatNumCallSeqs),
     
     % The program names are not checked. The new profile is named after the
     % base profile.
-    BaseProgramName = BaseInitDeep ^ init_profile_stats ^ program_name,
-    % Similarly the coverage data types are not checked.
-    CoverageDataType = BaseInitDeep ^ init_profile_stats ^ coverage_data_type, 
+    BaseProgramName = BaseInitDeep ^ init_profile_stats ^ prs_program_name,
+
+    % With the exception of the canonical flags, we get the flags from
+    % the base profile also.
+    BaseFlags = BaseInitDeep ^ init_profile_stats ^ prs_deep_flags,
+    ConcatFlags = BaseFlags ^ df_canonical_flag := is_canonical,
     ConcatProfileStats = profile_stats(BaseProgramName,
         ConcatMaxCSD, BaseMaxCSS, ConcatMaxPD, BaseMaxPS, ConcatNumCallSeqs,
-        BaseTicksPerSec, InstrumentQuanta, UserQuanta, WordSize, 
-        CoverageDataType, yes),
+        BaseTicksPerSec, InstrumentQuanta, UserQuanta, ConcatFlags), 
     % The root part is a temporary lie.
     MergedInitDeep = initial_deep(ConcatProfileStats,
         BaseInitDeep ^ init_root,
Index: deep_profiler/create_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/create_report.m,v
retrieving revision 1.26
diff -u -b -r1.26 create_report.m
--- deep_profiler/create_report.m	7 Oct 2010 02:38:09 -0000	1.26
+++ deep_profiler/create_report.m	10 Oct 2010 09:24:06 -0000
@@ -123,8 +123,7 @@
         Cmd = deep_cmd_menu,
         Deep ^ profile_stats = profile_stats(ProgramName,
             NumCSD, NumCSS, NumPD, NumPS,
-            QuantaPerSec, InstrumentationQuanta, UserQuanta, NumCallseqs,
-            _, _, _),
+            QuantaPerSec, InstrumentationQuanta, UserQuanta, NumCallseqs, _),
         NumCliques = array.max(Deep ^ clique_members),
         MenuReport = menu_report(ProgramName, QuantaPerSec,
             UserQuanta, InstrumentationQuanta,
@@ -1506,8 +1505,8 @@
         RowData) :-
     % Look up global parameters and totals.
     ProfileStats = Deep ^ profile_stats,
-    TicksPerSec = ProfileStats ^ ticks_per_sec,
-    WordSize = ProfileStats ^ word_size,
+    TicksPerSec = ProfileStats ^ prs_ticks_per_sec,
+    WordSize = ProfileStats ^ prs_deep_flags ^ df_bytes_per_int,
 
     Root = root_total_info(Deep),
     RootQuanta = inherit_quanta(Root),
Index: deep_profiler/dump.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dump.m,v
retrieving revision 1.18
diff -u -b -r1.18 dump.m
--- deep_profiler/dump.m	21 Sep 2010 01:09:16 -0000	1.18
+++ deep_profiler/dump.m	5 Oct 2010 04:46:21 -0000
@@ -290,8 +290,7 @@
 
 dump_init_profile_stats(Stats, !IO) :-
     Stats = profile_stats(ProgramName, MaxCSD, MaxCSS, MaxPD, MaxPS,
-        TicksPerSec, InstrumentQuanta, UserQuanta, NumCallSeqs, WordSize,
-        CoverageDataType, Canonical),
+        TicksPerSec, InstrumentQuanta, UserQuanta, NumCallSeqs, DeepFlags),
     io.write_string("SECTION PROFILING STATS:\n\n", !IO),
     io.write_string("\tprogram_name = " ++ ProgramName ++ "\n", !IO),
     io.format("\tmax_csd = %d\n", [i(MaxCSD)], !IO),
@@ -302,17 +301,23 @@
     io.format("\tinstrument_quanta = %d\n", [i(InstrumentQuanta)], !IO),
     io.format("\tuser_quanta = %d\n", [i(UserQuanta)], !IO),
     io.format("\tnum_callseqs = %d\n", [i(NumCallSeqs)], !IO),
+    DeepFlags = deep_flags(WordSize, Canonical, Compression, CoverageDataType),
     io.format("\tword_size   = %d\n", [i(WordSize)], !IO),
-    io.format("\tcoverage_data_type = %s\n", [s(string(CoverageDataType))], 
-        !IO),
     io.write_string("\tcanonical = ", !IO),
     (
-        Canonical = yes,
+        Canonical = is_canonical,
         io.write_string("yes\n", !IO)
     ;
-        Canonical = no,
+        Canonical = maybe_not_canonical,
         io.write_string("no\n", !IO)
     ),
+    io.write_string("\tcompression = ", !IO),
+    (
+        Compression = no_compression,
+        io.write_string("none\n", !IO)
+    ),
+    io.format("\tcoverage_data_type = %s\n", [s(string(CoverageDataType))], 
+        !IO),
     io.nl(!IO).
 
 %----------------------------------------------------------------------------%
Index: deep_profiler/mdprof_feedback.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/mdprof_feedback.m,v
retrieving revision 1.28
diff -u -b -r1.28 mdprof_feedback.m
--- deep_profiler/mdprof_feedback.m	7 Oct 2010 02:38:09 -0000	1.28
+++ deep_profiler/mdprof_feedback.m	10 Oct 2010 09:24:06 -0000
@@ -105,7 +105,7 @@
             read_deep_file(InputFileName, DebugReadProfile, MaybeDeep, !IO),
             (
                 MaybeDeep = ok(Deep),
-                ProfileProgName = Deep ^ profile_stats ^ program_name, 
+                ProfileProgName = Deep ^ profile_stats ^ prs_program_name, 
                 feedback.read_or_create(OutputFileName, ProfileProgName,
                     FeedbackReadResult, !IO),
                 (
Index: deep_profiler/old_html_format.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/old_html_format.m,v
retrieving revision 1.8
diff -u -b -r1.8 old_html_format.m
--- deep_profiler/old_html_format.m	7 Oct 2010 02:38:09 -0000	1.8
+++ deep_profiler/old_html_format.m	10 Oct 2010 09:24:06 -0000
@@ -1862,7 +1862,8 @@
             TotalMemory = TotalWords
         ;
             Unit = units_bytes,
-            WordSize = Deep ^ profile_stats ^ word_size,
+            WordSize = Deep ^ profile_stats ^ prs_deep_flags
+                ^ df_bytes_per_int,
             OwnMemory = OwnWords * WordSize,
             TotalMemory = TotalWords * WordSize
         )
@@ -2027,7 +2028,7 @@
     ).
 
 lookup_ticks_per_sec(Stats, TicksPerSec, Assumed) :-
-    TicksPerSec0 = Stats ^ ticks_per_sec,
+    TicksPerSec0 = Stats ^ prs_ticks_per_sec,
     ( TicksPerSec0 = 0 ->
         TicksPerSec = default_ticks_per_sec,
         Assumed = yes
Index: deep_profiler/old_query.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/old_query.m,v
retrieving revision 1.8
diff -u -b -r1.8 old_query.m
--- deep_profiler/old_query.m	7 Oct 2010 02:38:09 -0000	1.8
+++ deep_profiler/old_query.m	10 Oct 2010 09:24:06 -0000
@@ -462,25 +462,25 @@
             [i(TicksPerSec), s(AssumedStr)]) ++
         "<TR><TD ALIGN=left>Quanta in user code:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ user_quanta)]) ++
+            [i(Stats ^ prs_user_quanta)]) ++
         "<TR><TD ALIGN=left>Quanta in instrumentation:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ instrument_quanta)]) ++
+            [i(Stats ^ prs_instrument_quanta)]) ++
         "<TR><TD ALIGN=left>Call sequence numbers:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ num_callseqs)]) ++
+            [i(Stats ^ prs_num_callseqs)]) ++
         "<TR><TD ALIGN=left>CallSiteDynamic structures:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ num_csd)]) ++
+            [i(Stats ^ prs_num_csd)]) ++
         "<TR><TD ALIGN=left>ProcDynamic structures:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ num_pd)]) ++
+            [i(Stats ^ prs_num_pd)]) ++
         "<TR><TD ALIGN=left>CallSiteStatic structures:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ num_css)]) ++
+            [i(Stats ^ prs_num_css)]) ++
         "<TR><TD ALIGN=left>ProcStatic structures:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
-            [i(Stats ^ num_ps)]) ++
+            [i(Stats ^ prs_num_ps)]) ++
         "<TR><TD ALIGN=left>Cliques:</TD>\n" ++
         string.format("<TD ALIGN=right>%d</TD></TR>\n",
             [i(array.max(Deep ^ clique_members))]) ++
Index: deep_profiler/profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.31
diff -u -b -r1.31 profile.m
--- deep_profiler/profile.m	22 Sep 2010 12:56:54 -0000	1.31
+++ deep_profiler/profile.m	5 Oct 2010 03:51:06 -0000
@@ -36,20 +36,33 @@
 
 %-----------------------------------------------------------------------------%
 
+:- type deep_compression_flag
+    --->    no_compression.
+
+:- type canonical_flag
+    --->    is_canonical
+    ;       maybe_not_canonical.
+
+:- type deep_flags
+    --->    deep_flags(
+                df_bytes_per_int        :: int,
+                df_canonical_flag       :: canonical_flag,
+                df_compression_flag     :: deep_compression_flag,
+                df_coverage_data_type   :: coverage_data_type
+            ).
+
 :- type profile_stats
     --->    profile_stats(
-                program_name            :: string,
-                num_csd                 :: int,
-                num_css                 :: int,
-                num_pd                  :: int,
-                num_ps                  :: int,
-                ticks_per_sec           :: int,
-                instrument_quanta       :: int,
-                user_quanta             :: int,
-                num_callseqs            :: int,
-                word_size               :: int,
-                coverage_data_type      :: coverage_data_type,
-                canonical               :: bool
+                prs_program_name        :: string,
+                prs_num_csd             :: int,
+                prs_num_css             :: int,
+                prs_num_pd              :: int,
+                prs_num_ps              :: int,
+                prs_ticks_per_sec       :: int,
+                prs_instrument_quanta   :: int,
+                prs_user_quanta         :: int,
+                prs_num_callseqs        :: int,
+                prs_deep_flags          :: deep_flags
             ).
 
 :- type initial_deep
@@ -983,16 +996,16 @@
     CalleePDPtr = CSD ^ csd_callee.
 
 extract_ticks_per_sec(InitDeep,
-    InitDeep ^ init_profile_stats ^ ticks_per_sec).
+    InitDeep ^ init_profile_stats ^ prs_ticks_per_sec).
 
 extract_instrument_quanta(InitDeep,
-    InitDeep ^ init_profile_stats ^ instrument_quanta).
+    InitDeep ^ init_profile_stats ^ prs_instrument_quanta).
 
 extract_user_quanta(InitDeep,
-    InitDeep ^ init_profile_stats ^ user_quanta).
+    InitDeep ^ init_profile_stats ^ prs_user_quanta).
 
 extract_num_callseqs(InitDeep,
-    InitDeep ^ init_profile_stats ^ num_callseqs).
+    InitDeep ^ init_profile_stats ^ prs_num_callseqs).
 
 extract_max_css(InitDeep, MaxCSS) :-
     array.max(InitDeep ^ init_call_site_statics, MaxCSS).
Index: deep_profiler/query.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/query.m,v
retrieving revision 1.38
diff -u -b -r1.38 query.m
--- deep_profiler/query.m	7 Oct 2010 02:38:09 -0000	1.38
+++ deep_profiler/query.m	10 Oct 2010 09:24:06 -0000
@@ -506,7 +506,7 @@
 minimum_meaningful_quanta = 10.
 
 should_display_times(Deep) =
-    ( Deep ^ profile_stats ^ user_quanta > minimum_meaningful_quanta ->
+    ( Deep ^ profile_stats ^ prs_user_quanta > minimum_meaningful_quanta ->
         yes
     ;
         no
Index: deep_profiler/read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.29
diff -u -b -r1.29 read_profile.m
--- deep_profiler/read_profile.m	21 Sep 2010 01:09:16 -0000	1.29
+++ deep_profiler/read_profile.m	5 Oct 2010 03:51:06 -0000
@@ -61,12 +61,15 @@
     ;       csd.
 
 read_call_graph(FileName, MaybeInitDeep, !IO) :-
-    io.see_binary(FileName, SeeResult, !IO),
+    io.open_binary_input(FileName, OpenResult, !IO),
     (
-        SeeResult = ok,
-        read_deep_id_string(MaybeIdStr, !IO),
-        (
-            MaybeIdStr = ok(_),
+        OpenResult = ok(FileStream),
+        io.set_binary_input_stream(FileStream, OldStream, !IO),
+        read_deep_id_string(MaybeVersionNumber, !IO),
+        (
+            MaybeVersionNumber = ok(_VersionNumber),
+            % In the future, we could use different code to read in
+            % profiling data files with different version numbers.
             io_combinator.maybe_error_sequence_11(
                 read_string,
                 read_fixed_size_int,
@@ -82,54 +85,66 @@
                 maybe_init_deep, MaybeInitDeepHeader, !IO),
             (
                 MaybeInitDeepHeader = ok(InitDeep),
-                read_nodes(InitDeep, MaybeInitDeep, !IO),
-                io.seen_binary(!IO)
+                % When we implement compression of data files, we would
+                % want to pipe the rest of the input stream through the
+                % decompression mechanism.
+                read_nodes(InitDeep, MaybeInitDeep, !IO)
             ;
                 MaybeInitDeepHeader = error(Error),
                 MaybeInitDeep = error(Error)
             )
         ;
-            MaybeIdStr = error(Msg),
+            MaybeVersionNumber = error(Msg),
             MaybeInitDeep = error(Msg)
-        )
+        ),
+        io.set_binary_input_stream(OldStream, _, !IO)
     ;
-        SeeResult = error(Error),
+        OpenResult = error(Error),
         io.error_message(Error, Msg),
         MaybeInitDeep = error(Msg)
     ).
 
-:- pred read_deep_id_string(maybe_error(string)::out,
-    io::di, io::uo) is det.
+:- pred read_deep_id_string(maybe_error(int)::out, io::di, io::uo) is det.
 
-read_deep_id_string(MaybeIdStr, !IO) :-
-    read_line(string.length(deep_id_string), MaybeLine, !IO),
+read_deep_id_string(MaybeVersionNumber, !IO) :-
+    % The 10 extra chars should be ample for the version number and newline.
+    FirstLineLenLimit = string.length(deep_id_prefix) + 10,
+    read_line(FirstLineLenLimit, MaybeLine, !IO),
     (
-        MaybeLine = ok(Line),
-        ( Line = deep_id_string ->
-            MaybeIdStr = ok(deep_id_string)
-        ; string.prefix(Line, deep_id_prefix) ->
-            MaybeIdStr = error("version number mismatch")
+        MaybeLine = ok(Line0),
+        Line = string.chomp(Line0),
+        (
+            string.append(deep_id_prefix, Suffix, Line),
+            string.to_int(Suffix, VersionNumber)
+        ->
+            ( acceptable_version(VersionNumber) ->
+                MaybeVersionNumber = ok(VersionNumber)
+            ;
+                MaybeVersionNumber = error("version number mismatch")
+            )
         ;
-            MaybeIdStr = error("not a deep profiling data file")
+            MaybeVersionNumber = error("not a deep profiling data file")
         )
     ;
         MaybeLine = error(Error),
-        MaybeIdStr = error(Error)
+        MaybeVersionNumber = error(Error)
     ).
 
-    % Return the string identifying a file as a deep profiling data file.
-    % This must the same string as the one written by the function
+    % Return the constant prefix of the string identifying a file
+    % as a deep profiling data file. The first line of a profiling data file
+    % should contain this prefix and the version number of format used by the
+    % file.
+    %
+    % This string must match the string written by the function
     % MR_write_out_deep_id_string in runtime/mercury_deep_profiling.c.
     %
-:- func deep_id_string = string.
+:- func deep_id_prefix = string.
 
-deep_id_string = deep_id_prefix ++ " 7\n".
+deep_id_prefix = "Mercury deep profiler data version ".
 
-    % Return the part of deep_id_string that is version independent.
-    %
-:- func deep_id_prefix = string.
+:- pred acceptable_version(int::in) is semidet.
 
-deep_id_prefix = "Mercury deep profiler data version".
+acceptable_version(8).
 
     % Strip the directory paths off the given string.
     %
@@ -179,10 +194,8 @@
     maybe_deep_flags(FlagsInt, MaybeFlags),
     (
         MaybeFlags = ok(Flags),
-        Flags = deep_flags(WordSize, CanonicalFlag, CoverageDataType),
         InitStats = profile_stats(ProgName, MaxCSD, MaxCSS, MaxPD, MaxPS,
-            TicksPerSec, InstrumentQuanta, UserQuanta, NumCallSeqs, WordSize,
-            CoverageDataType, CanonicalFlag),
+            TicksPerSec, InstrumentQuanta, UserQuanta, NumCallSeqs, Flags),
         InitDeep = initial_deep(
             InitStats,
             make_pdptr(RootPDI),
@@ -209,13 +222,6 @@
         MaybeInitDeep = error(Error)
     ).
 
-:- type deep_flags
-    --->    deep_flags(
-                df_bytes_per_int        :: int,
-                df_canonical_flag       :: bool,
-                df_coverage_data_type   :: coverage_data_type
-            ).
-
 :- pred maybe_deep_flags(int::in, maybe_error(deep_flags)::out) is det.
 
 maybe_deep_flags(FlagsInt, MaybeFlags) :-
@@ -223,10 +229,24 @@
         >> deep_flag_bytes_per_int_shift,
     Canonical = (FlagsInt /\ deep_flag_canonical_mask)
         >> deep_flag_canonical_shift,
+    Compression = (FlagsInt /\ deep_flag_compression_mask)
+        >> deep_flag_compression_shift,
     Coverage = (FlagsInt /\ deep_flag_coverage_mask)
         >> deep_flag_coverage_shift,
     (
         ( 
+            Canonical = 0,
+            CanonicalFlag = maybe_not_canonical
+        ;
+            Canonical = 1,
+            CanonicalFlag = is_canonical
+        ),
+        (
+            Compression = 0,
+            CompressionFlag = no_compression
+            % There is no compression alternative yet
+        ),
+        (
             Coverage = 0, 
             CoverageFlag = no_coverage_data
         ; 
@@ -236,16 +256,10 @@
             Coverage = 2, 
             CoverageFlag = dynamic_coverage_data
         ),
-        (
-            Canonical = 0,
-            CanonicalFlag = no
-        ;
-            Canonical = 1,
-            CanonicalFlag = yes
-        ),
         0 = ((\ deep_flag_all_fields_mask) /\ FlagsInt)
     ->
-        MaybeFlags = ok(deep_flags(BytesPerInt, CanonicalFlag, CoverageFlag))
+        MaybeFlags = ok(deep_flags(BytesPerInt, CanonicalFlag, CompressionFlag,
+            CoverageFlag))
     ;
         MaybeFlags = error(
             format("Error parsing flags in file header, flags are 0x%x",
@@ -258,25 +272,39 @@
     % 
     %                              48  32  16   0
     %
+    % Bytes_per_int occupies the bottom 8 bits, bit 0 to 7.
+    % The canonical flag occupies the next 2 bits, bit 8 to 9.
+    % The compression flag occupies the next 2 bits, bit 10 to 11.
+    % The coverage indication occupies the next 2 bits, bit 12 to 13.
+    %
+    % Some of these have more bits than they currently need, in order to
+    % accommodate possible future growth.
+
 :- func deep_flag_bytes_per_int_mask = int.
 deep_flag_bytes_per_int_mask = 0x00000000000000FF.
 :- func deep_flag_bytes_per_int_shift = int.
 deep_flag_bytes_per_int_shift = 0.
 
 :- func deep_flag_canonical_mask = int.
-deep_flag_canonical_mask =     0x0000000000000100.
+deep_flag_canonical_mask =     0x0000000000000300.
 :- func deep_flag_canonical_shift = int.
 deep_flag_canonical_shift = 8.
 
+:- func deep_flag_compression_mask = int.
+deep_flag_compression_mask =   0x0000000000000C00.
+:- func deep_flag_compression_shift = int.
+deep_flag_compression_shift = 10.
+
 :- func deep_flag_coverage_mask = int.
-deep_flag_coverage_mask =      0x0000000000000B00.
+deep_flag_coverage_mask =      0x0000000000003000.
 :- func deep_flag_coverage_shift = int.
-deep_flag_coverage_shift = 10.
+deep_flag_coverage_shift = 12.
 
 :- func deep_flag_all_fields_mask = int.
 deep_flag_all_fields_mask = 
     deep_flag_bytes_per_int_mask \/
     deep_flag_canonical_mask \/
+    deep_flag_compression_mask \/
     deep_flag_coverage_mask.
 
 :- pred read_nodes(initial_deep::in, maybe_error(initial_deep)::out,
@@ -284,10 +312,11 @@
 
 read_nodes(InitDeep0, MaybeInitDeep, !IO) :-
     % Wrap the real function inside another loop.  This strategy ensures that
-    % this code works in grades that lack tail recursion such as debugging
+    % this code works in grades that lack tail recursion, such as debugging
     % grades.  read_nodes_2 will return after it has exceeded a depth limit,
-    % unwinding it's stack.  The outer loop will continue as long as
-    % read_nodes_2 thinks that more work remains.
+    % unwinding its stack. The outer loop will continue as long as read_nodes_2
+    % thinks that more work remains.
+    %
     % The depth of 50,000 has been chosen as it is roughly less than half the
     % stack depth that causes crashes during debugging.
     read_nodes_2(50000, InitDeep0, MaybeInitDeep0, !IO),
@@ -500,7 +529,7 @@
     io::di, io::uo) is det.
 
 maybe_read_ps_coverage_points(ProfileStats, MaybeCoveragePoints, !IO) :-
-    CoverageDataType = ProfileStats ^ coverage_data_type,
+    CoverageDataType = ProfileStats ^ prs_deep_flags ^ df_coverage_data_type,
     (
         CoverageDataType = no_coverage_data,
         MaybeCoveragePoints0 = ok([] - no)
@@ -513,7 +542,7 @@
             MaybeNCP = ok(NCP),
             (
                 CoverageDataType = static_coverage_data, 
-                read_n_things(NCP, read_coverage_point,
+                read_n_things(NCP, read_coverage_point_static_and_num,
                     MaybeCPPairs, !IO),
                 (
                     MaybeCPPairs = ok(CPPairs),
@@ -554,7 +583,7 @@
     maybe_error(maybe(array(int)))::out, io::di, io::uo) is det.
 
 maybe_read_pd_coverage_points(ProfileStats, MaybeCoveragePoints, !IO) :-
-    CoverageDataType = ProfileStats ^ coverage_data_type,
+    CoverageDataType = ProfileStats ^ prs_deep_flags ^ df_coverage_data_type,
     (
         ( CoverageDataType = no_coverage_data
         ; CoverageDataType = static_coverage_data
@@ -642,16 +671,18 @@
         ),
         MaybeProcLabel, !IO).
 
-    % Read a full coverage point.
+    % Read the description of a coverage point, and its execution count.
     %
-    % A full coverage point is that static data followed by a number indicating
-    % how many times that point was covered.  This is used when coverage data
-    % is per proc-static.
+    % The description of a coverage point is stored in the proc static
+    % regardless of whether we are using static or dynamic coverage profiling.
+    % If we are using static coverage profiling, then this description will be
+    % immediately followed in the profiling data file by the number of times
+    % that the coverage point was executed.
     %
-:- pred read_coverage_point(maybe_error(pair(coverage_point_info, int))::out,
-    io::di, io::uo) is det.
+:- pred read_coverage_point_static_and_num(
+    maybe_error(pair(coverage_point_info, int))::out, io::di, io::uo) is det.
 
-read_coverage_point(MaybeCP, !IO) :-
+read_coverage_point_static_and_num(MaybeCP, !IO) :-
     io_combinator.maybe_error_sequence_2(
         read_coverage_point_static,
         read_num,
@@ -659,10 +690,10 @@
             CPI = CPInfo - Count
         ), MaybeCP, !IO).
 
-    % Read the static data for coverage points.
+    % Read the description of a coverage point.
     %
-    % This data is always present in the proc static even when dynamic coverage
-    % profiling is used. 
+    % The description of a coverage point is stored in the proc static
+    % regardless of whether we are using static or dynamic coverage profiling.
     %
 :- pred read_coverage_point_static(maybe_error(coverage_point_info)::out, 
     io::di, io::uo) is det.
Index: deep_profiler/startup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/startup.m,v
retrieving revision 1.25
diff -u -b -r1.25 startup.m
--- deep_profiler/startup.m	22 Sep 2010 12:56:54 -0000	1.25
+++ deep_profiler/startup.m	30 Sep 2010 04:44:12 -0000
@@ -294,7 +294,7 @@
     array.init(NCSSs, zero_inherit_prof_info, CSSDesc0),
     array.init(NPDs, map.init, PDCompTable0),
     array.init(NCSDs, map.init, CSDCompTable0),
-    CoverageDataType = InitStats ^ coverage_data_type, 
+    CoverageDataType = InitStats ^ prs_deep_flags ^ df_coverage_data_type, 
     (
         CoverageDataType = no_coverage_data,
         MaybeStaticCoverage0 = no
@@ -764,7 +764,7 @@
 summarize_proc_dynamics_with_coverage_data(!Deep) :-
     % These arrays are one based, the +1 here is necessary to allocate the
     % correect amount of storage.
-    NPS = !.Deep ^ profile_stats ^ num_ps + 1,
+    NPS = !.Deep ^ profile_stats ^ prs_num_ps + 1,
     array_foldl3_from_1(
         summarize_proc_dynamic_with_coverage(!.Deep ^ pd_own, 
             !.Deep ^ pd_desc, !.Deep ^ pd_comp_table),
@@ -877,7 +877,7 @@
 :- pred summarize_proc_statics_coverage(deep::in, deep::out) is det.
 
 summarize_proc_statics_coverage(!Deep) :-
-    NPS = !.Deep ^ profile_stats ^ num_ps,
+    NPS = !.Deep ^ profile_stats ^ prs_num_ps,
     array_foldl_from_1(
         summarize_proc_static_coverage,
         !.Deep ^ proc_statics,
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
cvs diff: Diffing extras/graphics/mercury_glut
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/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/monte
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
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/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
Index: mdbcomp/program_representation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/program_representation.m,v
retrieving revision 1.52
diff -u -b -r1.52 program_representation.m
--- mdbcomp/program_representation.m	27 Sep 2010 05:51:02 -0000	1.52
+++ mdbcomp/program_representation.m	1 Oct 2010 07:04:39 -0000
@@ -153,16 +153,16 @@
 
 :- type goal_rep(GoalAnnotation)
     --->    goal_rep(
-                goal_expr_rep       :: goal_expr_rep(GoalAnnotation),
                     % The expression this goal represents.
+                goal_expr_rep       :: goal_expr_rep(GoalAnnotation),
 
-                goal_detism_rep     :: detism_rep,
                     % The determinism of this goal.
+                goal_detism_rep     :: detism_rep,
 
+                % This slot may be used to annotate the goal with some extra
+                % information. The deep profiling tools make use of this
+                % to associate coverage profiling data with goals.
                 goal_annotation     :: GoalAnnotation
-                    % This slot may be used to annotate the goal with some
-                    % extra information.  The deep profiling tools make use of
-                    % this to associate coverage profiling data with goals.
             ).
 
 :- type goal_rep == goal_rep(unit).
@@ -363,7 +363,7 @@
     % A table of var_rep to string mappings.
     %
     % This table may not contain all the variables in the procedure.  Variables
-    % created by the compiler are not included.  The table may be empty if it's
+    % created by the compiler are not included. The table may be empty if it is
     % not required, such as when used with the declarative debugger.
     %
 :- type var_table.
@@ -433,8 +433,7 @@
                 call_type_and_callee    :: call_type_and_callee
             ).
 
-    % The type and callee of call.  The callee is only availbie for plain
-    % calls.
+    % The type and callee of call. The callee is known only for plain calls.
     %
 :- type call_type_and_callee
     --->    callback_call
@@ -460,7 +459,6 @@
 %
 % The goal_path type is safe for use in maps and sets.  However compare/3 and
 % unify/2 are faster for goal_path_string.
-%
 
 :- type goal_path.
 
@@ -670,12 +668,17 @@
 
 :- pred byte_to_goal_type(int::in, bytecode_goal_type::out) is semidet.
 
-    % We represent a variable number as a byte if there are no more than
-    % 255 variables in the procedure; otherwise, we use two bytes.
+    % We represent a variable number as
+    % - one byte if all variable numbers fit into one byte,
+    % - two bytes if all variable numbers fit into two bytes, but
+    %   some do not fit into one byte, and
+    % - four bytes if some variable numbers do not fit into two bytes.
+    % This assumes that all variable numbers fit into four bytes.
     %
 :- type var_num_rep
-    --->    byte
-    ;       short.
+    --->    var_num_1_byte
+    ;       var_num_2_bytes
+    ;       var_num_4_bytes.
 
 :- pred var_num_rep_byte(var_num_rep, int).
 :- mode var_num_rep_byte(in, out) is det.
@@ -858,8 +861,8 @@
     Pred(A, B),
     Goal = goal_rep(Expr, Detism, B).
 
-:- pred transform_goal_expr(pred(T, U), goal_expr_rep(T), goal_expr_rep(U)).
-:- mode transform_goal_expr(pred(in, out) is det, in, out) is det.
+:- pred transform_goal_expr(pred(T, U)::in(pred(in, out) is det),
+    goal_expr_rep(T)::in, goal_expr_rep(U)::out) is det.
 
 transform_goal_expr(Pred, Expr0, Expr) :-
     (
@@ -893,8 +896,8 @@
         Expr = atomic_goal_rep(Filename, Lineno, BoundVars, AtomicGoal)
     ).
         
-:- pred transform_switch_case(pred(T, U), case_rep(T), case_rep(U)).
-:- mode transform_switch_case(pred(in, out) is det, in, out) is det.
+:- pred transform_switch_case(pred(T, U)::in(pred(in, out) is det),
+    case_rep(T)::in, case_rep(U)::out) is det.
 
 transform_switch_case(Pred, Case0, Case) :-
     Case0 = case_rep(ConsId, OtherConsIds, Goal0),
@@ -1126,8 +1129,9 @@
 
 %-----------------------------------------------------------------------------%
 
-var_num_rep_byte(byte, 0).
-var_num_rep_byte(short, 1).
+var_num_rep_byte(var_num_1_byte, 0).
+var_num_rep_byte(var_num_2_bytes, 1).
+var_num_rep_byte(var_num_4_bytes, 2).
 
 :- type var_table == map(var_rep, string).
 
@@ -1357,7 +1361,7 @@
 
 read_var_table(ByteCode, StringTable, VarNumRep, VarTable, !Pos) :-
     read_var_num_rep(ByteCode, VarNumRep, !Pos),
-    read_short(ByteCode, NumVarsInTable, !Pos),
+    read_int32(ByteCode, NumVarsInTable, !Pos),
     read_var_table_entries(NumVarsInTable, VarNumRep, ByteCode, StringTable,
         map.init, VarTable, !Pos).
 
@@ -1625,11 +1629,14 @@
 
 read_var(VarNumRep, ByteCode, Var, !Pos) :-
     (
-        VarNumRep = byte,
+        VarNumRep = var_num_1_byte,
         read_byte(ByteCode, Var, !Pos)
     ;
-        VarNumRep = short,
+        VarNumRep = var_num_2_bytes,
         read_short(ByteCode, Var, !Pos)
+    ;
+        VarNumRep = var_num_4_bytes,
+        read_int32(ByteCode, Var, !Pos)
     ).
 
 :- pred read_maybe_vars(var_num_rep::in, bytecode::in,
@@ -1678,12 +1685,12 @@
 :- pred read_length(bytecode::in, var_rep::out, int::in, int::out) is semidet.
 
 read_length(ByteCode, Len, !Pos) :-
-    read_short(ByteCode, Len, !Pos).
+    read_int32(ByteCode, Len, !Pos).
 
 :- pred read_lineno(bytecode::in, int::out, int::in, int::out) is semidet.
 
 read_lineno(ByteCode, LineNo, !Pos) :-
-    read_short(ByteCode, LineNo, !Pos).
+    read_int32(ByteCode, LineNo, !Pos).
 
 :- pred read_method_num(bytecode::in, int::out, int::in, int::out) is semidet.
 
@@ -1832,9 +1839,9 @@
 no_type_info_builtin_2(rtti_implementation_builtin, "result_call_8", 8).
 no_type_info_builtin_2(rtti_implementation_builtin, "result_call_9", 9).
 
-    % True iff the given predicate is defined with an :- external
-    % declaration.  Note that the arity includes the hidden type info
-    % arguments for polymorphic predicates.
+    % True iff the given predicate is defined with an :- external declaration.
+    % Note that the arity includes the hidden type info arguments for
+    % polymorphic predicates.
     %
 :- pred pred_is_external(string::in, string::in, int::in) is semidet.
 
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.114
diff -u -b -r1.114 mercury_conf_param.h
--- runtime/mercury_conf_param.h	21 Sep 2010 01:09:17 -0000	1.114
+++ runtime/mercury_conf_param.h	30 Sep 2010 04:45:37 -0000
@@ -334,6 +334,10 @@
 **	transactions used by software transactional memory.
 */
 
+#ifdef MR_DEEP_PROFILING_DETAIL_DEBUG
+  #define MR_DEEP_PROFILING_DEBUG
+#endif
+
 /*
 ** Runtime code alternatives. --- Sometimes there is more than one way to do
 ** something, a more efficient/optimal way, and a more portable way.  Use these
Index: runtime/mercury_deep_profiling.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_profiling.c,v
retrieving revision 1.35
diff -u -b -r1.35 mercury_deep_profiling.c
--- runtime/mercury_deep_profiling.c	21 Sep 2010 01:09:17 -0000	1.35
+++ runtime/mercury_deep_profiling.c	5 Oct 2010 03:51:21 -0000
@@ -265,7 +265,7 @@
 static  void    MR_write_out_deep_id_string(FILE *fp);
 static  void    MR_write_out_procrep_id_string(FILE *fp);
 static  void    MR_write_out_program_name(FILE *fp);
-static  void    MR_write_out_deep_flags(FILE *fp);
+static  void    MR_write_out_deep_flags(FILE *fp, MR_bool compress);
 
 static  void    MR_write_out_call_site_static(FILE *fp,
                     const MR_CallSiteStatic *css);
@@ -421,7 +421,7 @@
     MR_write_out_deep_id_string(deep_fp);
     MR_write_out_program_name(deep_fp);
   
-    MR_write_out_deep_flags(deep_fp);
+    MR_write_out_deep_flags(deep_fp, MR_FALSE);
 
     /* We overwrite these zeros after seeking back to table_sizes_offset */
     table_sizes_offset = ftell(deep_fp);
@@ -700,7 +700,7 @@
 MR_write_out_deep_id_string(FILE *fp)
 {
     /* Must be the same as deep_id_string in deep_profiler/read_profile.m */
-    const char  *id_string = "Mercury deep profiler data version 7\n";
+    const char  *id_string = "Mercury deep profiler data version 8\n";
 
     fputs(id_string, fp);
 }
@@ -713,8 +713,8 @@
 
 /*
 ** Flags in the deep profiler data file's header.  Any bit without a meaning
-** here must be set to zero as it it may be used in the future.  The next
-** line marks 16 bit boundaries in the 64bit flags value:
+** here must be set to zero as it it may be used in the future. The next line
+** marks 16 bit boundaries in the 64 bit flags value:
 **
 **       48  32  16   0
 */
@@ -723,19 +723,18 @@
 #define MR_DEEP_FLAG_WORDSIZE_SHIFT \
     (0)
 #define MR_DEEP_FLAG_CANONICAL_MASK \
-    (0x0000000000000100)
+    (0x0000000000000300)
 #define MR_DEEP_FLAG_CANONICAL_SHIFT \
     (8)
-/* This flag is not yet implemented */
 #define MR_DEEP_FLAG_COMPRESSION_MASK \
-    (0x0000000000000200)
+    (0x0000000000000C00)
 #define MR_DEEP_FLAG_COMPRESSION_SHIFT \
-    (9)
+    (10)
 /* This flag is two bits wide had has three valid values */
 #define MR_DEEP_FLAG_COVERAGE_DATA_TYPE_MASK \
-    (0x0000000000000B00)
+    (0x0000000000003000)
 #define MR_DEEP_FLAG_COVERAGE_DATA_TYPE_SHIFT \
-    (10)
+    (12)
 
 #if !defined(MR_DEEP_PROFILING_COVERAGE)
     #define MR_DEEP_FLAG_COVERAGE_DATA_TYPE_VALUE 0
@@ -746,7 +745,7 @@
 #endif
 
 static void
-MR_write_out_deep_flags(FILE *fp)
+MR_write_out_deep_flags(FILE *fp, MR_bool compress)
 {
     MR_uint_least64_t       flags = 0;
 
@@ -756,6 +755,8 @@
     flags |= MR_DEEP_FLAG_CANONICAL_MASK & 
         (1 << MR_DEEP_FLAG_CANONICAL_SHIFT);
     
+    /* ignore compress for now */
+
     flags |= MR_DEEP_FLAG_COVERAGE_DATA_TYPE_MASK & 
         (MR_DEEP_FLAG_COVERAGE_DATA_TYPE_VALUE <<
             MR_DEEP_FLAG_COVERAGE_DATA_TYPE_SHIFT);
@@ -1021,8 +1022,8 @@
         /*
         ** Some predicates in the Mercury standard library, such as
         ** exception.builtin_catch, have Mercury declarations but no Mercury
-        ** implementation (even as foreign_proc code). We do still generate
-        ** proc_static structures for them (since we *want* the hand-written
+        ** implementation, even as foreign_proc code. We do still generate
+        ** proc_static structures for them, since we *want* the hand-written
         ** C code to be able to collect deep profiling data (in this case,
         ** to count the number of executions of the EXCP port). This means that
         ** (a) they will have proc_layout structures, and (b) the bytecode
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.119
diff -u -b -r1.119 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	10 Nov 2009 04:23:40 -0000	1.119
+++ runtime/mercury_stack_layout.h	30 Sep 2010 04:45:37 -0000
@@ -1211,8 +1211,8 @@
 **   procedure body is available. If non-NULL, it contains a pointer to an
 **   array of bytecodes that represents the body of the procedure. The
 **   bytecode array should be interpreted by the read_proc_rep predicate in
-**   browser/declarative_execution.m (it starts with an encoded form of the
-**   array's length).
+**   mdbcomp/program_representation.m (it starts with an encoded form of the
+**   array's length). Its contents are generated by compiler/prog_rep.m.
 **
 **   The module_common_layout field points to the part of the module layout
 **   structure of the module containing the procedure that is common to the
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/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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 slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
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/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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