[m-rev.] for preliminary review: bug 493 & 532 alterative fix

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue May 18 02:18:14 AEST 2021


2021-05-17 14:40 GMT+10:00 "Zoltan Somogyi" <zoltan.somogyi at runbox.com>:
> 2021-05-17 14:17 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
>> It is possible to reproduce the duplicate row without that change
>> by DISABLING loop invariant hoisting, e.g. -O5 --no-loop-invariants,
>> so that mark_static_terms is not run before common.m.
>> > What happens is that row 4 and row 5 have identical constants that are
>> cast to different types, which makes no difference in the C output.
>> > This is the call to cord.snoc in ml_gen_scalar_static_defn:
> 
> Thanks for all that detective work. I will look into what we can do
> to fix this problem.

The attached diff fixes the problem, but I am not sure it is worth
turning it on. It does eliminate the double row in state_var.c,
but applying "stat -A" and then grep for .rodata to all the .o files
in the compiler directory (except the two for the two source files
touched by this change), I get 160,636 bytes before this diff
and 160,540 bytes after, with all compiler options being the same.
That is a small fraction of a percent improvement in space usage.
I can't measure the impact on execution time, because I am pretty
sure that any benchmarking will measure more the thermal throttling
done by my laptop than the impact of this change :-(

If Peter approves the correctness of this change, I propose
to commit the change to mlds_to_c_type.m as is, but comment out
the change to ml_global_data.m with a comment on why. In other words,
add this space optimization, but leave it turned off.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.semicanon
Type: application/octet-stream
Size: 529 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20210518/d1c10788/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.semicanon
Type: application/octet-stream
Size: 15279 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20210518/d1c10788/attachment-0003.obj>


More information about the reviews mailing list