[m-rev.] diff: add XXXs about unused typeinfo_liveness fields

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat May 16 19:02:25 AEST 2020


For Julien.

When mdb-style execution tracing is enabled, handle_options.m
sets body_typeinfo_liveness to true, which is intended to signal
to compiler transformations that they should leave typeinfo
arguments in place even if seemingly unused, since the debugger
(originally mdb) may need access to them for interpreting the
values of non-typeinfo arguments. It seems that higher_order.m
was written with the *intent* to obey this rule, but never actually
got there, since it ignores both this option, and its own clumsy
attempt to set flags that play the same role.

I thought this could be the bug behind gh89, but it can't be
the complete story, since this problem would have similar bad effects
on mdb. On the other hand, I don't usually compile programs
in (non-ssdb) debug grades at -O3, and I don't think most people
do either, so maybe we just never noticed the same problem with
mdb.

In the meantime, until these XXXs are fixed, we could simply have
handle_options.m set the option calling for higher order specialization
to "no" in ssdb (and maybe debug) grades. Since you are set up for it,
could you see if this fixes gh89?

Zoltan.

diff --git a/compiler/higher_order.m b/compiler/higher_order.m
index 8f5babc..1c9a321 100644
--- a/compiler/higher_order.m
+++ b/compiler/higher_order.m
@@ -274,6 +274,11 @@ recursively_process_ho_spec_requests(!GlobalInfo, !IO) :-
 
                 % Should the interface of the specialized procedure
                 % use typeinfo liveness?
+                % XXX Unfortunately, this field is not doing its job.
+                % First, it is only ever set to "yes", so it is redundant.
+                % Second, its value is only ever used for one thing, which
+                % is to set the value of the np_typeinfo_liveness field
+                % in the new_pred type, which is itself never used.
                 rq_typeinfo_liveness    :: bool,
 
                 % Is this a user-requested specialization?
@@ -416,6 +421,8 @@ recursively_process_ho_spec_requests(!GlobalInfo, !IO) :-
 
                 % Does the interface of the specialized version use type-info
                 % liveness?
+                % XXX Unfortunately, this field is not doing its job;
+                % its value is never used for anything.
                 np_typeinfo_liveness    :: bool,
 
                 % Is this a user-specified type specialization?


More information about the reviews mailing list