Commit Graph

13331 Commits

Author SHA1 Message Date
Julien Fischer
faa18a15bd Fix the bug with initialisers/finalisers in libraries not being called ( and
Estimated hours taken: 7
Branches: main, release

Fix the bug with initialisers/finalisers in libraries not being called ( and
as consequence also fixes the bug with mutables not being given their correct
initial value).  The problem was that the directives necessary to call them
were not being included in the libraries' .init file.

The fix is to add a new mode of operation to mkinit that given a list of
.c files that make up some Mercury library, constructs the .init file for
that library.  In particular, it now constructs the .init file so that
it contains any REQUIRED_{INIT,FINAL} directives needed by the library.
The new mode of operation is invoked when mkinit is given the `-k' option.

Modify the build systems (i.e. mmake and mmc --make) to conform to the
above change.

compiler/modules.m:
	Change the rule mmake uses to build .init files so that it calls
	mkinit -k on all the .c files generated for the library.

scripts/Mmake.vars.in:
	Add a new mmake variable MKLIBINIT.  This is the program used to
	create .init files.  (It will nearly always be mkinit.)

compiler/compile_target_code.m:
	Change how .init files are built.  We now have to call mkinit -k to
	scan all of the .c files to write out the correct set of INIT,
	REQUIRED_INIT and REQUIRED_FINAL directives.  The code here is
	that used by mmc --make for creating the .init files.

compiler/make.program_target.m:
	Build the .init file after building the .c files, since building
	it before will no longer work.
2006-05-21 06:22:59 +00:00
Julien Fischer
a2de6b0516 Fix a buglet that broke the nightly builds on ceres.
Estimated hours taken: 0
Branches: main, release

Fix a buglet that broke the nightly builds on ceres.

util/mkinit.c:
	Shift the variable declarations in main to the beginning of the block.
2006-05-17 14:42:31 +00:00
Julien Fischer
4e715901ba Fix the bug with initialisers/finalisers in libraries not being called ( and
Estimated hours taken: 7
Branches: main, release

Fix the bug with initialisers/finalisers in libraries not being called ( and
as consequence also fixes the bug with mutables not being given their correct
initial value).  The problem was that the directives necessary to call them
were not being included in the libraries' .init file.

The fix is to add a new mode of operation to mkinit that given a list of
.c files that make up some Mercury library, constructs the .init file for
that library.  In particular, it now constructs the .init file so that
it contains any REQUIRED_{INIT,FINAL} directives needed by the library.
The new mode of operation is invoked when mkinit is given the `-k' option.

Changes to the build systems to use the new mode of operation will be committed
after the changes to mkinit have bootchecked.

util/mkinit.c:
	Add a new mode of operation, `-k'.  When invoked with this
	option mkinit will read a list of .c files and emit a sequence of
	INIT, REQUIRED_INIT and REQUIRED_FINAL directives to stdout,
	corresponding to INIT, REQUIRED_INIT and REQUIRED_FINAL comments
	in the .c files.
2006-05-17 07:52:50 +00:00
Julien Fischer
870e0d4aee Add modes of list.map_foldl/5 that have a mostly-unique accumulator.
Estimated hours taken: 0.1
Branches: main, release

library/list.m:
	Add modes of list.map_foldl/5 that have a mostly-unique accumulator.
2006-05-15 09:12:05 +00:00
Julien Fischer
1d3f380430 For each module generate a function mercury__<modulename>__required_init
Estimated hours taken: 2
Branches: main, release

For each module generate a function mercury__<modulename>__required_init
that calls any initialisers in the module.  We only create this function if
there are any user-defined initialisation predicates (or any introduced for
mutable initialisation.) This means that at most one REQUIRED_INIT comment per
module will be required, as opposed to the one per initialise or mutable
declaration we have now.

This change goes part of the way to fixing the bug with initialisers
in libraries not being run.  (The remainder of the fix is a separate change.)
This change also makes it simpler to ensure that the initialisers get executed
in the correct order.

Do the same thing for finalisers.

compiler/llds_out.m:
compiler/mlds_to_c.m:
	Make the above changes to the LLDS and MLDS backends respectively.
2006-05-12 08:32:07 +00:00
Julien Fischer
bba37bf4ac Update for version 0.3.1 of Mercury for g12.
tools/test_mercury:
	Update for version 0.3.1 of Mercury for g12.
2006-05-12 05:08:41 +00:00
Julien Fischer
2699c70f27 Conform to recent changes in the standard library.
Estimated hours taken: 0
Branches: main, release

tests/debugger/loopcheck.exp3:
	Conform to recent changes in the standard library.
2006-05-12 05:04:32 +00:00
Julien Fischer
cefc13f4bb Make it easier for vi to jump over the header comments.
Estimated hours taken: 0
Branches: main

compiler/compile_target_code.m:
	Make it easier for vi to jump over the header comments.
2006-05-12 04:32:03 +00:00
Nancy Mazur
db5d688c43 Provide the direct reuse analysis part of the structure reuse analysis (which
Estimated hours taken: 25
Branches: main

Provide the direct reuse analysis part of the structure reuse analysis (which
itself is part of the CTGC system).

compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
	Additional predicates.

compiler/ctgc.m:
	Add structure reuse module.

compiler/handle_options.m:
compiler/options.m:
	Add new options "structure_reuse_analysis" and related ones.

compiler/handle_options.m:
compiler/hlds_out.m:
	Add dump option "R" to dump structure reuse related information
	in the hlds_dump files.

compiler/hlds_goal.m:
	Types to record structure reuse information at the level of each
	goal.
	Additional "case_get_goal" function to extract the goal from an case.

compiler/mercury_compile.m:
	Add structure reuse analysis as a new compiler stage.

compiler/structure_reuse.analysis.m:
	The top level analysis predicates.

compiler/structure_reuse.m:
compiler/structure_reuse.direct.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
	Direct reuse analysis is split into 2 steps: determining when and how
	data structures become garbage, and then choosing how these dead
	data structures might best be reused.

compiler/structure_reuse.domain.m:
	The abstract domain for keeping track of reuse conditions, the main
	domain in the structure reuse analysis.

compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
	To determine whether data structures become dead or not, one needs to
	know which variables in a goal are needed with respect to forward
	execution (lfu = local forward use), and backward execution, i.e.
	backtracking (lbu = local backward use). These two modules provide
	the necessary functionality to pre-annotate the goals with lfu and
	lbu information.

compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
	Remove the structure sharing table from the interface of the analysis
	predicate in structure_sharing.analysis.m;
	Move predicates to structure_sharing.domain.m so that they become
	more easily accessible for the structure_reuse modules.

compiler/prog_data.m:
	New types "dead_var", "live_var" and alike.
2006-05-10 15:20:57 +00:00
Nancy Mazur
d3e5a8eda4 Provide the direct reuse analysis part of the structure reuse analysis (which
Estimated hours taken: 25
Branches: main

Provide the direct reuse analysis part of the structure reuse analysis (which
itself is part of the CTGC system).

compiler/ctgc.datastruct.m:
compiler/ctgc.util.m:
	Additional predicates.

compiler/ctgc.m:
	Add structure reuse module.

compiler/handle_options.m:
compiler/options.m:
	Add new options "structure_reuse_analysis" and related ones.

compiler/handle_options.m:
compiler/hlds_out.m:
	Add dump option "R" to dump structure reuse related information
	in the hlds_dump files.

compiler/hlds_goal.m:
	Types to record structure reuse information at the level of each
	goal.
	Additional "case_get_goal" function to extract the goal from an case.

compiler/mercury_compile.m:
	Add structure reuse analysis as a new compiler stage.

compiler/structure_reuse.analysis.m:
	The top level analysis predicates.

compiler/structure_reuse.direct.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.direct.detect_garbage.m:
	Direct reuse analysis is split into 2 steps: determining when and how
	data structures become garbage, and then choosing how these dead
	data structures might best be reused.

compiler/structure_reuse.domain.m:
	The abstract domain for keeping track of reuse conditions, the main
	domain in the structure reuse analysis.

compiler/structure_reuse.lbu.m:
compiler/structure_reuse.lfu.m:
	To determine whether data structures become dead or not, one needs to
	know which variables in a goal are needed with respect to forward
	execution (lfu = local forward use), and backward execution, i.e.
	backtracking (lbu = local backward use). These two modules provide
	the necessary functionality to pre-annotate the goals with lfu and
	lbu information.

compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
	Remove the structure sharing table from the interface of the analysis
	predicate in structure_sharing.analysis.m;
	Move predicates to structure_sharing.domain.m so that they become
	more easily accessible for the structure_reuse modules.

compiler/prog_data.m:
	New types "dead_var", "live_var" and alike.
2006-05-10 10:56:57 +00:00
Julien Fischer
e006ed939e Fix a bug reported by Jonathan Morgan.
library/rtti_implementation.m:
	s/NULL/null in some C# foreign code.
2006-05-09 05:04:50 +00:00
Julien Fischer
70751cc812 Conform to the change of the context of interface events.
Estimated hours taken: 0.1
Branches: main, release

tests/debugger/declarative/track_through_catch.exp:
	Conform to the change of the context of interface events.
2006-05-09 04:28:15 +00:00
Julien Fischer
a2dc8715cc Fix some failing debugger test cases. These were failing because the
Estimated hours taken: 1
Branches: main, release

Fix some failing debugger test cases.  These were failing because the
expected outputs did not conform to the changes in r1.155 of
compiler/code_gen.m (which shifted the context of interface events from
the context of the body goal to the context of the first clause).

debugger/interactive.exp:
debugger/declarative/backtrack.exp2:
debugger/declarative/ite_2.exp2:
debugger/declarative/neg_conj.exp2:
debugger/declarative/negation.exp2:
	Update expected outputs for these test cases.

debugger/declarative/backtrack.exp:
debugger/declarative/ite_2.exp:
	Main branch only: back out the bogus updates to these expected
	outputs.  They should correspond to the outputs for non-debug grades,
	not (decl-)debug grades.
2006-05-08 08:17:32 +00:00
Julien Fischer
d77a8ff8a3 Fix the interactive query mechanism in the debugger.
Estimated hours taken: 0.2
Branches: main

Fix the interactive query mechanism in the debugger.  It wasn't
working because the generated query programs did not import the
solutions module.

browser/interactive_query.m:
	Import the solutions module in the generated query program.

	Minor formatting fixes.
2006-05-08 07:28:52 +00:00
Zoltan Somogyi
afbec6110a This diff simplifies the way we handle compiler-generate data in LLDS grades.
Estimated hours taken: 2
Branches: main

This diff simplifies the way we handle compiler-generate data in LLDS grades.
We used to wrap several kinds of data structures up in different function
symbols so they could be treated as values of a single type, comp_gen_c_data,
but then we divided them up into the original caregories again when creating
the output .c file. We now instead keep the various kinds of static data
separate all the way through.

compiler/llds.m:
	Delete the comp_gen_c_data type. Replace the single list of
	comp_gen_c_data items in the representation of C files with four
	lists, one for each kind of static data.

compiler/llds_out.m:
	Make the simplifications made possible by the change to llds.m.

	Output references to MR_COMMON and MR_TAG_COMMON instead of MR_XCOMMON
	and MR_TAG_XCOMMON, since the change to make these equivalent should
	have been installed on all our machines by now.

compiler/code_info.m:
compiler/global_data.m:
compiler/stack_layout.m:
	Modify data structures to contain data of specific types instead
	comp_gen_c_datas, and modify the code accordingly. This mostly means
	avoiding now redundant operations to wrap data structures with
	comp_gen_c_data's function symbols.

compiler/mercury_compile.m:
	Build c_file structures with four lists of distinct types instead
	of appending them all to get a single giant list of comp_gen_c_datas.

compiler/transform_llds.m:
	Conform to the change to llds.m.

compiler/layout.m:
compiler/layout_out.m:
	Minor style improvements.
2006-05-08 03:36:02 +00:00
Peter Wang
c9b5c6dd05 Forgot to add par_saved_const test case to the makefile.
Estimated hours taken: 0
Branches: main, release

tests/valid/Mmakefile:
	Forgot to add par_saved_const test case to the makefile.
2006-05-07 23:08:15 +00:00
Julien Fischer
7dd5576f38 Fix a bug with profiling and the high-level C grades.
Estimated hours taken: 1
Branches: main, release

Fix a bug with profiling and the high-level C grades.  The problem was that we
were only emitting an INIT comment whenever there was a user initialisation or
finalisation predicate.  This is not noticeable in most of the hl* grades
since mercury__<modulename>__init is empty anyway.  However in the profiling
grades the init function is responsible for calling MR_init_entry for each
procedure.  Failing to do this causes unknown functions to show up in the
profile.  (This problem appears to have been introduced with r1.101 of
util/mkinit.c - prior to that, in the 0.12 release for example, init functions
in the hl* grades were handled differently.)

compiler/mlds_to_c.m:
	Always output the INIT comment for a module.
2006-05-05 08:02:56 +00:00
Julien Fischer
1f5a7858a7 Delete some left over Aditi stuff.
Estimated hours taken: 0.1
Branches: main, release

util/mkinit.c:
	Delete some left over Aditi stuff.
2006-05-05 07:49:29 +00:00
Peter Wang
d3ca8ee50d Fix a compiler abort when `--optimise-dups' detects some duplicate code
Estimated hours taken: 1.5
Branches: main, release

Fix a compiler abort when `--optimise-dups' detects some duplicate code
sequences in parallel conjunctions.

compiler/dupelim.m:
	Allow `most_specific_instr' to generalise two `fork',
	`init_sync_term', `join_and_continue' or `join_and_terminate'
	instructions if they take exactly the same arguments.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/par_dupelim.m:
	Add a test case.
2006-05-04 08:34:56 +00:00
Zoltan Somogyi
aa33d8f0a3 Add file I forgot to "cvs add".
Estimated hours taken: 0.1
Branches: main

compiler/proc_gen.m:
	Add file I forgot to "cvs add".
2006-05-03 07:45:19 +00:00
Zoltan Somogyi
4e6c603d30 Fix two bugs that caused test case failures in deep profiling grades.
Estimated hours taken: 3
Branches: main

compiler/lookup_switch.m:
	Fix two bugs that caused test case failures in deep profiling grades.

	One bug was that an acquired register wasn't being released before
	the creation of a resume point, which rebuilds the code generator state
	(and thus forgets about acquired registers).

	The other bug was that is_lookup_switch wasn't performing the actions
	generate_goal would have when processing goals. In particular, it
	wasn't invoking pre_goal_update and post_goal_update on disjunctions
	inside the switch.

compiler/lookup_util.m:
	Do not standardize goals by removing scopes from around other goals,
	because this could also remove the effects of the code generator
	annotations (e.g. liveness changes such as pre-births) on the scope
	goal.

compiler/simplify.m:
	Eliminate those redundant scopes if asked to do so. Since this is done
	before the code generator annotations are put on goals, this is safe.

compiler/code_gen.m:
compiler/proc_gen.m:
	Divide the old code_gen.m into two modules: the new code_gen.m
	concerned with generating code for goals, and the new module proc_gen.m
	concerned with generating code for procedures. Without this, the code
	for handling goals is lost inside the old code_gen.m module.

compiler/ll_backend.m:
	Include the new module.

compiler/mercury_compile.m:
	Import proc_gen instead of code_gen, and ask simplify to eliminate
	unnecessary scopes before code generation.

compiler/middle_rec.m:
	Update a reference to a predicate now in proc_gen.m.

compiler/notes/compiler_design.html:
	Document the new module.
2006-05-03 06:46:20 +00:00
Julien Fischer
1b081ef9cb Fix some formatting problems introduced by the conversion
library/exception.m:
	Fix some formatting problems introduced by the conversion
	to four-space indentation.
2006-05-02 10:16:18 +00:00
Julien Fischer
c9919289a4 Fix an omission in my last change.
doc/user_guide.texi:
	Fix an omission in my last change.
2006-05-02 09:09:04 +00:00
Julien Fischer
dccd1438c0 Make some minor formatting and style fixes.
Estimated hours taken: 0.1
Branches: main

compiler/module_qual.m:
compiler/prog_ctgc.m:
compiler/prog_data.m:
compiler/prog_item.m:
	Make some minor formatting and style fixes.

	Fix a couple of typos.
2006-05-02 08:15:34 +00:00
Julien Fischer
7018810347 Add --c-include-dir' as a synonym for --c-include-directory'.
Estimated hours taken: 0.1
Branches: main, release

compiler/options.m:
doc/user_guide.texi:
	Add `--c-include-dir' as a synonym for `--c-include-directory'.
2006-05-02 07:52:53 +00:00
Nancy Mazur
da2ecac742 Add structure_reuse pragma (prog_item.m) and related types (prog_data.m).
Estimated hours taken: 1
Branches: reuse

Add structure_reuse pragma (prog_item.m) and related types (prog_data.m).

compiler/prog_data.m:
	Add reuse_tuple and reuse_tuples as public representations for
	reuse conditions needed in the CTGC system.

compiler/prog_ctgc.m:
	Add parsing and printing routines for reuse_tuple(s).

compiler/prog_item.m:
compiler/add_pragma.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.version.m:
	Add pragma structure_reuse/7.
2006-05-02 05:57:10 +00:00
Julien Fischer
a6508191fc Make the IL backend compile successfully.
(This patch was submitted by Jon Morgan.)

Estimated hours taken: 0.5
Branches: main, release

Make the IL backend compile successfully.

library/private_builtin.m:
       Revert incorrect s/__/. in C# and Java foreign code.
library/rtti_implementation.m:
       s/NULL/null in C# foreign code.
2006-05-01 14:45:19 +00:00
Julien Fischer
26d6b6e331 Disable the .NET backend by default. This is to prevent the installation
Estimated hours taken: 0.1
Branches: main, release

Disable the .NET backend by default.  This is to prevent the installation
process breaking on Linux systems that have either DotGNU or Mono installed.

configure.in:
	Disable the .NET backend by default.

README.DotNET:
	Mention that configure must be invoked with `--enable-dotnet-grades'
	option in order to enable .NET support.
2006-05-01 06:00:45 +00:00
Julien Fischer
41ddbbd9f9 Fix some typos.
Estimated hours taken: 0
Branches: main

compiler/polymorphism.m:
	Fix some typos.
2006-04-30 04:37:04 +00:00
Peter Wang
2bd4e6d2bf The saved_vars pass was not pushing unifications that assign
Estimated hours taken: 1.5
Branches: main, release

compiler/saved_vars.m:
	The saved_vars pass was not pushing unifications that assign
	constants to variables into parallel conjunctions.  Since the
	original unification would be deleted, the parallel conjunction
	would be left referring to an unbound variable.

tests/valid/Mercury.options:
tests/valid/par_saved_const.m:
	Add a test case.
2006-04-28 04:13:24 +00:00
Zoltan Somogyi
8064833716 Add a couple of modes to map_foldl2.
Estimated hours taken: 0.1
Branches: main

library/map.m:
library/tree234.m:
	Add a couple of modes to map_foldl2.
2006-04-28 02:48:00 +00:00
Julien Fischer
49f4994356 Update the version of libc on jupiter.
Estimated hours taken: 0
Branches: main

tools/test_mercury:
	Update the version of libc on jupiter.
2006-04-27 08:14:43 +00:00
Zoltan Somogyi
c3b1c2003e Support constant "mutables". Though this sounds like a contradiction in terms,
Estimated hours taken: 3
Branches: main

Support constant "mutables". Though this sounds like a contradiction in terms,
they can be useful, because in some cases they are the best alternative.

- For some types, e.g. arrays, there is no way to write manifest constants.

- For some other types, one can write manifest constants, but the compiler
  may be too slow in compiling clauses containing them if the constant is
  very large (even after my recent improvements).

- Using a tabled zero-arity function incurs overhead on every access to check
  whether the result was recorded previously or not. This is a bad idea e.g.
  in the inner loop of a scanner (which may want to use an array for the
  representation of the DFA).

compiler/prog_item.m:
	Add a new attribute to say whether the mutable is constant or not.

compiler/prog_io.m:
	Recognize the "constant" mutable attribute.

compiler/prog_mutable.m:
	Provide predicates to construct the signatures of the get and set
	predicates of constant mutables. Rename some existing predicates
	to better reflect their purpose.

compiler/make_hlds_passes.m:
compiler/modules.m:
	Modify the code for creating mutables' get, set and init predicates
	to do the right thing for constant mutables.

doc/reference_manual.texi:
	Document the new attribute.

tests/hard_coded/pure_mutable.{m,exp}:
	Test the new attribute.
2006-04-27 07:34:37 +00:00
Julien Fischer
78abd839bc Fix the scripts that build and install the binary packages for Linux.
Estimated hours taken: 1
Branches: main, release

Fix the scripts that build and install the binary packages for Linux.  These
have been broken since the change that moved the executables, mercury_compile,
mercury_profile etc, into $(INSTALL_PREFIX)/bin.

bindist/Mmakefile:
	Tar up the bin directory of the installation we are building
	the binary package from since it now contains the executables.

	Conform to the current structure of the library installation
	hierarchy.

bindist/bindist.Mmakefile.in:
	Conform to the above changes when installing.
2006-04-26 05:43:41 +00:00
Zoltan Somogyi
06d998b738 Add file I forgot to "cvs add".
Estimated hours taken: 0.1
Branches: main

compiler/lookup_util.m:
	Add file I forgot to "cvs add".
2006-04-26 04:36:46 +00:00
Zoltan Somogyi
d5d5986472 Implement lookup switches in which a switch arm may contain more than one
Estimated hours taken: 40
Branches: main

Implement lookup switches in which a switch arm may contain more than one
solution, such as this code here:

	p(d, "four", f1, 4.4).
	p(e, "five", f2, 5.5).
	p(e, "five2", f3(5), 55.5).
	p(f, "six", f4("hex"), 6.6).
	p(g, "seven", f5(77.7), 7.7).
	p(g, "seven2", f1, 777.7).
	p(g, "seven3", f2, 7777.7).

Such code occurs frequently in benchmark programs used to evaluate the
performance of tabled logic programming systems.

Change frameopt.m, which previously worked only on det and semidet code,
to also work for nondet code. For predicates such as the one above, frameopt
can now arrange for the predicate's nondet stack frame to be created only
when a switch arm that has more than one solution is selected.

compiler/lookup_switch.m:
	Extend the existing code for recognizing and implementing lookup
	switches to recognize and implement them even if they are model_non.

compiler/lookup_util.m:
	New module containing utility predicates useful for implementing
	both lookup switches, and in the future, lookup disjunctions (i.e.
	disjunctions that correspond to a nondet arm of a lookup switch).

compiler/ll_backend.m:
	Include the new module.

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

compiler/global_data.m:
	Move the job of filling in dummy slots to our caller, in this case
	lookup_switch.m.

compiler/frameopt.m:
	Generalize the existing code for delaying stack frame creation,
	which worked only on predicates that live on the det stack, to work
	also on predicates that live on the nondet stack. Without this,
	predicates whose bodies are model_non lookup switches would create
	a nonstack stack frame before the switch is ever entered, which
	is wasteful if the selected switch arm has at most one solution.

	Since the structure of model_non predicates is more complex (you can
	cause a branch to a label by storing its address in a redoip slot,
	you can succeed from the frame without removing the frame), this
	required considerable extra work. To make the new code debuggable,
	record, for each basic block that needs a stack frame, *why* it
	needs that stack frame.

compiler/opt_util.m:
	Be more conservative about what refers to the stack. Export some
	previously internal functionality for frameopt. Turn some predicates
	into functions, and rename them to better reflect their purpose.

compiler/opt_debug.m:
	Print much more information about pragma_c and call LLDS instructions.

compiler/prog_data.m:
	Add an extra attribute to foreign_procs that says that the code
	of the foreign_proc assumes the existence of a stack frame.
	This is needed to avoid frameopt optimizing the stack frame away.

compiler/add_pragma.m:
	When processing fact tables, we create foreign_procs that assume
	the existence of the stack frame, so set the new attribute.

compiler/pragma_c_gen.m:
	When processing foreign_procs, transmit the information in the
	attribute to the generated LLDS code.

compiler/llds.m:
	Rename the function symbols referring to the fixed slots in nondet
	stack frames to make them clearer and to avoid overloading function
	symbols such as curfr and succip.

	Rename the function symbols of the call_model type to avoid overloading
	the function symbols of the code_model type.

	Add a new field to the c_procedure type giving the code_model of the
	procedure, and give names to all the fields.

	Describe the stack slots used by lookup switches to the debugger
	and native gc.

compiler/options.m:
doc/user_guide.texi:
	Add a new option, --debug-opt-pred-name, that does when the existing
	--debug-opt-pred-id options does, but taking a user-friendly predicate
	name rather than a pred_id as its argument.

compiler/handle_options.m:
	Process --debug-opt-pred-name, and make --frameopt-comments imply
	--auto-comments, since it is not useful without it.

	Reformat some existing comments that were written in the days of
	8-space indentation.

compiler/optimize.m:
	Implement the new option.

	Use the new field of the c_procedure type to try only the version
	of frameopt appropriate for the code model of the current procedure.

	Do a peephole pass after frameopt, since frameopt can generate code
	sequences that peephole can optimize.

	Make the mechanism for recording the process of optimizing procedure
	bodies more easily usable by including the name of the optimization
	that created a given version of the code in the name of the file
	that contains that version of the code, and ensuring that all numbers
	are two characters long, so that "vi procname*.opt*" looks at the
	relevant files in the proper chronological sequence, instead of having
	version 11 appear before version 2.

compiler/peephole.m:
	Add a new optimization pattern: a "mkframe, goto fail" pair (which
	can be generated by frameopt) should be replaced by a simple "goto
	redo".

compiler/code_gen.m:
	Factor out some common code.

compiler/llds_out.m:
	Ensure that C comments nested inside comment(_) LLDS instructions
	aren't emitted as nested C comments, since C compilers cannot handle
	these.

compiler/code_info.m:
compiler/code_util.m:
compiler/continuation_info.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
compiler/middle_rec.m:
compiler/ml_code_gen.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/peephole.m:
compiler/stack_layout.m:
compiler/transform_llds.m:
compiler/var_locn.m:
	Conform to the change to prog_data.m, opt_util.m and/or llds.m.

compiler/handle_options.m:
	Don't execute the code in stdlabel.m if doing so would cause a compiler
	abort.

tests/hard_coded/dense_lookup_switch_non.{m,exp}:
	New test case to exercise the new algorithm.

tests/hard_coded/Mmakefile:
	Enable the new test case.

tests/hard_coded/cycles.m:
	Make this test case conform to our coding convention.
2006-04-26 03:06:29 +00:00
Zoltan Somogyi
e1e9523b31 Fix a typo in the spelling of an error message.
Estimated hours taken: 0.1
Branches: main, release

compiler/state_var.m:
test/warnings/state_vars_test.exp:
	Fix a typo in the spelling of an error message.
2006-04-24 09:36:26 +00:00
Zoltan Somogyi
ad342157cc Provide MR_COMMON as a synonym for MR_XCOMMON, to allow a future
Estimated hours taken: 0.1
Branches: main, release

runtime/mercury_misc.h:
	Provide MR_COMMON as a synonym for MR_XCOMMON, to allow a future
	version of the compiler to generate the former instead of the latter.
2006-04-24 04:38:41 +00:00
Zoltan Somogyi
4917e938d8 Fix a bug that was preventing the compiler from bootstrapping
Estimated hours taken: 2
Branches: main, release

compiler/lco.m:
	Fix a bug that was preventing the compiler from bootstrapping
	with --optimize-constructor-last-call. The bug was that while
	the lco transformation was properly marking as impure the goals
	that store results at the addresses provided by the caller,
	it was not so marking the goals containing them, allowing simplify
	to optimize them away.
2006-04-24 04:23:47 +00:00
Zoltan Somogyi
0625a15744 Delete the option for testing the split library, since we don't support
Estimated hours taken: 0.1
Branches: main

tools/bootcheck:
	Delete the option for testing the split library, since we don't support
	--split-c-files anymore.
2006-04-24 04:20:39 +00:00
Peter Wang
6768c3921f Correct the declaraction of MGLU_quadric_error_callback()
Estimated hours taken: 0.1
Branches: main, release

extras/graphics/mercury_opengl/mglu.m:
	Correct the declaraction of MGLU_quadric_error_callback()
	from `static' to `extern'.
2006-04-23 02:20:27 +00:00
Julien Fischer
2e226e3daf Cleanups and minor fixes for the mtcltk calculator example.
Estimated hours taken: 0.3
Branches: main, release

Cleanups and minor fixes for the mtcltk calculator example.

extras/graphics/samples/calc/calc.m:
	Conform to recent changes in the standard library.

	Convert to 4-space indentation.

	Use state variables for threading the I/O state.

	Other formatting and style fixes.
2006-04-21 05:45:47 +00:00
Julien Fischer
8ce45f94c8 Fix a problem reported by Keri Harris.
Estimated hours taken: 0
Branches: main, release

Fix a problem reported by Keri Harris.

extras/graphics/mercury_tcltk/mtcltk.m:
	Avoid the use of cast expressions as lvalues.
2006-04-21 05:24:29 +00:00
Julien Fischer
f0d430aa63 Fix some typos in my last change.
extras/references/tests/glob_test.m:
	Fix some typos in my last change.
2006-04-21 05:04:04 +00:00
Julien Fischer
e001ac930a Fixes and cleanups for extras/references.
Estimated hours taken: 0.2
Branches: main, release

Fixes and cleanups for extras/references.

extras/references/Mmakefile:
	Don't emit warnings about the module global not exporting anything.

extras/references/global.m:
	Add a missing interface declaration and reformat the list of
	module imports.

extras/references/tests/ref_test.m:
extras/references/tests/glob_test.m:
extras/references/tests/glob_test_2.m:
	Add missing `MR_' prefixes.

	Use the new foreign language interface.

	Add missing character escapes.
2006-04-21 04:56:53 +00:00
Julien Fischer
9484fc521b Fix a typo: s/moduleis reposible/module is reponsible/
Estimated hours taken: 0
Branches: main, release

extras/windows_installer_generator/wix_installer.m:
	Fix a typo: s/moduleis reposible/module is reponsible/
2006-04-21 04:18:53 +00:00
Julien Fischer
34cc756c73 Fix compilation of extras/trailed_update.
Estimated hours taken: 0.1
Branches: main, release

Fix compilation of extras/trailed_update.

extras/trailed_update/var.m:
	Add missing promise_pure scopes.

extras/trailed_update/samples/interpreter.m:
	Conform to recent changes in the standard library.
2006-04-21 04:12:21 +00:00
Julien Fischer
beb5c107a8 Import solutions rather than std_util.
Estimated hours taken: 0
Branches: main, release

extras/moose/check.m:
	Import solutions rather than std_util.
2006-04-21 04:03:21 +00:00
Julien Fischer
2c41d3bba1 Cleanups for extras/curs.
Estimated hours taken: 1
Branches: main, release

Cleanups for extras/curs.

extras/curs/samples/Mmakefile:
	Build all the demos in this directory.

extras/curs/curs.m:
	Define the type `panel' as a foreign type.  Remove casts from the C
	code that are now redundant because of this.

	Convert to four-space indentation.

extras/curs/curs.m:
extras/curs/samples/*.m:
	Fix overlong lines.

	s/io__state/io/

	Use state variables for passing around the I/O state.

	Format foreign_procs as per our coding standard.
2006-04-21 03:37:11 +00:00
Peter Wang
6e27cee1f3 This patch enables the thread-local memory allocation feature of Boehm GC in
Estimated hours taken: 4
Branches: main

This patch enables the thread-local memory allocation feature of Boehm GC in
parallel grades on Linux hosts; without it, performance is terrible.  It may
work on other operating systems using pthreads, but I haven't tested.

Mmake.common.in:
configure.in:
boehm_gc/Makefile:
	Build Boehm GC with the THREAD_LOCAL_ALLOC preprocessor symbol in
	parallel grades on Linux.

	Add -DGC_REDIRECT_TO_LOCAL to CFLAGS_FOR_THREADS to redirect
	calls to GC_malloc() to GC_local_malloc().

runtime/mercury_memory.c:
	Work around a bug in the garbage collector when using thread-local
	allocation.  Hans Boehm says, "A size zero GC_local_malloc allocation
	currently just returns a fixed address outside the real heap."
	This leads to a crash when we later try to GC_free() the address.
2006-04-21 01:04:47 +00:00