diff: make --typeinfo-liveness imply --no-middle-rec
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Oct 28 07:45:16 AEDT 1998
Simon Taylor reported a while back that the compiler generated
incorrect code for list__reverse_2/3 if --typeinfo-liveness
and --middle-rec were both enabled. I spent quite a bit
of time investigating this one, and came to the conclusion
that the best fix is to just disable middle-rec if typeinfo-liveness
is enabled.
--typeinfo-liveness causes the generated code to touch the stack,
because store_alloc.m decides to put the type_info variables in stack slots.
Middle recursion optimization, as currently implemented,
does not work (a) if the code being optimized touches the stack in the
base case or (b) if the "after" code is empty and the "before" code
touches the stack. Furthermore modifying middle_rec.m to rectify that
looks like a difficult task, and one that is probably not worthwhile,
since the generated code wouldn't be that great anyway.
I suppose we may want to revisit this issue when we're trying
to get a good "LIPS" figure for accurate gc ;-)
--------------------
Estimated hours taken: 4
Fix a bug where the compiler was generating incorrect code for
list__reverse_2/3 if the `--typeinfo-liveness' option was set
(e.g. for `--gc accurate').
compiler/handle_options.m:
Make `--typeinfo-liveness' disable middle recursion optimization,
and add a comment explaining why.
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.64
diff -u -r1.64 handle_options.m
--- handle_options.m 1998/10/16 06:17:16 1.64
+++ handle_options.m 1998/10/27 19:36:01
@@ -385,6 +385,12 @@
% predicates correctly with --typeinfo-liveness.
option_implies(typeinfo_liveness, deforestation, bool(no)),
+ % XXX middle_rec doesn't work with --typeinfo-liveness,
+ % because --typeinfo-liveness causes the stack to be used
+ % in places where middle_rec is not expecting it and has
+ % hence not set up a stack frame.
+ option_implies(typeinfo_liveness, middle_rec, bool(no)),
+
% --dump-hlds and --statistics require compilation by phases
globals__io_lookup_accumulating_option(dump_hlds, DumpStages),
globals__io_lookup_bool_option(statistics, Statistics),
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list