Commit Graph

34 Commits

Author SHA1 Message Date
Fergus Henderson
5fe0f4f82c A bunch of changes required to fix problems in code generation for
Estimated hours taken: 24

A bunch of changes required to fix problems in code generation for
model_det and model_semi disjunctions.

simplify.m:
	Don't convert all model_det and model_semi disjunctions into
	if-then-elses, because that doesn't work if the disjuncts
	have output variables, which can happen (e.g. with cc_nondet
	disjunctions)

disj_gen.m:
	Fix a bug in the code generation for semidet disjunctions:
	don't forget to jump to the end of the disjunction after
	each disjunct!

liveness.m, live_vars.m, store_alloc.m, disj_gen.m:
	Treat backtracking in model_det and model_semi disjunctions
	as shallow backtracking rather than deep backtracking.
	This means that rather than pushing all live variables
	onto the stack at the start of a model_det/semi disjunction,
	and using the nondet_lives to keep track of them, we instead
	treat these disjunctions a bit more like an if-then-else and
	use the ordinary liveness/deadness to keep track of them.

code_aux.m:
	Change code_aux__pre_goal_update so that it only applies
	the post-deaths if the goal is atomic.  Applying the
	*post*-deaths to the set of live variables in the *pre*-goal
	update only makes sense for atomic goals.
	(I think previously we only ever generated post-deaths
	for atomic goals, but now we generate them also for
	goals inside model_det or model_semi disjunctions.)

code_gen.pp, middle_rec.m:
	Pass an is-atomic flag to code_aux__pre_goal_update.

hlds_goal.m:
	Add some comments.

goal_util.m:
	Fix bugs in goal_util__name_apart_goalinfo.
	It wasn't applying the substitution to all the
	appropriate fields.

code_exprn.m:
	Improve the error message for one of the internal errors.

hlds_out.m:
	Print the stack slot allocations in the HLDS dump again.
1996-10-29 20:10:17 +00:00
Andrew Bromage
5c149e55b2 Mode analyser reorganisation.
Estimated hours taken: 20

Mode analyser reorganisation.

compiler/mode_util.m:
	Removed: instmap_init/1,  apply_instmap_delta/3, instmap_lookup_var/3,
	instmapping_lookup_var/3, instmap_restrict/3, map_restrict/3 (all
	moved to instmap.m).

compiler/hlds_goal.m:
	Removed the declarations of instmap_delta, instmap and instmapping.

compiler/mode_errors.m:
	Added report_mode_errors/2 (was modecheck_report_errors, from
	modes.m).

compiler/modes.m:
	Predicates now exported:
		modecheck_goal/4
		modecheck_goal_expr/5 (previously named modecheck_goal_2/5)
		handle_extra_goals/8
		mode_context_to_unify_context/3

	Moved to mode_errors.m:
		modecheck_report_errors/2

	Moved to instmap.m:
		compute_instmap_delta/4
		instmap_merge/3
		instmap_lookup_vars (was instmap_lookup_arg_list/3)
		compute_instmap_delta/4

	Moved to mode_debug.m:
		Type port/0
		mode_checkpoint/4

	Moved to modecheck_call.m:
		modecheck_call_pred/7
		modecheck_higher_order_call/10
		modecheck_higher_order_pred_call/4
		modecheck_higher_order_func_call/7

	Moved to modecheck_unify.m:
		modecheck_unification/9
		categorize_unify_var_var/12
		categorize_unify_var_functor/11
		categorize_unify_var_lambda/9

	Moved to mode_info.m:
		mode_info_error/4
		mode_info_add_error/3

compiler/code_gen.pp, compiler/code_info.m, compiler/constraint.m,
compiler/cse_detection.m, compiler/det_analysis.m, compiler/det_util.m,
compiler/dnf.m, compiler/goal_util.m, compiler/higher_order.m,
compiler/hlds_out.m, compiler/hlds_pred.m, compiler/live_vars.m,
compiler/liveness.m, compiler/lookup_switch.m, compiler/polymorphism.m,
compiler/simplify.m, compiler/store_alloc.m, compiler/switch_detection.m,
compiler/transform.m, compiler/unused_args.m:
	Imported instmap.m

New files:

compiler/instmap.m:
	Handle operations associated with instmaps.

compiler/modecheck_unify.m:
	Handle mode checking of unifications.

compiler/modecheck_call.m:
	Handle mode checking of calls

compiler/mode_debug.m:
        Code to trace the actions of the mode checker.
1996-10-17 05:28:01 +00:00
Zoltan Somogyi
a15c032df7 Flesh out the code already here for traversing module_infos,
Estimated hours taken: 4

passes_aux:
	Flesh out the code already here for traversing module_infos,
	making it suitable to handle all the passes of the back end.

mercury_compile:
	Use the traversal code in passes_aux to invoke the back end passes
	over each procvedure in turn. Print a one-line message for each
	predicate if -v is given (this fixes a long-standing bug).

excess.m, follow_code.m, follow_vars.m, live_vars.m, lveness.m, store_alloc.m:
	Remove the code to traverse module_infos, since it is now unnecessary.

export.m:
	Remove an unused argument from export__produce_header_file_2.

others:
	Move imports from interfaces to implementations, or in some cases
	remove them altogether.
1996-08-03 12:06:26 +00:00
Fergus Henderson
0e1e0b0b91 Implement recursive' and non_recursive' pragma c_code declarations.
Estimated hours taken: 4

Implement `recursive' and `non_recursive' pragma c_code declarations.
This allows the compiler to optimize cases when the C code
is known to not call Mercury code.  It's also necessary
to allow C code which modifies the hp register to work
(such code must be declared `non_recursive', otherwise
the registers will be saved and restored over it).
To make things bootstrap OK, the old pragma c_code declarations
default to `non_recursive'.

prog_data.m, hlds_goal.m:
	Add new field c_is_recursive to pragma c_code goals.

prog_io.m:
	Parse the new `recursive' and `non_recursive' pragma c_code
	declarations.

make_hlds.m:
	Pass the c_is_recursive field from the parse tree to the HLDS.

live_vars.m:
	For non-recursive C code, don't save variables on the stack.

code_gen.pp:
	For non-recursive C code, don't save variables on the stack,
	don't mark the succip as needing to be saved, and don't
	call save_registers() and restore_registers().

*.m:
	Change c_code/5 to c_code/6.
1996-06-10 17:18:50 +00:00
Thomas Conway
af15674b0e set union and intersection are more efficient in some
Estimated hours taken: 0.2

set union and intersection are more efficient in some
implementations if you give the arguments in a particular order.
Our convention is big set first, small set second. These
changes just swap the order of the arguments in a few places.

compiler/modes.m,store_alloc.m:
	change the order of the arguments in a couple of calls
	to set__intersect and set__union.
1996-05-18 04:52:45 +00:00
Zoltan Somogyi
140ff7c9ff These now compile without errors. No other promises are made :-)
Estimated hours taken: 5

bytecode*.m:
	These now compile without errors. No other promises are made :-)

options:
	Adda new option, --generate-bytecode.

mercury_compile:
	Generate bytecode if the option is set.

goal_util:
	Add a predicate to find all the variables in a goal, even the ones
	that have been quantified. Used by the bytecode generator.

call_gen:
	Add a predicate and export another for use by the bytecode generator.

hlds_module:
	Add a predicate to look up full naming details on a PredId.
	Used by the bytecode generator.

hlds_pred:
	Remove the follow_vars field from proc_infos, since it is not needed
	any more.

hlds_goal:
	Remove the store_map field from goal_infos, since it is not needed
	any more.

code_gen, code_info, follow_vars, goal_util, hlds_out, middle_rec, store_alloc:
	Accommodate the changes in hlds_goal and hlds_pred

vn_block:
	Fix an oversight in my previous change.
1996-05-14 02:56:50 +00:00
Zoltan Somogyi
89644bebb2 Fixed a bug that caused restores of succip to be put in the wrong
Estimated hours taken: 5

peephole:
	Fixed a bug that caused restores of succip to be put in the wrong
	place, but only after predicate-wide value numbering.

opt_debug:
	Added a couple of debugging predicates used in tracking down this bug.

value_number:
	Fix a bug that left a livevals pseudo-op in the wrong place if a
	single instruction sequence contained more than one such pseudo-op.

options:
	Add --debug-opt. Rename --vndebug to --debug-vn.
	Add --generate-bytecode.

optimize, vn_debug:
	Use the new routines in opt_debug, and use the new/renamed options.

store_alloc:
	Don't thread follow_vars through the module, since the follow_vars
	information is not attached directly to branched structures. We
	now also use the same slot to hold the store map computed by this
	pass; this should allow the later deletion of the store map slot
	from goal_infos.

follow_code:
	Removed dead predicate.

livemap:
	Added a comment.
1996-05-12 04:51:14 +00:00
Zoltan Somogyi
99e729814f Make sure we don't change the goal being analyzed except possibly
Estimated hours taken: 20

det_analysis:
	Make sure we don't change the goal being analyzed except possibly
	for the introduction of `some's (which should not hurt anything).

	Make sure we don't print any error messages except in the final
	iteration, when all the inputs to the inference are stable.

	If the --debug-detism options is set, print messages about the
	progress of inference and checking.

	Also moved some code around.

det_report:
	Distinguish the handling of warning messages and error messages.

simplify:
	Use the new ability of det_report to separate warnings and errors.

passes_aux:
	Add a new generic pass form, for use by simplify.

option:
	Add --debug-detism (as above), --aditi, which at the moment
	only enables the disjunctive normal form transformation, and
	--inlining/--no-inlining, which set the other three flags
	involved in inlining depending on whether you want standard
	inlining or none at all.

	Follow_code used to be set twice and follow_vars not at all;
	I fixed this.

	Reenabled optimize_higher_order at -O3.

	Moved value numbering to -O4 and pred_value_number to -O5.
	This makes it easier to separate value numbering from the
	other optimizations (which are likely to be more effective).

	Divided options_help into sections to avoid excessive
	compilation times.

store_alloc:
	Base the store map on the follow_vars info attached to the
	branched structure which I added recently, and not on the
	follow_vars map being passed around, since it will be more accurate.

hlds_out:
	Print information about follow_vars and store_maps when -D is given.

follow_code:
	Undo an old hack that change to follow_vars has made counterproductive.

middle_rec:
	Fix a bug uncovered by the change to follow_code. When looking for a
	register to hold the counter, it is not enough to avoid picking a
	register that appears in the recursive case; we must also avoid
	registers that occur only in the base case.

livemap:
	Mentioning the code address succip now causes the succip to be
	considered live. This may or may not fix the bug with pred_value_number
	miscompiling unused_args.m; the other changes have caused the input
	to value numbering to change, and they no longer trigger the problem.
	(Will try to test this later.)

mercury_compile:
	Try to make sure that we print statistics only after passes that
	were actually executed. Also, reduce the number of lookups of the
	verbose option. Move some predicates so that the order of their
	appearance matches the current order of invocation.

vn_table:
	Loosen a sanity check to let xnuc2 pass through it.

code_exprn, switch_detection:
	Minor changes.
1996-05-10 09:49:17 +00:00
Fergus Henderson
9a7da88ce0 Treat higher-order predicate calls as a new sort of goal,
Estimated hours taken: 24

Treat higher-order predicate calls as a new sort of goal,
rather than as calls to the special predicate call/N, in order to
remove the fixed limit on the number of arguments and on the modes
for call/N.

Also, remove the restriction on output arguments preceding input arguments
in lambda expressions.

hlds_goal.m:
	Add new functor higher_order_call/6 to the hlds__goal type.

*.m:
	Handle new functor higher_order_call/6.

arg_info.m:
	Abstract things a bit more: the argument passing convention
	for a procedure may be affected by that procedure's types,
	modes, and code_model, as well as the arg_method.

follow_vars.m:
	Pass down the args_method, since it is now needed for figuring
	out the arg_info for unifications and higher-order calls.

follow_code.m:
	Treat complicated unifications in the same way as calls.

lambda.m:
	When creating lambda predicates, permute the arguments so
	that all input arguments come before all output arguments.

call_gen.m:
	When generating higher-order predicate calls, don't abort
	if outputs precede inputs; instead, generate code assuming
	that the called predicate's args have been permuted so that
	the inputs to come before all the outputs.
1996-05-02 22:44:50 +00:00
Zoltan Somogyi
d344165793 Add a new option, --branch-delay-slot, intended for use by mc on
Estimated hours taken: 3

options:
	Add a new option, --branch-delay-slot, intended for use by mc on
	the basis of the configuattion script. It says whether the machine
	architecture has delays slots on branches.

	The setting of option should affect whether we set
	--optimize-delay-slots at -O2, but this doesn't work yet.

hlds_goal:
	Add an extra field to hold follow_vars infromation to disjunctions,
	switches and if-then-elses. I intend to use this information to
	generate better code.

*.m:
	Changes to accommodate the extra field.
1996-04-20 08:37:36 +00:00
Zoltan Somogyi
2833bfffb7 Divided the old hlds.m into four files:
Estimated hours taken: 10

hlds, hlds_module, hlds_pred, hlds_goal, hlds_data:
	Divided the old hlds.m into four files:

	hlds_module.m defines the data structures that deal with issues
	that are wider than a single predicate. These data structures are
	the module_info structure, dependency_info, the predicate table
	and the shape table.

	hlds_pred.m defined pred_info and proc_info, pred_id and proc_id.

	hlds_goal.m defines hlds__goal, hlds__goal_{expr,info}, and the
	other parts of goal structures.

	hlsd_data.m defines the HLDS types that deal with issues related
	to data and its representation: function symbols, types, insts, modes.
	It also defines the types related to determinism.

	hlds.m is now an empty module. I have not removed it from CVS
	because we may need the name hlds.m again, and CVS does not like
	the reuse of a name once removed.

other modules:
	Import the necessary part of hlds.

det_analysis:
	Define a type that was up to now improperly defined in hlds.m.

prog_io:
	Move the definition of type determinism to hlds_data. This decision
	may need to be revisited when prog_io is broken up.

dnf, lambda:
	Simplify the task of defining predicates.

llds:
	Fix some comments.

mercury_compile:
	If the option -d all is given, dump all HLDS stages.

shape, unused_args:
	Fix formatting.
1996-04-02 12:12:24 +00:00
Thomas Conway
3d21a0fa2a Fixed a bug in the last change - we were incorrectly storing
Estimated hours taken: 0.1

compiler/store_alloc.m:
	Fixed a bug in the last change - we were incorrectly storing
	stuff in the goal_info_cont_lives, clobbering the correct value
	that was already there.
1996-01-16 05:08:36 +00:00
Thomas Conway
440877adb3 removed an argument from store_alloc_in_goal_2 which was
Estimated hours taken: 0.2

compiler/store_alloc.m:
	removed an argument from store_alloc_in_goal_2 which was
	effectively unused (it always output `no'), and adjusted
	the caller appropriately.
1996-01-16 03:10:02 +00:00
Thomas Conway
64e07ae112 There was a problem where variables that die during forward
Estimated hours taken: 5

There was a problem where variables that die during forward
execution, and then become live again on backtracking were
not being handled correctly. There was some half-working code
to deal with the problem. It has now been fixed, and there
are some new test cases for the regression tests.

compiler/.cvsignore:
	added *.ql since they become very irritating after a while...

compiler/inlining.m:
	added a couple of comments
	make a bit of the code more concise.

compiler/*.m:
	changes to handle nondet-liveness correctly.
1996-01-04 01:56:10 +00:00
Zoltan Somogyi
3224e94532 A new pass to remove unnecessary assignment unifications.
excess:
	A new pass to remove unnecessary assignment unifications.

mercury_compile:
	Call the new excess assignment module.

options:
	Add a new option, excess_assign, to control the new optimization.
	Add another, num-real-regs, to specify how many of r1, r2 etc are
	actually real registers. The default is now set to 5 for kryten;
	later it should be supplied by the mc script, with a value determined
	at configuration time.

tag_switch:
	Use num-real-regs to figure out whether it is likely to be worthwhile
	to eliminate the common subexpression of taking the primary tag of
	a variable. Also fix an old performance bug: the test for when a
	jump table is worthwhile was reversed.

value_number, vn_block:
	Do value numbering on extended basic blocks, not basic blocks.

vn_debug:
	Modify an information message.

labelopt:
	Clean up an export an internal predicate for value numbering. Replace
	bintree_set with set.

middle_rec:
	Prepare for the generalization of middle recursion optimization
	to include predicates with an if-then-else structure.

cse_detection:
	Fix a bug: when hoisting a common desconstruction X = f(Yi), create
	new variables for the Yi. This avoids problems with any of the Yis
	appearing in other branches of the code.

goal_util:
	Add a new predicate for use by cse_detection.

common:
	Fix a bug: recompute instmap deltas, since they may be affected by the
	optimization of common structures.

code_info:
	Make an error message more explicit.

det_analysis:
	Restrict import list to the needed modules.

*.m:
	Import assoc_list.
1995-10-27 09:39:28 +00:00
David Jeffery
f75693e80a The C interface.
The changes made allow declarations of the form:

:- pragma(c_code, predname(Varname1::mode1, Varname2::mode2, ...),
	"Some C code to execute instead of a mercury clause;").

There are still a couple of minor problems to be fixed in the near future:
If there is a regular clause given as well as a pragma(c_code, ...) dec, it
is not handled well, and variables names '_' are not handled well.

prog_io.m:
	parse the pragma(c_code, ...) dec.
hlds.m:
	define a new hlds__goal_expr 'pragma_c_code'.
make_hlds.m:
	insert the pragma(c_code, ...) dec. as a pragma_c_code into the hlds.
det_analysis.m:
	infer that pragma_c_code goals are det.
modes.m:
	convince the mode checker that the correct pragma variables are bound
	etc.
quantification.m:
	quantify the variables in the pragma(c_code, ...) dec.
code_gen.pp:
	convert pragma_c_code into pragma_c (in the llds).
llds.m:
	define a new instr, pragma_c. Output the pragma_c
hlds_out.m:
mercury_to_mercury.m:
mercury_to_goedel.m:
	spit out pragma(c_code, ...) decs properly

*.m: 	handle the new pragma_c_code in the hlds or the new pragma_c in the llds
1995-10-17 11:13:13 +00:00
Fergus Henderson
ce9a5cf7d5 Optimize away unifications with dead variables.
modes.m:
	Optimize away unifications with dead variables.
	(The code generator already does that, but by
	that time we have already allocated unnecessary
	stack slots for them.)

code_exprn.m:
	Avoid generating sequences such as `r2 = r3; r3 = r2;'
	when a register already contains the correct value.
	(This change was in fact at least as much Tom's work as mine.)

store_alloc.m:
	For disjunctions, we only want to allocate registers
	for the variables that are output by the disjunction.
	The inputs should go in framevars, not in registers.
	This avoids much of the register-shuffling
	in the code generated for e.g. list__member(out, in).
	(This change was in fact at least as much Tom's work as mine.)
1995-09-06 11:42:11 +00:00
Fergus Henderson
b87de68334 Implement unique modes. We do not handle local aliasing yet, so this
-------------------------------------------------------

Implement unique modes.  We do not handle local aliasing yet, so this
is still not very useful, except for io__state.  Destructive update is
not yet implemented.  Also note that this really only implements
"mostly unique" variables that may be non-unique on backtracking - we
don't check that you don't backtrack over I/O, for example.

prog_io.m, mode_util.m, modes.m, inst_match.m:
	Major changes to Handle unique modes.

mercury_to_mercury.m, polymorphism.m, prog_out.m, undef_modes.m:
	Use `ground(Uniqueness)' rather than just `ground'.

compiler/*.m:
	Fix compile errors now that unique modes are enforced: add a
	few calls to copy/2, and comment out lots of unique mode
	declarations that caused problems.

typecheck.m, mode_info.m:
	Hack around the use of unique modes, which doesn't work
	because we don't allow local aliasing yet: make the insts
	`uniq_type_info' and `uniq_mode_info' not unique at all,
	and add a call to copy/2 when extracting the io_state from
	type_info or mode_info.

-------------------------------------------------------

Plus a couple of unrelated changes:

hlds.m:
	Change the modes for the special predicates from `ground -> ground'
	to `in', so that any error messages that show those modes
	come out looking nicer.

	Add a new shared_inst_table for shared versions of user-defined
	insts.

mercury_to_goedel.m:
	Use string__is_alnum_or_underscore.
1995-08-02 07:53:53 +00:00
Thomas Conway
d8206b00ff fix occurences of A.B (use [A|B]) which were
mercury_compile.pp llds.m:
		fix occurences of A.B (use [A|B]) which were
		causing problems trying to build a sicstus
		compiler.

[the rest].m:
		Fix the compiler so that calculator.m works.
		This involved introducing an extra field into
		the goal_info to keep track of variables that
		become nondet-live.
1995-08-02 03:55:42 +00:00
Zoltan Somogyi
b905b2f4d8 Added an extra argument to call, which contains a maybe of the unification
context of the unification from which call was made. We we use this to generate
significantly better error messages. (There should be no more messages of the
form "call to __Unify__(blah blah blah) can fail".) Most of the files are
changed just to reflect this.

An unrelated change in det_analysis is that we now ensure the absence of
cycles by modifying the new inferred determinism in the light of the old
one, ensuring that any changes are monotonic.

In hlds_out, inhibit the printing of pseudo-imported predicates (unifications)
since nobody cares about them except sometimes Fergus.
1995-07-31 08:35:41 +00:00
Fergus Henderson
36878440a1 This batch of changes implements complicated modes of complicated
unifications.  See the comments at the top of unify_proc.m for
details of how it's done.

hlds.m:
	Add new export statuses `pseudo_imported' and `pseudo_exported'
	to handle unification predicates, which can now have complicated
	modes.

code_gen.pp, code_info.m, common.m, constraint.m, cse_detection.m,
follow_code.m, follow_vars.m, hlds_out.m, inlining.m, live_vars,
make_hlds.m, mercury_compile.pp, modes.m, store_alloc.m,
switch_detection.m:
	Handle pseudo_imported predicates.

modes.m, constraint.m:
	Change modecheck to return an updated module_info, since
	modechecking may insert new entries into the unify_requests
	queue in the module_info.  Make sure that modechecking
	never inserts requests into the unify_requests queue
	for code that has mode errors (or needs rescheduling).

call_gen.m, polymorphism.m:
	Move duplicated code into unify_proc.m.

clause_to_proc.m:
	Add new predicate clauses_to_proc for use by unify_proc.m.

unify_proc.m:
	Implement complicated unifications with complicated modes.
1995-07-20 13:32:36 +00:00
Andrew Bromage
9dddf14a3f OK, finally, everything should be back in order. 1995-07-05 23:38:32 +00:00
Andrew Bromage
fda56846cb With any luck, this should be the call_graph branch successfully
merged.  Do not use --constraint-propagation, because it doesn't
schedule conjunctions properly yet.
1995-07-04 03:15:30 +00:00
Thomas Conway
0dc8ca50d8 Implement an improved method of handling negated contexts.
code*.m & *gen.m:
	Implement an improved method of handling negated contexts.
	The new method avoids saving things onto the stack before
	an if-then-else or negation if it can.
	Also, fix the implementation of nondet if-then-else so that
	it does the soft cut properly.
1995-06-22 23:55:59 +00:00
Zoltan Somogyi
0f46c5d4e7 Merged in changes from the pass_str_branch. 1995-05-06 07:29:58 +00:00
Fergus Henderson
ac4f8ba0fb Add copyright messages.
compiler/*:
	Add copyright messages.
	Change all occurences of *.nl in comments to *.m.

compiler/mercury_compile.pp:
	Change the output to the .dep files to use *.m rather than *.nl.
	(NOTE: this means that `mmake' will not work any more if you
	call your files *.nl!!!)
1995-03-30 21:03:41 +00:00
Thomas Conway
5ccc28d6cc Fix a fencepost error in the allocation of *extra* framevars
code_info.nl:
	Fix a fencepost error in the allocation of *extra* framevars
	for the hp, etc.

ite_gen.nl:
	Fix a bug in saving and restoring state between the if-then and
	else branches.

live_vars.nl:
	Fix a couple of bugs. Beware of || accumulators that have the
	same type - it is easy to accidentally cross them over, and it
	can be tricky to debug :-(

store_alloc.nl:
	Fix a bug in the handling of post-births.
1995-01-16 06:56:38 +00:00
Fergus Henderson
1a977ea19a Replace all occurrences of `not(Vars, Goal)' with just
*.nl:
	Replace all occurrences of `not(Vars, Goal)' with just
	plain `not(Goal)'.

type_util.nl, switch_gen.nl:
	Higher-order pred types are not user-defined types.
	Add a `predtype' type category for them.

call_gen.nl:
	Change call_closure/2 to call_closure/3 (with liveinfo).
	Plus a little bit of random hacking.
1995-01-10 18:35:59 +00:00
Fergus Henderson
18b52a2d6c Change field(int, rval, int) to field(int, rval, rval), so
llds.nl, *.nl:
	Change field(int, rval, int) to field(int, rval, rval), so
	that the field number can be calculated at runtime
	(We need this for predicate closures).
	Also, remove the incr_hp(int) instruction and replace it
	with a heap_alloc(rval) rval.
	(We need to determine the space allocated at runtime
	for predicate closures, and also we want it to be an rval
	not an instruction so we can get conservative garbage collection
	to work.)

unify_gen.nl:
	More work for higher-order predicate closures.

std_util.nl:
	Recode `bool__and' and `bool__or' more elegantly.
1995-01-10 13:47:17 +00:00
Thomas Conway
4af1fb0bb7 Added some [now redundant] fixes to
various:
	Added some [now redundant] fixes to
	complicated unification code.

value_number.*:
	minor bugfix in the interface.
1994-09-05 10:30:13 +00:00
Fergus Henderson
a407841788 Only save and restore the heap pointer if the goal being
backtracked over contains a construction unification or a
non-builtin call.  Add code to save/restore the heap pointer
in one or two places where this was missing, e.g. semidet disjunctions.

Change switch/2 into switch/3 so that we can store the `local
determinism' of the switch there, rather than in the goal_info.

Fix code generation for semidet/nondet switches, so that
we omit the test for the last case if the switch is locally
det.
1994-08-27 08:29:26 +00:00
Fergus Henderson
5109d6b633 Fix swi-prolog incompatibility: call `setOutput' (set_output in SWI)
swi_builtin.nl, io.nu.nl:
	Fix swi-prolog incompatibility: call `setOutput' (set_output in SWI)
	rather than `tell'.

follow_vars.nl:
	Add lots of comments at the start.
	Remove a comment which was wrong.
	Fix the line wrapping for 80 cols.

hlds.nl:
	Update one of the comments.

std_util.nl:
	Make report_statistics SWI-compatible.
1994-08-16 03:10:09 +00:00
Fergus Henderson
7084f36088 Fix an infuriating cut-and-paste bug!
store_alloc.nl:
	Fix an infuriating cut-and-paste bug!
	Another one bites the dust...
1994-08-15 06:11:54 +00:00
Thomas Conway
0f1d52581c Fix assumptions about where variables go at the end of switches.
code_gen.nl code_info.nl:
	Fix assumptions about where variables go at the end of switches.
	Add StoreMap.

live_vars.nl store_alloc.nl:
	Passes to compute the stack allocations, and the "known" locations
	for variables.

hlds.nl:
	Add fields to procinfo for stack allocations.

options.nl:
	Add options for eager and lazy code generation.
	Eager code generation is still mostly untested. Its
	even possible that there are unimplemented preds!

llds.nl:
	Print the code in a slightly nicer format.
1994-08-13 05:01:13 +00:00