Commit Graph

8 Commits

Author SHA1 Message Date
Zoltan Somogyi
04e614485d Implement deep profiling; merge the changes on the deep2 branch back
Estimated hours taken: 500
Branches: main

Implement deep profiling; merge the changes on the deep2 branch back
onto the trunk.

The main documentation on the general architecture of the deep profiler
is the deep profiling paper.

doc/user_guide.texi:
	Document how to use the deep profiler.

deep_profiler:
deep_profiler/Mmakefile:
	A new directory holding the deep profiler and its mmakefile.

Mmakefile:
	Add targets for the new directory.

	Add support for removing inappropriate files from directories.

deep_profiler/interface.m:
	The deep profiler consists of two programs: mdprof_cgi.m, which acts
	as a CGI "script", and mdprof_server.m, which implements the server
	process that the CGI script talks to. Interface.m defines the
	interface between them.

script/mdprof.in:
	A shell script template. ../configure uses it to generate mdprof,
	which is a wrapper around mdprof_cgi that tells it how to find
	mdprof_server.

deep_profiler/mdprof_cgi.m:
	The CGI "script" program.

deep_profiler/mdprof_server.m:
	The top level predicates of the server.

deep_profiler/profile.m:
	The main data structures of the server and their operations.

deep_profiler/read_profile.m:
	Code for reading in profiling data files.

deep_profiler/startup.m:
	Code for post-processing the information in profiling data files,
	propagating costs from procedures to their ancestors and performing
	various kinds of summaries.

deep_profiler/server.m:
	Code for responding to requests from the CGI script.

deep_profiler/cliques.m:
	Code to find cliques in graphs.

deep_profiler/array_util.m:
deep_profiler/util.m:
	Utility predicates.

deep_profiler/dense_bitset.m:
	An implementation of (part of) the set ADT with dense bit vectors.

deep_profiler/measurements.m:
	Operations on profiling measurements.

deep_profiler/timeout.m:
	An implementation of a timeout facility.

deep_profiler/conf.m:
	Functions that depend on autoconfigured settings.

configure.in:
	Find out what command to use to find the name of the local host.

	Install deep profiling versions of the standard library along with the
	other profiling versions.

runtime/mercury_conf.h.in:
	Add some macros for deep_profiler/conf.m to use.

library/profiling_builtin.m:
runtime/mercury_deep_call_port_body.h:
runtime/mercury_deep_leave_port_body.h:
runtime/mercury_deep_redo_port_body.h:
	A new library module that implements deep profiling primitives.
	Some of these primitives have many versions, whose common code is
	factor is factored out in three new include files in the runtime.

compiler/deep_profiling.m:
	New module to perform the program transformations described in the
	paper.

compiler/notes/compiler_design.html:
	Document the new compiler module.

compiler/mercury_compiler.m:
	Invoke the new module in deep profiling grades. Allow global static
	data to be generated by deep_profiling.m.

compiler/options.m:
	Add options to turn on deep profiling and (for benchmarking purposes)
	control its implementation.

	Add an optiooption disable tailcall optimization in the LLDS backend,
	to help benchmarking deep profiling.

compiler/jumpopt.m:
compiler/optimize.m:
	Obey the option to disable tailcalls.

compiler/handle_options.m:
	Handle the implications of deep profiling.

compiler/modules.m:
	In deep profiling grades, automatically import profiling_builtin.m.

compiler/prog_util.m:
doc/Makefile:
library/library.m:
	Handle the new builtin module.

compiler/export.m:
	In deep profiling grades, wrap deep profiling code around exported
	procedures to handle the "unscheduled call" aspects of callbacks to
	Mercury from the foreign language.

compiler/higher_order.m:
profiler/demangle.m:
util/demangle.c:
	When creating a name for a higher-order-specialized predicate, include
	the mode number in the name.

compiler/add_trail_ops.m:
compiler/type_util.m:
	Move c_pointer_type from add_trail_ops to type_util, so it can also be
	used by deep_profiling.m.

compiler/hlds_goal.m:
	Add a new goal feature that marks a tail call, for use by
	deep_profiling.m.

compiler/hlds_pred.m:
	Add a new field to proc_info structures for use by deep_profiling.m.

	Add a mechanism for getting proc_ids for procedure clones.

	Remove next_proc_id, an obsolete and unused predicate.

compiler/hlds_data.m:
	Add a new cons_id to refer to the proc_static structure of a procedure.

compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/dependency_graph.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/switch_util.m:
compiler/unify_gen.m:
	Trivial changes to handle the new cons_id, goal feature and/or
	proc_info argument.

compiler/rtti.m:
	Add a utility predicate for extracting pred_id and proc_id from an
	rtti_proc_label, for use by hlds_out.m

compiler/layout.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/llds_common.m:
	Add support for proc_static and call_site_static structures.

compiler/layout_out.m:
compiler/llds_out.m:
	Add code for the output of proc_static structures.

compiler/code_util.m:
	Make code_util__make_proc_label_from_rtti a function, and export it.

util/mkinit.c:
compiler/llds_out.m:
compiler/layout.m:
compiler/modules.m:
	Add support for a fourth per-module C function, for writing out
	proc_static structures (and the call_site_static structures they
	contains).

	Since proc_static structures can be referred to from LLDS code (and not
	just from other static structures and compiler-generated C code),
	reorganize the declarations of static structures slightly.

	Change the schema for the name of the first per-module C function
	slightly, to make it the addition of the fourth function easier.
	The scheme now is:

		mercury__<modulename>__init
		mercury__<modulename>__init_type_tables
		mercury__<modulename>__init_debugger
		mercury__<modulename>__write_out_proc_statics

	Improve formatting of the generated C code.

library/*.m:
runtime/mercury.c:
runtime/mercury_context.c:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
trace/mercrury_trace.[ch]:
trace/mercrury_trace_declarative.c:
trace/mercrury_trace_external.c:
trace/mercrury_trace_internal.c:
	Conform to the new scheme for initialization functions for hand-written
	modules.

compiler/mercury_compile.m:
library/benchmarking.m:
runtime/mercury_conf_param.h:
runtime/mercury.h:
runtime/mercury_engine.c:
runtime/mercury_goto.c:
runtime/mercury_grade.h:
runtime/mercury_ho_call.c:
runtime/mercury_label.[ch]:
runtime/mercury_prof.[ch]:
	Add an MR_MPROF_ prefix in front of the C macros used to control the
	old profiler.

compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Make deep profiling completely separate from the old profiling system,
	by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME
	and the compiler option --profile-time.

library/array.m:
library/builtin.m:
library/std_util.m:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_compare_body.h:
	In deep profiling grades, wrap the deep profiling call, exit, fail
	and redo codes around the bodies of hand-written unification
	and comparison procedures.

	Make the reporting of array bounds violations switchable between
	making them fatal errors, as we currently, and reporting them by
	throwing an exception. Throwing an exception makes debugging code
	using arrays easier, but since exceptions aren't (yet) propagated
	across engine boundaries, we keep the old behaviour as the default;
	the new behaviour is for implementors.

runtime/mercury_deep_profiling_hand.h:
	New file that defines macros for use in Mercury predicates whose
	definition is in hand-written C code.

library/exception.m:
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
	In deep profiling grades, wrap the deep profiling call, exit, fail
	and redo codes around the bodies of the various modes of builtin_catch.

	Provide a function that C code can use to throw exceptions.

library/benchmarking.m:
library/exception.m:
library/gc.m:
library/std_util.m:
runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_debug.c:
runtime/mercury_deep_copy.c:
runtime/mercury_overflow.h:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
	Add prefixes to the names of the fields in the engine and context
	structures, to make code using them easier to understand and modify.

runtime/mercury_deep_profiling.[ch]:
	New module containing support functions for deep profiling and
	functions for writing out a deep profiling data file at the end of
	execution.

runtime/mercury_debug.[ch]:
	Add support for debugging deep profiling.

	Add support for watching the value at a given address.

	Make the buffered/unbuffered nature of debugging output controllable
	via the -du option.

	Print register contents only if -dr is specified.

runtime/mercury_goto.h:
runtime/mercury_std.h:
	Use the macros in mercury_std.h instead of defining local variants.

runtime/mercury_goto.h:
runtime/mercury_stack_layout.h:
runtime/mercury_stack_trace.c:
runtime/mercury_tabling.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_vars.c:
	Standardize some of the macro names with those used in the debugger
	paper.

runtime/mercury_heap.h:
	Add support for memory profiling with the deep profiler.

runtime/mercury_prof.[ch]:
runtime/mercury_prof_time.[ch]:
	Move the functionality that both the old profiler and the deep profiler
	need into the new module mercury_prof_time. Leave mercury_prof
	containing stuff that is only relevant to the old profiler.

runtime/mercury_prof.[ch]:
runtime/mercury_strerror.[ch]:
	Move the definition of strerror from mercury_prof to its own file.

runtime/mercury_wrapper.[ch]:
	Add support for deep profiling.

	Add suppory for controlling whether debugging output is buffered or
	not.

	Add support for watching the value at a given address.

runtime/Mmakefile:
	Mention all the added files.

scripts/mgnuc.in:
	Add an option for turning on deep profiling.

	Add options for controlling the details of deep profiling. These
	are not documented because they are intended only for benchmarking
	the deep profiler itself, for the paper; they are not for general use.

tools/bootcheck:
	Compile the deep_profiler directory as well as the other directories
	containing Mercury code.

	Turn off the creation of deep profiling data files during bootcheck,
	since all but one of these in each directory will be overwritten
	anyway.

	Add support for turning on --keep-objs by default in a workspace.

tools/speedtest:
	Preserve any deep profiling data files created by the tests.

trace/mercury_trace.c:
	Trap attempts to perform retries in deep profiling grades, since they
	would lead to core dumps otherwise.

util/Mmakefile:
	Avoid compile-time warnings when compiling getopt.

tests/*/Mmakefile:
tests/*/*/Mmakefile:
	In deep profiling grades, switch off the tests that test features
	that don't work with deep profiling, either by design or because
	the combination hasn't been implemented yet.
2001-05-31 06:00:27 +00:00
Adrian Pellas-Rice
1c65d003f7 Add the shorthand_goal_expr wrapper type to ease hlds->hlds transformations.
Estimated hours taken: 4.5
Branches: main

Add the shorthand_goal_expr wrapper type to ease hlds->hlds transformations.

compiler/hlds_goal.m
        Create a new type, the `shorthand_goal_expr', for goals kinds that
        are implemented by a (ordinary_hlds + shorthand) -> (ordinary_hlds)
        transformation.  At present, bi_implication is the only kind of
        of goal that is implemented in this way.

        Moved bi_implication functor from the type goal_expr to the new
        shorthand_goal_expr type.

        Added the functor shorthand to the goal_expr type.

compiler/*.m
        Change switches on hlds_goal_expr that call error when they recognise
        `bi_implication' from calling error when they recognise
        `bi_implication' to calling error when they recognise `shorthand'.

        For all predicates K that
                a) switch on hlds_goal_expr and
                b) perform non-trivial processing when they recognise
                   `bi_implication'
        change K such that it now calls K_shorthand upon recognising the
        functor `shorthand'. Define K_shorthand to switch on
        shorthand_goal_expr, where the code for the `bi_implication' case
        formerly contained in K is now contained in K_shorthand.
2001-04-07 14:05:03 +00:00
Tyson Dowd
711da78188 Rename foreign_code as foreign_proc where appropriate in the compiler.
Estimated hours taken: 4.0
Branches: main

Rename foreign_code as foreign_proc where appropriate in the compiler.
The rationale for this change is that it makes maintaining the code much
simpler because it is clear whether `foreign' refers to a slab of code
(foreign_code) or a procedure (foreign_proc).

:- type pragma_foreign_code_attributes
:- type pragma_foreign_proc_attributes

The functors for pragma_type
	foreign(Lang, BodyCode)
	foreign(Attributes, Name, PredOrFunc, Vars, Varset, Impl)
become
	foreign_code(Lang, BodyCode)
	foreign_proc(Attributes, Name, PredOrFunc, Vars, Varset, Impl)

And the HLDS goal `pragma_foreign_code' becomes `foreign_proc'.

compiler/*.m:
	Update the compiler to use the new names.
2001-04-03 03:20:33 +00:00
Mark Brown
0b062bc60f This is the first part of a change to support term dependency analysis
Estimated hours taken: 80

This is the first part of a change to support term dependency analysis
in the declarative debugger.  A method is added to the mercury_edt
typeclass which finds the origin of a selected subterm in an EDT node,
somewhere in the body of the call or in the body of the parent.  The
other parts of the change required before this can be useful are to
modify the search strategy (in browser/declarative_analyser.m) to make
use of the new information, and to modify the user interface to allow
a subterm to be selected.  They will be committed as separate changes.

The typeclass method first traverses one or more contours, matching the
contour events up with goals in a procedure representation.  This matching
process requires a left to right traversal, because we need to know which
disjunct/arm/branch was taken before we can match subgoals, and the
DISJ/SWTCH/THEN/ELSE events which tell us this information occur at the
left edge of the subgoals to which they apply.  But we must always start
from the right hand side of the contour being traversed, so this means
that a right to left traversal is required before the matching can start.

Using the contour matched up with the atomic goals, we track the location
of a subterm by looking at which variables are bound, while scanning right
to left along the contour.  Because this must happen after the matching,
this must be a separate right to left traversal than the earlier one.
Therefore the algorithm implemented here requires two passes over the
contours in order to find the origin of the selected subterm.

browser/declarative_execution.m:
	Add a maybe(goal_rep) to call nodes in the annotated trace.  This
	is `no' if the relevant module was compiled below trace level `rep'.

trace/mercury_trace_declarative.c:
	If the information is available, fill in the goal_rep when
	constructing call nodes.

browser/declarative_analyser.m:
	Add the new method to the mercury_edt typeclass.

browser/declarative_debugger.m:
	Implement the new method.  Update for the changed call nodes.

browser/program_representation.m:
	Add a version of goal_paths to be used by the declarative debugger,
	and a predicate to parse these from goal_path_strings.  Add the
	types arg_pos and term_path to represent a subterm of a call or exit.

browser/program_representation.m:
compiler/prog_rep.m:
	No longer store conjunctions in reverse order in the goal_rep; we now
	store them in the same order as in the HLDS.

	Although we search conjunctions in reverse order, we need to match
	them up with contour events before doing that.  This can only be
	done in the forwards direction, so it turns out that there is no
	advantage in storing them in reverse order.

compiler/hlds_goal.m:
compiler/trace.m:
	Add comments to the existing definitions of goal_path and
	path_step_to_string.
2001-01-16 15:44:25 +00:00
Tyson Dowd
477ecb18f6 Implement pragma foreign_code for Managed C++.
Estimated hours taken: 60

Implement pragma foreign_code for Managed C++.

Currently you can only write MC++ code if your backend is capable of
generating use MC++ as its "native" foreign language.  The IL backend is
the only backend that does this at the moment (the other backends have C
as their "native" foreign language).

Most of the machinery is in place to call from C to (normal) C++
but there is little work done on actually spitting out the C++ code into
a separate file.  The IL backend does this step already with managed C++.
The intention is to turn foreign_code for C++ into a pragma import
(which imports the C++ function from a separate file) and
foreign_code for C (which calls the imported function).  The C++ code
will be inserted into a separate file that is compiled using C linkage.

The important improvement this change gives is that you can write a
module with a C and a MC++ implementations side-by-side.  The target
backend will select the most appropriate foreign language to use.
You can override its choice using --use-foreign-language.  Later on
we will probably want more flexibility than just a single language
selection option).

This change also implements :- pragma foreign_decl, which allows header
file style declarations to be written in languages other than C.

compiler/code_gen.m:
	Reject code that is not C when generating LLDS.

compiler/export.m:
	Start renaming C as foreign.
	Reject code that is not C when generating exports.

compiler/foreign.m:
	A new module to handle foreign language interfacing.
	The bulk of the code for pragma import has been moved here from
	make_hlds.

compiler/globals.m:
	Convert foreign language names to foreign_language.
	This code has been moved closer to the similar conversion we do
	for target language names.
	Add globals__io_lookup_foreign_language_option to make it easier
	to deterministically lookup the options relating to foreign
	languages.


compiler/hlds_module.m:
	Move module_add_foreign_decl and module_add_foreign_body_code
	from make_hlds.m (where they were called module_add_c_header and
	module_add_c_code).

compiler/hlds_out.m:
	Write the foreign language out in HLDS dumps.

compiler/llds.m:
	Change foreign_header_info to foreign_decl_info.
	Change definitions of foreign_decl_code and foreign_body_code to
	include the language.

compiler/llds_out.m:
	Reject code that is not C when writing out LLDS.

compiler/make_hlds.m:
	Add foreign language information to the bodys and decls when
	creating them.
	Update error messages to refer to foreign code instead of C
	code.
	Use foreign.m to generate interfaces from the backend language
	to the foreign language.
	Hardcode C as the language for fact tables.

compiler/mercury_compile.m:
	Collect the appropriate foreign language code together for
	output to the backend.

compiler/intermod.m:
compiler/mercury_to_mercury.m:
	Output the foreign language string.
	Change a few names to foreign_code instead of c_code.

compiler/ml_code_gen.m:
	Filter the foreign language bodys and decls so that we only get
	the ones we are in (given by the use-foreign-language option).

compiler/mlds_to_c.m:
	Abort if we are given non C foreign language code to output
	(we might handle it here in future, or we might handle it
	elsewhere).

compiler/mlds_to_ilasm.m:
	Abort if we are given non MC++ foreign language code to output
	(we might handle it here in future, or we might handle it
	elsewhere).

compiler/options.m:
compiler/handle_options.m:
	Add --use-foreign-language as a user option to control the
	preferred foreign language to use as the implementation of this
	module.
	Add backend_foreign_language as an internal option which stores
	the foreign language that the compiler will use as a default
	(e.g. the natural foreign language for the backend to use).
	Set the preferred backend foreign language depending on the
	target.

compiler/prog_data.m:
	Add managedcplusplus as a new alternative for the
	foreign_language type.
	Make c_header_code into foreign_decl.
	Give the foreign language for foreign_code as an attribute of
	the code.
	Write code to turn attributes into a list of strings (suitable
	for writing out by mercury_to_mercury).  This fixes what appears
	to be a bug in tabled_for_io -- the tabled_for_io attribute was not
	being written out.  Structure the code so this bug is
	difficult to repeat in future.

compiler/prog_io_pragma.m:
	Parse foreign_decl.
	Turn c_header_code into a special case of foreign_decl.

compiler/*.m:
	Remove the language field from pragma_foreign_code, it is now an
	attribute of the code.
	Various type and variable renamings.

tests/invalid/pragma_c_code_and_clauses1.err_exp:
tests/invalid/pragma_c_code_dup_var.err_exp:
tests/warnings/singleton_test.exp:
	Update the tests to reflect the new error messages talking
	about :- pragma foreign_code rather than :- pragma c_code.
2000-11-17 17:48:52 +00:00
David Overton
82378c381b Allow polymorphic ground insts. This change assumes that all inst
Estimated hours taken: 80

Allow polymorphic ground insts.  This change assumes that all inst
parameters in the mode declaration for a predicate or function are
constrained to be ground-shared.  This is a temporary measure until we
work out a nice syntax to allow the programmer to tell the compiler that
certain inst parameters may be treated as ground insts.  Since we don't
currently support unconstrained inst parameters anyway, this shouldn't
cause a problem.

	TODO:
		- Add syntax, something like `:- mode p(in(I)) <= ground(I).',
		  to specify that an inst parameter represents a ground inst.
		- Allow abstract ground insts that are treated in a similar
		  way to what we've done here with ground inst parameters.
		- Make mode checking more efficient (i.e. rewrite the mode
		  system).

compiler/inst.m:
	Add a new alternative for ground insts:
		`constrained_inst_var(inst_var)'.
	Define the type `inst_var_sub'.

compiler/inst_match.m:
	Change inst_matches_initial so that it:
		- handles constrained_inst_vars correctly;
		- returns the inst_var substitutions necessary for the call;
		- handles inst_matches_initial(ground(...), bound(...), ...)
		  properly (this requires knowing the type of the variable).

	  The last change has also been made for inst_matches_final
	  and inst_matches_binding.  However, the check is disabled for
	  now because, without alias tracking, the mode checker
	  becomes too conservative.

compiler/hlds_pred.m:
compiler/mode_info.m:
compiler/simplify.m:
compiler/det_util.m:
	Include the inst_varset in the proc_info, mode_info and simplify_info.
	Add a vartypes field to the det_info.
	Remove the vartypes field from the simplify_info since it is
	now in the det_info.
	Use record syntax for these data structures and their access predicates
	to make future changes easier.

compiler/prog_io.m:
	When processing pred and func mode declarations, convert all inst_var(V)
	insts to ground(shared, constrained_inst_var(V)).

compiler/prog_data.m:
compiler/hlds_data.m:
compiler/make_hlds.m:
compiler/mode_util.m:
	Use inst_vars instead of inst_params.

compiler/modes.m:
compiler/modecheck_call.m:
compiler/unique_modes.m:
compiler/mode_util.m:
	When checking or recomputing initial insts of a call, build up
	an inst_var substitution (using the modified
	inst_matches_initial) and apply this to the final insts of the
	called procedure before checking/recomputing them.

compiler/mode_util.m:
	Make sure that recompute_instmap_delta recomputes the
	instmap_deltas for lambda_goals even when RecomputeAtomic = no.

compiler/type_util.m:
	Add a new predicate, type_util__cons_id_arg_types which
	nondeterministically returns the cons_ids and argument types for a
	given type.
	Add a new predicate type_util__get_consid_non_existential_arg_types
	which is the same as type_util__get_existential_arg_types except
	that it fails rather than aborting for existenially typed arguments.

compiler/accumulator.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/common.m:
compiler/continuation_info.m:
compiler/deforest.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/det_util.m:
compiler/dnf.m:
compiler/follow_code.m:
compiler/goal_store.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_util.m:
compiler/instmap.m:
compiler/lambda.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/mercury_to_mercury.m:
compiler/modecheck_unify.m:
compiler/module_qual.m:
compiler/pd_info.m:
compiler/pd_util.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/prog_io_util.m:
compiler/prog_rep.m:
compiler/saved_vars.m:
compiler/stack_layout.m:
compiler/table_gen.m:
compiler/unify_proc.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
	Pass inst_varsets and types where needed.
	Changes to reflect change in definition of the inst data type.

compiler/inlining.m:
	Recompute the instmap deltas for a procedure after inlining.
	This bug showed up compiling tests/hard_coded/lp.m with
	inlining and deforestation turned on: deforestation was
	getting incorrect instmap deltas from inlining, causing
	the transformation to break mode-correctness.  It has only
	just shown up because of the added call to
	`inst_matches_initial' from within `recompute_instmap_delta'.

tests/invalid/Mmakefile:
tests/invalid/unbound_inst_var.m:
tests/invalid/unbound_inst_var.err_exp:
tests/valid/Mmakefile:
tests/valid/unbound_inst_var.m:
	Move the `unbound_inst_var' test case from `invalid' to `valid'
	and extend its coverage a bit.
2000-10-13 13:56:17 +00:00
Peter Ross
35d1d914e7 Update the MLDS backend to handle structure reuse and compile time gc.
Estimated hours taken: 20

Update the MLDS backend to handle structure reuse and compile time gc.
Note that currently no pass on the main branch currently generates this
information yet.

mlds.m:
    Add a new instruction delete_object which is to be inserted
    whenever a lval can be compile time garbage collected.

ml_unify_gen.m:
    Handle the case where the HowToConstruct field of a construction
    is reuse_cell(_).
    Handle the case where a deconstruction can be compile time gc'd.

hlds_goal.m:
    Add a new field, can_cgc, to deconstruction unifications.  This
    field is `yes' if the deconstruction unification can be compile time
    garbage collected.

hlds_out.m:
    Output the can_cgc field.  Output unification information if we
    request the structure reuse information.

ml_elim_nested.m:
mlds_to_c.m:
    Handle the delete_object instruction.

builtin_ops.m:
    Fix a bug where body was an unary op instead of a binary op.

bytecode.m:
c_util.m:
llds.m:
opt_debug.m:
vn_cost.m:
    Changes to reflect that body is a binary op.

bytecode_gen.m:
code_aux.m:
common.m:
cse_detection.m:
dependency_graph.m:
det_analysis.m:
goal_util.m:
higher_order.m:
mark_static_terms.m:
mode_util.m:
modecheck_unify.m:
pd_cost.m:
pd_util.m:
prog_rep.m:
rl_exprn.m:
rl_key.m:
simplify.m:
switch_detection.m:
term_traversal.m:
unify_gen.m:
unused_args.m:
    Handle the can compile time gc field in deconstruction unifications.
2000-10-06 10:18:39 +00:00
Zoltan Somogyi
3ce3b14c84 Make procedure bodies available to the declarative debugger.
Estimated hours taken: 20

Make procedure bodies available to the declarative debugger.

browser/program_representation.m:
	Add _rep suffixes to the function symbols, to make iit easier to
	distinguish HLDS goals and goal representations.

compiler/static_layout.m:
	If --trace-decl is specified, include a representation of the procedure
	body in the procedure's layout structure.

compiler/prog_rep.m:
	A new module, containing the code that converts goals from HLDS
	to a term in the format we want to put in the layout structure.

compiler/static_term.m:
	A new module, containing the code that converts Mercury terms
	to the LLDS rval we need to give to llds_out.m.

compiler/code_gen.m:
compiler/continuation_info.m:
	Preserve the information needed by prog_rep

compiler/Mmakefile:
	Extend the search path to the browser directory, since the new file
	prog_rep.m imports one of the submodules of mdb.m stored there.

compiler/notes/compiler_desigm.html:
	Document the new modules.

library/std_util.m:
	Add a mechanism for static_term.m to use in converting terms into
	rvals. This mechanism uses RTTI information to deconstruct terms,
	and return not only their arguments, but also information about how
	the term can be constructed from its arguments.

runtime/mercury_type_info.h:
	Add a couple of macros to make construction and deconstruction of univs
	easier, for use in std_util.m.

trace/mercury_trace_internal.c:
	Add a new command, "proc_body", that prints out the representation
	of the body of the current procedure. This is meant only for developers
	to use to check that the procedure body representation is OK; it is
	deliberately not documented.

	Also fix a bug: make sure that we do not pass a NULL pointer to fputs
	when echoing a line of input that isn't there (because we got EOF).
2000-09-25 04:37:26 +00:00