[m-rev.] for review: reducing string table size
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Sep 22 15:41:27 AEST 2011
On Wed, 21 Sep 2011, Zoltan Somogyi wrote:
> Reduce the size of the string tables in debuggable executables by encoding
> variable names that a few standard templates, the most important of which
> is STATE_VARIABLE_name_number.
that are _of_ a few standard templates ... ?
> The effect on the compiler is to reduce the string table size from about
> 3.1Mb to about 2.1Mb, which is about a 30% reduction.
>
> compiler/stack_layout.m:
> Look for the names fitting the patterns in variable names, and encode
> them.
>
> runtime/mercury_stack_layout.[ch]:
> Add a function for looking up variable names, decoding them if needed.
>
> Since goal paths cannot fit any of the patterns, access them without
> using that function.
>
> mdbcomp/rtti_access.m:
> Use the new function to retrieve variable names.
>
> runtime/mercury_grade.h:
> Increment the debugging compatibility version number, since debuggable
> executables in which some modules were produced by a compiler without
> this diff and some were produced by a compiler with this diff won't
> work together.
>
...
> Index: runtime/mercury_stack_layout.c
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.c,v
> retrieving revision 1.3
> diff -u -b -r1.3 mercury_stack_layout.c
> --- runtime/mercury_stack_layout.c 12 Sep 2007 06:21:16 -0000 1.3
> +++ runtime/mercury_stack_layout.c 21 Sep 2011 09:40:12 -0000
...
> @@ -40,12 +41,120 @@
> }
>
> /* variable number 1 is stored at offset 0 */
> - offset = entry->MR_sle_used_var_names[hlds_var_num - 1];
> + name_code = entry->MR_sle_used_var_names[hlds_var_num - 1];
> + return MR_name_in_string_table(string_table, string_table_size,
> + name_code, should_copy);
> +}
> +
> +MR_ConstString
> +MR_name_in_string_table(const char *string_table, MR_Integer string_table_size,
> + MR_uint_least32_t name_code, int *should_copy)
> +{
> + // The encoding decoded here is create by lookup_string_in_table
> + // in compiler/stack_layout.m. The code here and there must be kept
> + // in sync.
I would still avoid using //-style comments in places where it isn't
absolutely clear that the C compiler supports them.
That looks fine otherwise.
Julien.
--------------------------------------------------------------------------
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