-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I/O tabling has two main purposes. The first and more important is to allow the debugger to replay parts of the program execution for the programmer, which requires making I/O operations idempotent (so that we get the same results on the second, third etc "execution" as on the first). The second purpose is to let the person using the debugger actually see a list of the I/O actions, and their results. The root of the problem here is that the compiler can do the second part only if it has access to the type_infos describing the types of the arguments of the I/O action. With the current infrastructure for representing typeclass information, this is not always possible in the presence of typeclass constraints on I/O action predicates. The reason is that polymorphism.m can put the typeinfo for a type variable that is subject to a typeclass constraint arbitrarily deep inside the typeclass_info for that constraint, but the RTTI can encode such locations only up to a fixed depth (currently only the shallowest embedded is encodable). Before this fix, the test case for this bug got a compiler abort when the I/O tabling transformation tried to figure out how to table the typeclass info representing the typeclass constraint on a I/O action predicate. We still cannot table typeclass infos. We could store them (I/O tabling does not require anything more complicated), but the problem of deeply buried typeinfos inside them would still remain. So this fix consists of two parts: - for typeclass constrained I/O primitives, recording only enough information to allow them to replayed (the first purpose above), and not to print them out (the second purpose), and - getting the runtime system to understand this, and not crash with a core dump in the absence of the information required for the second purpose. This second part requires changes to the RTTI used by I/O tabling. These changes BREAK BINARY COMPATIBILITY in debug grades. runtime/mercury_stack_layout.h: Rename the MR_TableIoDecl structure as the MR_TableIoEntry structure, since the I/O table entries that it describes are used not just for declarative debugging, but also for printing out I/O actions. Add a field to it that specifies whether the fields describing the types of the I/O action's arguments are meaningful. runtime/mercury_grade.h: Bump the debug-only binary compatibility version number, since the change to mercury_stack_layout.h requires it. runtime/mercury_trace_base.[ch]: When returning information about a tabled I/O action, return a boolean that says whether the information abouts its arguments is actually present or not. Do not return information about the arguments if we cannot convert them into univs due to missing type information. browser/io_action.m: Pay attention to the new info returned by MR_trace_get_action, and avoid a potential core dump by generating a description of the requested I/O action only if the argument type information needed to generate that description is actually available. trace/mercury_trace_vars.c: Pay attention to the new info returned by MR_trace_get_action. When the argument type information needed to generate an accurate description of the I/O action is not available, generate a "description" that mentions this fact. trace/mercury_trace_cmd_browsing.c: Make the fix to mercury_trace_vars.c easier to test by adding a mechanism to print out all existing I/O actions, as long as there aren't too many of them. compiler/hlds_pred.m: compiler/layout.m: compiler/prog_data.m: Prepare for the possibility that we have cannot record the information needed to reconstruct the runtime types of the arguments of a I/O tabled predicate. compiler/table_gen.m: If an I/O tabled predicate has one or more typeclass constraints, do not attempt to record the RTTI needed to reconstruct the types of its arguments at runtime. compiler/continuation_info.m: compiler/hlds_data.m: Rename some data structures that referred to the old MR_TableIoDecl structure to refer to its replacement, the MR_TableIoEntry structure. compiler/bytecode_gen.m: compiler/ctgc.selector.m: compiler/dead_proc_elim.m: compiler/dependency_graph.m: compiler/erl_unify_gen.m: compiler/export.m: compiler/higher_order.m: compiler/hlds_code_util.m: compiler/hlds_out_mode.m: compiler/hlds_out_pred.m: compiler/hlds_out_util.m: compiler/hlds_pred.m: compiler/implementation_defined_literals.m: compiler/inst_check.m: compiler/layout.m: compiler/layout_out.m: compiler/llds.m: compiler/llds_out_data.m: compiler/llds_out_file.m: compiler/llds_out_util.m: compiler/mercury_compile_llds_back_end.m: compiler/mercury_to_mercury.m: compiler/ml_global_data.m: compiler/ml_switch_gen.m: compiler/ml_type_gen.m: compiler/ml_unify_gen.m: compiler/mode_util.m: compiler/module_qual.m: compiler/opt_debug.m: compiler/proc_gen.m: compiler/prog_data.m: compiler/prog_out.m: compiler/prog_rep.m: compiler/prog_type.m: compiler/prog_util.m: compiler/rbmm.execution_path.m: compiler/stack_layout.m: compiler/structure_reuse.direct.choose_reuse.m: compiler/switch_gen.m: compiler/switch_util.m: compiler/type_ctor_info.m: compiler/unify_gen.m: compiler/unused_imports.m: compiler/xml_documentation.m: runtime/mercury_misc.h: runtime/mercury_tabling.h: Conform to the above changes. tests/debugger/tabled_typeclass.{m,inp,exp,exp2}: New test case to test that I/O actions that have typeclass constraints on them can be printed in mdb. tests/debugger/Mmakefile: tests/debugger/Mercury.options: Enable the new case.
- Loading branch information
Showing
62 changed files
with
713 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.