Commit Graph

27 Commits

Author SHA1 Message Date
Zoltan Somogyi
1d107c82ad Add predicates to perform lower-bound and upper-bound searching, in which
Estimated hours taken: 3

Add predicates to perform lower-bound and upper-bound searching, in which
if a search for a key fails, we return the next lower (or higher) key and
its associated value.

library/bintree.m:
library/rbtree.m:
library/tree234.m:
library/map.m:
	Add lower-bound and upper-bound search and lookup predicates.

	Add plain lookup predicates where missing, or move them next
	to their corresponding search preds.

	Make the handling of lookup errors more uniform.

library/require.m:
	Move map__lookup_error here as report_lookup_error, for use
	by bintree, rbtree and tree234, as well as map.
1999-03-07 23:41:05 +00:00
Fergus Henderson
14a25f4af5 Fix a bug caused by zs's recent change to runtime/mercury_stack_trace.{h,c}:
Estimated hours taken: 0.25

Fix a bug caused by zs's recent change to runtime/mercury_stack_trace.{h,c}:

library/require.m:
library/math.m:
	Update calls to MR_dump_stack() to pass as the new
	`include_trace_data' argument the value `FALSE'.
1998-11-13 14:06:56 +00:00
Fergus Henderson
6b59d488f0 Remove bogus layout structure for the hand-coded procedure
Estimated hours taken: 0.25

library/require.m:
	Remove bogus layout structure for the hand-coded procedure
	require__error_internal/1 -- it doesn't create a stack frame,
	so it doesn't need a layout structure.
1998-11-09 05:32:30 +00:00
Zoltan Somogyi
a4ccdeacc9 Fix an old bug: #include mercury_trace_base.h, not mercury_trace.h.
Estimated hours taken: 0.1

library/require.m:
	Fix an old bug: #include mercury_trace_base.h, not mercury_trace.h.
1998-09-30 07:09:10 +00:00
Fergus Henderson
67c8ad9b0e Fix a bug that broke error/1 in grades jump.*' and fast.*'.
Estimated hours taken: 0.5

Fix a bug that broke error/1 in grades `jump.*' and `fast.*'.

library/require.m:
	Rename the C module `require_module_internal' as
	`require_internal_module', to be consistent with the names
	used for other C modules defined in the Mercury library.
	Add code to ensure that the initialization function
	for this module gets run.
1998-07-12 16:28:48 +00:00
Fergus Henderson
6f3f7b0575 Add missing `#include' of "mercury_trace.h", needed
Estimated hours taken: 0.1

library/require.m:
	Add missing `#include' of "mercury_trace.h", needed
	for MR_trace_report().
1998-05-28 11:13:59 +00:00
Tyson Dowd
71e69a8f31 Fix stack traces dying in -O-1.
Estimated hours taken: 3

Fix stack traces dying in -O-1.

error/1 is usually generated with no stack frame, but in -O-1 it is
generated with one (but doesn't need it).  error/1 passes
MR_dump_stack MR_succip and MR_sp, and MR_dump_stack assumes that
MR_succip is for the topmost stack frame, but if error/1 has a stack
frame, this is not true.

library/require.m:
	Make sure the caller of MR_dump_stack has no stack frame
	by using handwritten code.  We call the handwritten code
	from error/1, and so we have the nice side effect that
	error now appears in the stack dump.

runtime/mercury_stack_trace.h:
	Document that MR_dump_stack assumes the succip is for the
	topmost stack frame.

runtime/mercury_label.h:
	Fix a comment, layout info is for a label, not a procedure.
1998-04-18 08:13:26 +00:00
Zoltan Somogyi
67d8308260 Same as previous message. 1998-04-08 11:36:13 +00:00
Tyson Dowd
caba46b200 Implement nondet stack dumps.
Estimated hours taken: 1

Implement nondet stack dumps.

library/require.m:
	Call MR_dump_stack with MR_curfr.

runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
	Get MR_curfr as input.
	If we hit a nondet stack frame, handle moving down a frame a
	little differently.
1998-04-07 05:13:30 +00:00
Tyson Dowd
f58ee880df Add support for stack dumps, do a stack dump from error/1.
Estimated hours taken: 12

Add support for stack dumps, do a stack dump from error/1.


compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
	Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
	becasue mgnuc stops processing its options when it
	encounters a non-mgnuc option.

library/require.m:
	Call MR_dump_stack if error is called.

runtime/Mmakefile:
runtime/mercury_imp.h:
	Add #includes of new files.

runtime/mercury_type_info.h:
	Remove conditional definition of MR_STATIC_CODE_ADDRESSES
	(moved into mercury_conf.h.in).

runtime/mercury_accurate_gc.h:
	Remove stack_layout stuff, leave this file for accurate
	GC specific definitions.

runtime/mercury_conf.h.in:
	Add conditional definitions of MR_INSERT_LABELS,
	MR_USE_STACK_LAYOUTS, MR_NEED_INITIALIZATION_CODE and
	MR_STATIC_CODE_ADDRESSES, depending on various other options.

runtime/mercury_goto.h:
	Insert labels into label table if MR_INSERT_LABELS is defined,
	rather than NATIVE_GC.

util/mkinit.c:
	Initialize if MR_NEED_INITIALIZATION_CODE is defined, rather than
	NATIVE_GC.

runtime/mercury_stack_layout.h:
	All the old stack layout definitions from mercury_accurate_gc.h.
	Add code for MR_DETISM_DET_CODE_MODEL.

runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
	Implement MR_dump_stack which just provides a dump of the stack
	as far as possible.
	Set MR_INSERT_LABELS and MR_USE_STACK_LAYOUTS if MR_STACK_TRACE
	is set.

runtime/mercury_grade.h:
	Add _strce if stack tracing is enabled in the grade.  This
	might not be a permanent change.

runtime/mercury_ho_call.c:
	Remove unused label declarations.

scripts/mgnuc.in:
	Add --stack-trace and --no-stack-trace options.
	Consolidate some duplicate code.
1998-03-11 06:01:17 +00:00
Fergus Henderson
7cb525fde3 Undo Zoltan's bogus update of all the copyright dates.
Estimated hours taken: 0.5

library/*.m:
compiler/*.m:
	Undo Zoltan's bogus update of all the copyright dates.
	The dates in the copyright header should reflect the years
	in which the file was modified (and no, changes to the
	copyright header itself don't count as modifications).
1998-01-23 12:33:43 +00:00
Zoltan Somogyi
9ae7acc593 Update all the copyright dates for 1998.
Estimated hours taken: 0.5

library/*.m:
	Update all the copyright dates for 1998.
1998-01-13 10:01:32 +00:00
Fergus Henderson
69faf90865 Add `:- pragma no_inline(error/1).', since inlining error/1
Estimated hours taken: 0.25

library/require.m:
	Add `:- pragma no_inline(error/1).', since inlining error/1
	results in bigger code with no improvement in speed.
1997-11-02 12:31:06 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Fergus Henderson
b27166f31d Add #include <stdio.h>.
Estimated hours taken: 0.25

library/math.m:
library/require.m:
	Add #include <stdio.h>.
1997-02-08 17:19:16 +00:00
Fergus Henderson
39eaab90c0 Move the C implementation of various builtins from the `runtime' directory
Estimated hours taken: 24

Move the C implementation of various builtins from the `runtime' directory
to inside pragma(c_code) declarations in the `library' directory sources.

library/{io,string,require,std_util,mercury_builtin}.m:
	Add lots of pragma(c_code) and pragma(c_header_code) declarations.

Also a few other miscellaneous changes.

library/list.m:
	Fix a bug in the as yet unused list__merge_sort.

library/io.m:
	Combine io__do_open_{input,output,append} into a single
	predicate io__do_open.

library/std_util.m:
	Fix the implementation of report_statistics so that it gives
	useful information when using conservative garbage collection.
1996-02-28 14:52:32 +00:00
Fergus Henderson
fa5226ee67 Improve the documentation.
library/*.m:
	Improve the documentation.
	Add a "Stability: low/medium/high" comment to all modules,
	which describes the stability of the interface to that module.

ops.m:
	Add `:' as an infix operator.

require.m:
	Implement require/1, since higher-order predicates now work.

term.m:
	Use the type `comparison_result' from mercury_builtin.m,
	rather than defining an identical type `comparison'.
1995-10-05 11:31:52 +00:00
Fergus Henderson
93a755d563 Add copyright notices.
library/*:
	Add copyright notices.
1995-03-28 16:19:34 +00:00
Fergus Henderson
fd2470dd0a Add some more stuff for compiling to .o
Makefile*:
	Add some more stuff for compiling to .o

Makefile*, mercury_compile*, code_gen*:
	Add some stuff for handling `.pp' files.
	`.pp' files are Mercury source code containing
	NU-Prolog hacks inside

		#if NU_PROLOG
		...
		#endif

	These hacks are preprocessed out (using sed, not cpp)
	except when compiling with `mnc'.

term_io.nl, term_io.nu.nl, interpreter.nl, prog_out.nl:
	Make sure all the predicates in term_io.nl are
	prefixed with `term_io__', not `io__'.

term_io.nl, require.nl:
	Add some `external' declarations.

call_gen.nl, unify_gen.nl:
	A temporary hack - generate incorrect code for complicated/polymorphic
	unifications, rather than aborting.

random.nl:
	Make the code more efficient.

hlds.nl, term.nl:
	Allocate pred_ids and variable numbers randomly rather than
	sequentially, so that the binary trees remain reasonably balanced.

code_info.nl, unify_gen.nl, hlds_out.nl:
	Generate informative comments for tag tests: say the name of
	the variable being tested, and which constructor we are testing for.

llds.nl:
	Cast field() expressions to (int) when used as rvals, so
	that comparisons work as expected.

make_hlds.nl:
	Improve error reporting.
1994-10-09 18:26:41 +00:00
Fergus Henderson
02e97f01f4 Handle is erroneous' and is failure' proc declarations.
prog_io.nl, hlds.nl, modes.nl, mercury_to_mercury.nl, require.nl:
	Handle `is erroneous' and `is failure' proc declarations.
	Add `is erroneous' to the declaration of error/1.

prog_io.nl:
	Report errors in proc declarations instead of just
	ignoring them.

hlds.nl:
	Fix a mode error (variable numbering error) detected by the
	mode checker.

modes.nl:
	Fix a minor formatting problem in error message.

mercury_builtin.nl:
	Change the work-around for higher-order predicate modes
	so that it doesn't cause mode errors.
1994-05-11 08:39:25 +00:00
Fergus Henderson
0ad664520e Rename various things for consistency:
s/term_functor/term__functor/g
	s/term_atom/term__atom/g
	s/term_string/term__string/g
	s/term_int/term__int/g
	s/term_float/term__float/g
	s/term_variable/term__variable/g

	/:- mode.*[^a-zA-Z_]input,/s/input,/in,/g
	/[^a-zA-Z_]input,.*)/s/input,/in,/g
	/:- mode.*[^a-zA-Z_]output,/s/output,/out,/g
	/[^a-zA-Z_]output,.*)/s/output,/out,/g

	/:- mode.*[^a-zA-Z_]input)/s/input)/in)/g
	/:- mode.*[^a-zA-Z_]output)/s/output)/out)/g

	/[a-z]info/s/info/_info/g
	/__info/s/__info/_info/g
1994-05-03 12:28:54 +00:00
Fergus Henderson
ea70c776ed make_hlds.nl: warn about use of undiscriminated union types;
don't warn about :- interface and :- implementation declarations;
	write warnings to stderr not stdout.

hlds_out.nl: write out if-then-else's (etc.) correctly.

typecheck.nl: write messages to stderr instead of stdout.

Lots of files: Fix lots of type errors and modularity violations.

Makefile: add new targets `check' and *.err
1994-02-13 07:35:06 +00:00
Fergus Henderson
532c27523f Split io.nl into io.nl and term_io.nl.
Moved most of the non-logical NU-Prolog code from io.nl and term_io.nl into
io.nu.nl and term_io.nu.nl respectively.  Rewrote the rest in logical Mercury.
Modified io__write_term to escape string constants if necessary.

Added char.nl and moved some of the predicates in string.nl into char.nl.
Rewrote some of the predicates in these files to avoid NU-Prolog dependencies.
Added a few new predicates.

Modified mercury_to_goedel.nl to correctly output variable names without
any danger of name clashes.  Also modified it to correctly escape string
constants.  Also modified it to correctly output functor names even
for nasty functors.

Did a little more work on the typechecker.

Moved the non-logical NU-Prolog code in require.nl into require.nu.nl.

Fix bug in prog_io.nl where combined type-and-mode declarations were
getting reversed.

Modified io.nu.nl and require.nu.nl so that calls to error/1 will
actually cause the program to abort.

In prog_io.nl: allow "\+" as a synonym for "not".
1994-01-25 13:48:40 +00:00
Fergus Henderson
9ba4a542e0 Added code to parse determinacy annotations.
Also misc. bug fixes.
1994-01-24 14:07:19 +00:00
Fergus Henderson
90c2b4f368 Added `author' comment to all source files.
Lots of bug fixes for make_hlds.nl.
A couple of bug fixes for hlds.nl.
Did some optimization of memory usage: added io__gc_call to io.nl
and used it in prog_io.nl and module.nl.  Rewrote the main loop
of prog_io to take maximum advantage of manual garbage collection.
Started working on typecheck.nl.
1993-12-28 11:35:16 +00:00
Fergus Henderson
24273623d9 Bug fix. 1993-11-28 07:40:04 +00:00
Fergus Henderson
f06bac3997 Added the compiler sources to the CVS repository. 1993-11-22 07:21:21 +00:00