Commit Graph

61 Commits

Author SHA1 Message Date
Fergus Henderson
771b7a76f3 In mercury_main(), use `exit(mercury_exit_status)' rather than
Estimated hours taken: 0.5

runtime/wrapper.mod:
	In mercury_main(), use `exit(mercury_exit_status)' rather than
	`return mercury_exit_status'.  This avoids problems with
	returning to code that was compiled without global register
	variables without restoring the values of those registers.
	(It might be better to actually save/restore the registers,
	but this change was simpler.)
1996-04-30 21:29:00 +00:00
Fergus Henderson
7aeaefab4a Add missing #include "dummy.h", which is needed for grade `debug'.
Estimated hours taken: 0.1

runtime/wrapper.mod:
	Add missing #include "dummy.h", which is needed for grade `debug'.
1996-04-30 14:56:04 +00:00
Zoltan Somogyi
3a95b81f0a Added a new option, -L, for loading the label table at the start, and thus
Estimated hours taken: 8

Added a new option, -L, for loading the label table at the start, and thus
being warned about duplicate labels then. (I thought this might be the
problem causing the segmentation violations described in Fergus's mail.)
1996-04-28 07:27:48 +00:00
Zoltan Somogyi
573e515784 When reporting statistics, print the total time elapsed so far,
Estimated hours taken: 0.5

wrapper.{h,mod}:
	When reporting statistics, print the total time elapsed so far,
	as well as the time elapsed since the last statistics.

memory.c:
	When a stack or the heap overflows, print the value of the PC.
1996-04-27 04:23:52 +00:00
Zoltan Somogyi
a1fd3093d9 Add a global variable to hold the time recorded at the last call to
Estimated hours taken: 0.5

Add a global variable to hold the time recorded at the last call to
report_stats, and add code to initialize this variable by calling the
timer routine at startup,
1996-04-16 06:10:09 +00:00
David Jeffery
4b58650200 Mercurial Constraints II (the plot thickens)
Estimated hours taken: 1 summer studentship

This is the implementation of the constraint solver interface runtime stuff.
We maintain a stack of tickets, accessible via mercury_solver_sp.

runtime/aux.[ch]
	Introduce a new memory allocation function, checked_malloc(). This is
	similar to newmem(), except that it always uses malloc(), not
	GC_malloc(), regardless of the grade. This is useful when allocating
	memory for the ticket stack as the garbage collector needn't know
	about the ticket stack - it never contains pointers into gc'ed memory.
runtime/imp.h
	Include mercury_solver_backtrack.h if we are in an appropriate grade.
runtime/wrapper.mod
	Initialise the ticket stack, call the solver initialisation macro.
runtime/mercury_solver_backtrack.h
	Implement the ticket macros, and the solver initialisation macro. This
	file is currently specific to the CLP(R) solver; to interface to a
	different solver, only the macros etc. in this file need be altered.
1996-03-26 16:54:51 +00:00
Peter Ross
acb95582e5 Moved the profiling initialisation code so that it sits around
Estimated hours taken: 1


library/io.m:
	Moved the profiling initialisation code so that it sits around
	the call to main/2(0).  Thus the profiler will now begin all it's
	profiles from main not from call_engine.

profiler/read.m:
	The profiler now expects that it's address are written out in decimal.
	read.m now assumes that an address is a decimal, but if it can't parse
	it, it will then read it in as a hexadecimal.  Thus the profiler will
	still be able to read it's old files.
	NB. A possible bug with this is that two numbers will get converted to
	the same number if one is treated as hex and the other decimal.

profiler/.cvsignore:
	Some more files to ignore.

runtime/{engine, wrapper}.mod:
	Remove the profiling initialisation code.

runtime/imp.h:
	Add a new call macro noprof_call() which doesn't record an arc
	in the call graph for profiling ever.  This is used to ignore some
	of the initial system set-up calls.

runtime/prof.c:
	Output integers instead of hexs for the addresses.
1996-03-21 12:00:10 +00:00
Fergus Henderson
f19e066247 Fix things so that there are no circular dependencies amoungst the
Estimated hours taken: 0.5

Fix things so that there are no circular dependencies amoungst the
libraries, so that shared libraries work better (e.g. they can
use QuickStart on Irix 5).  The dependencies are linear again:
program -> library -> runtime -> boehm_gc.  (This property was
broken by my recent changes which moved lots of stuff from the
Mercury runtime to pragma(c_code) in the Mercury library.)

rutime/init.h:
	Change the set of address variables used for communication
	between the main program, the Mercury library, and the Mercury
	runtime.  Remove address_of_io__init_state_2_0, since it is no
	longer needed, and add address_of_mercury_init_io, since it is.
	Rename entry_point as library_entry_point, and rename
	address_of_main_2_0 as program_entry_point.

rutime/wrapper.mod:
	Rename entry_point as library_entry_point, and add new `-m' option
	to set program_entry_point.  Add definitions of the address variables
	(I had moved these defitions to ../library/io.m, but that created
	a backwards dependency.)

runtime/{Mmake,io_rt.h,wrapper.mod,init.h}
	Remove io_rt.h, since io_rt.mod was removed.
	The declaration for mercury_init_io() in it has been moved to init.h.
1996-03-04 00:26:15 +00:00
Fergus Henderson
9c48ed0c6d Move declaration for do_init_modules() from init.h to wrapper.h.
init.h, wrapper.h:
	Move declaration for do_init_modules() from init.h to wrapper.h.

wrapper.h:
	Fix indentation.

init.h, io_rt.mod, wrapper.mod:
	Make sure that there are no undefined external references
	when building the shared libraries, so that we can use
	`ld -no_unresolved' on Irix 5.  This means the shared libraries
	can be Quickstarted, which improves startup time.
	The way it was done was by changing all calls to external
	references to instead call indirectly via global variables.
	c2init now generates a main() which initializes these
	global variables and then calls mercury_main().

dlist.{c,h}:
	Rename a function to avoid a naming clash with the C library.
1995-10-24 07:13:18 +00:00
Fergus Henderson
e8f8abaead Change the default heap size from 40M to 4M.
runtime/wrapper.mod:
	Change the default heap size from 40M to 4M.
1995-09-28 06:58:05 +00:00
Fergus Henderson
2f3224bbcb Replace the default_entry' and which' (which _what_?)
init.h, wrapper.mod:
	Replace the `default_entry' and `which' (which _what_?)
	variables with a single variable `entry_point'.
	Move the check for NULL to just before entry_point is used,
	so that it comes after the call to do_init_modules().
	XXX The `-w' (entry-point) option still doesn't work.

wrapper.mod, label.c:
	Don't call do_init_entries() from do_init_modules();
	instead, call it only if and when necessary.
1995-09-23 15:46:23 +00:00
Fergus Henderson
6eb6ed8311 Add a sanity check for the garbage collector.
runtime/wrapper.mod:
	Add a sanity check for the garbage collector.
1995-09-12 18:34:33 +00:00
Fergus Henderson
a7db9765ce Remove the backwards-compatibility hack for `--' on the command line.
wrapper.mod:
	Remove the backwards-compatibility hack for `--' on the command line.
	It shouldn't be needed anymore.
1995-09-12 16:23:37 +00:00
Fergus Henderson
4cb64e5699 Fix a couple of warnings where we were implicitly assuming that
runtime/wrapper.mod:
	Fix a couple of warnings where we were implicitly assuming that
	a ptrdiff_t was the same size as an int.
1995-09-08 08:01:17 +00:00
Fergus Henderson
e8227244b0 Fix bug in dylan's recent changes.
runtime/wrapper.mod:
	Fix bug in dylan's recent changes.
1995-09-08 03:28:12 +00:00
Fergus Henderson
781144e770 Use an empty inline asm statement rather than an assignment
runtime/goto.h:
	Use an empty inline asm statement rather than an assignment
	to a global volatile variable to stop gcc from optimizing
	away labels which are only referenced via the inline asm
	entry points.  This is better, because empty inline asm
	statements don't result in any object code, whereas assignments
	to global volatile registers do.

wrapper.h, wrapper.mod:
	Various stylistic improvements.  Clean up some old junk and some
	new junk, and fix a few misspellings.  Rearrange a few things.
1995-09-06 15:01:39 +00:00
Dylan Shuttleworth
ce62bc555e Runtime options are now read from an environmental variable called
wrapper.mod
	Runtime options are now read from an environmental variable called
	MERCURY_OPTIONS, not from the command line.
1995-09-06 08:35:45 +00:00
Fergus Henderson
fce9c95a8c A bunch of changes resulting from work during the BSD/386 port.
imp.h, engine.mod, io_rt.mod:
	Reorder #include lines so that "regs.h" gets included
	before any of the system header files (other than <stddef.h>).
	This is necessary because on some systems, the system header files
	contain inline functions, and the global register variable
	declarations must precede these.

regs.h:
	Add case for i386, since global register variables now work
	on the 386 (the problem was just that we needed -fno-builtin).

label.c, wrapper.mod:
	Add #include of <string.h> for strcmp().
	(These missing #include were not previously noted because gcc has
	a builtin-declaration for strcmp() - it only caused a warning
	when I compiled with `-fno-builtin'.)

regorder.h:
	Change the register allocation order so that `sp' gets
	allocated first, since for the compiler, 36% of all Mercury
	register references are to `sp'.

memory.c:
	With `-dm', if we're using CONSERVATIVE_GC, don't output the
	size etc. for the heap, since they will all be zero - the
	heap gets allocated by the Boehm collector.
1995-09-03 15:22:49 +00:00
Zoltan Somogyi
b61dea243b Fix a bug: do_init_modules was getting called too late in the
wrapper.mod:
	Fix a bug: do_init_modules was getting called too late in the
	processing of -w options. Of course, -w doesn't work for most
	grades anyway anymore.
1995-08-26 12:44:15 +00:00
Fergus Henderson
8cca156f72 Don't allocate space for the label table unless it is needed.
label.c, label.h, wrapper.mod:
	Don't allocate space for the label table unless it is needed.
	This reduces startup time, significantly improving performance
	on the `hello world' benchmark:

					before		after
		statically linked	0.25s		0.14s
		dynamically linked	0.68s		0.58s
1995-08-26 08:15:43 +00:00
Fergus Henderson
a38a078a88 Add a new option `-dt' for use with the modes that
runtime/{engine.h,engine.mod,memory.c,wrapper.mod}:
	Add a new option `-dt' for use with the modes that
	don't use gcc non-local gotos.  If this option is
	enabled, the runtime system will use the slow driver
	loop rather than the unrolled one, and if a seg fault
	occurs it will print out the last 40 locations.
	(This is most useful in combination with -DDEBUG_LABELS,
	otherwise you'll just get hex addresses.)
1995-08-24 06:37:55 +00:00
Fergus Henderson
3174b8faf7 Make oldmem() call GC_FREE() if CONSERVATIVE_GC is defined.
runtime/aux.c:
	Make oldmem() call GC_FREE() if CONSERVATIVE_GC is defined.
	Improve the error messages from fatal_error().

runtime/{imp.h,label.c}
	Use `Unsigned' rather than `Uinteger'.

runtime/dlist.c:
	Fix incorrect comment.

runtime/memory.c:
	Various portability fixes for the Alpha, mostly to do with
	mixing integers and pointers of different sizes.
	Also make sure we only use PC_INDEX if it is defined.

runtime/prof.c:
	Another portability fix for the Alpha: use `sysconf(_SC_CLK_TCK)'
	if `HZ' is not available.
	Also a major clean-up:
	Tidy up the code.  Avoid memory leaks.  Remember to close files.
	Tidy up the error messages for when fopen() fails.
	Check the return values from fclose().
	(XXX still need to check return values of signal() and setitimer().)

runtime/regs.h:
	Add alpha_regs.h.
1995-07-28 13:55:04 +00:00
Fergus Henderson
3ea056b97a Use a date-stamp to avoid attempting to remake conf.h all the time.
runtime/Mmake:
	Use a date-stamp to avoid attempting to remake conf.h all the time.
	Pass --no-ansi to mgnuc, since there doesn't seem to be any
	other reliable, portable way of getting the necessary definitions
	from the system header files (sigh).
	Invoke mgnuc as ../scripts/mgnuc.

runtime/{memory.c,wrapper.h,wrapper.mod}:
	Use `unsigned' rather than `uint', since `uint' requires
	<sys/types.h> and !defined(_POSIX_C_SOURCE), which would reduce
	portability.

runtime/memory.c:
	Some minor reorganizations to avoid the use of runtime/ext_signal.h.

runtime/ext_{signal,stdlib}.h:
	Removed, since they is no longer needed.
1995-07-26 16:30:34 +00:00
Zoltan Somogyi
092615d117 Ensure the loading of the label table if a -w entry_point option is
wrapper.mod:
	Ensure the loading of the label table if a -w entry_point option is
	specified. Without the table, we cannot find the address of the entry
	point.
1995-07-26 00:40:48 +00:00
Zoltan Somogyi
8286bdca20 Add an option -a to print all solutions of main/2.
wrapper.mod:
	Add an option -a to print all solutions of main/2. This is strictly
	for benchmarks. Also reordered the arms of the switch in process_args
	to follow alphabetical order.
1995-07-24 11:24:12 +00:00
Fergus Henderson
87fb0c43a7 Improve an error message.
runtime/wrapper.mod:
	Improve an error message.
1995-07-17 03:18:30 +00:00
Fergus Henderson
b6e3d5ff6e Fix stupid bug which meant that `--grade jump' didn't work.
wrapper.mod:
	Fix stupid bug which meant that `--grade jump' didn't work.
	It's amazing the things you find when you do a little testing.
1995-07-15 13:05:10 +00:00
Fergus Henderson
566616df4a Fix bug introduced in my recent change: use `GOTO_LABEL' macro
wrapper.mod:
	Fix bug introduced in my recent change: use `GOTO_LABEL' macro
	rather than ordinary `goto', so that it works with GRADE=debug.
1995-06-26 08:39:19 +00:00
Peter Ross
6b3ac2f7cb Call do_init_modules if any of the profiling flags on.
wrapper.mod:
	Call do_init_modules if any of the profiling flags on.  Need label info
	for all types of profiling.

	Executes code to begin time profiling if flag defined.
1995-06-26 05:44:39 +00:00
Fergus Henderson
0a82600fac Only return the first solution to main/2, rather than all solutions.
wrapper.mod:
	Only return the first solution to main/2, rather than all solutions.

table.c:
	Remove unnecessary assert(), since it caused a warning,
	and since the condition it checks for is already checked
	for in newmem().

CFLAGSFILE, PORTABILITY:
	Minor changes.
1995-06-24 13:24:30 +00:00
Zoltan Somogyi
ebe5dbd23f Call init_entries even if we are not populating the table at the
wrapper.mod:
	Call init_entries even if we are not populating the table at the
	start. This avoids references to an unallocated table later in debug
	mode.
1995-06-14 12:06:25 +00:00
Zoltan Somogyi
3c000fea2c Separated out the handwritten .c files from those generated from .mods.
Mmake:
	Separated out the handwritten .c files from those generated from .mods.
	Added a rule for invoking ctags.

engine.c:
	Remove the label do_reset_framevar0_fail, an anachronism. Some
	formatting changes.

io_rt.mod:
	Flush stdout when processing error/1.

memory.c:
	Print out the PC in the SIGBUS handler as well as the SIGSEGV handler.
	Some formatting changes.

stacks.h:
	Cast pointers to nondet frames to (Word *) before use. If they are
	stored in e.g.  detstackvars, their native type is just Word.

table.c:
	Strengthened debugging capability. A check for whether the hash value
	is within bounds is now turned on by default. Later we can turn it off
	again.

wrapper.mod:
	Changed initialization code to always allocate space for the label
	table, even if init_modules does not need to be called. This avoids
	a crash in some situations.
1995-06-14 07:26:24 +00:00
Fergus Henderson
37b8db59d6 Remove the last remaining occurrences of the until', or', `when', and
std.h, memory.c, wrapper.mod:
	Remove the last remaining occurrences of the `until', `or', `when', and
	`otherwise' macros.
1995-05-29 08:59:46 +00:00
Zoltan Somogyi
19bcfcbab4 Now memory diagnostics are printed on stderr.
memory.c:
	Now memory diagnostics are printed on stderr.

wrapper.mod, memory.c:
	Convert whens to cases and ors to else ifs.

other files:
	copyright notices.
1995-05-29 02:04:10 +00:00
Fergus Henderson
be909d9fd8 Add an option to disable garbage collection.
wrapper.mod:
	Add an option to disable garbage collection.
	(It doesn't work perfectly, since we have already
	allocated memory and done a couple of mini-garbage collections
	before we even get to the option processing.)
1995-05-27 18:17:57 +00:00
Fergus Henderson
df7ae06b5e Don't allocate space for the label table unless and until we are
label.c, label.h, wrapper.mod:
	Don't allocate space for the label table unless and until we are
	actually going to use it.
	Add a new `-sl' option to specify the size of the label table.
1995-05-15 07:23:13 +00:00
Fergus Henderson
5b0652f38a Call GC_register_displacements() to allow us to use tagged pointers
runtime/wrapper.mod:
	Call GC_register_displacements() to allow us to use tagged pointers
	with conservative GC.
1995-05-14 18:54:41 +00:00
Zoltan Somogyi
0f46c5d4e7 Merged in changes from the pass_str_branch. 1995-05-06 07:29:58 +00:00
Fergus Henderson
3fc5389b53 Add copyright notices.
runtime/*:
	Add copyright notices.
1995-03-30 21:57:11 +00:00
Fergus Henderson
0934609e3e Fix missing semicolon.
runtime/wrapper.mod:
	Fix missing semicolon.
1995-03-28 04:57:01 +00:00
Fergus Henderson
56bfe4c015 Add new -dG option for enabling garbage collection messages.
wrapper.mod:
	Add new -dG option for enabling garbage collection messages.
	(Only works if boehm_gc was compiled without -DSILENT.)
1995-03-19 10:20:14 +00:00
Fergus Henderson
dbb4c8213b Due to a bug in the Solaris linker, we need to call the GC_INIT()
scripts/mod2init.sh, runtime/{wrapper.mod,init.h}:
	Due to a bug in the Solaris linker, we need to call the GC_INIT()
	macro from some statically linked part of the code.
	So I've modified mod2init to add an init_gc() function to the init
	file, and I've modified wrapper.mod to call it.
1995-03-18 07:51:05 +00:00
Fergus Henderson
e68c61c354 If the chmod fails, don't worry about it.
Cakefile:
	If the chmod fails, don't worry about it.

ext_signal.h:
	Comment out most of the file if __sgi is defined.
	It didn't seem to work on the sgi.

wrapper.mod:
	Fix a serious bug with the -w option.

io.mod:
	Change io__run/0 so that it works even if main/2 is nondet.
	We need this (until we have implemented solutions/2) for the
	benchmarks.

memory.c, wrapper.h, wrapper.mod:
	Fix yet another serious modulus-on-signed-int bug.
	This stopped things working if you used shared libraries,
	since the address of fake_regs was negative, which confused
	the init_memory() function.
1995-03-06 10:37:16 +00:00
Fergus Henderson
47d2dd97d5 Don't include the default definition of main/2 in the library.
Cakefile:
	Don't include the default definition of main/2 in the library.

ext_stdlib.h:
	Remove most of the stuff here, since it was causing problems
	compiling on Irix.

ext_signal.h:
	Remove definition of MINSIGSTKSZ.

io.mod:
	Line numbers start from 1, not 0.

io.mod, wrapper.mod, wrapper.h:
	Implement io__{set,get}_exit_status.

prof.h:
	Add declaration of prof_current_proc.
1995-03-04 14:35:52 +00:00
Fergus Henderson
d4c7b3e54f Add new grades asm_*.
examples/Mercury:
	Add new grades asm_*.

wrapper.mod:
	Add a new -h (help) option.
	Change the behaviour of the -l option:
		Exit after printing the labels
		Don't use popen("sort -n"), since it's an unnecessary OS
		dependency and the user can do it anyway.
		[And because we weren't checking whether the call
		succeeded, and I didn't want to add checking code...]

io.mod, init.h, wrapper.mod, label.c:
	Remove support for automatically calling *_input.
	Optimize things so that we only call init_modules() if we
	are going to need the label names.
1995-02-26 17:50:40 +00:00
Fergus Henderson
5835cddc6a Cakefile dummy.c dummy.h engine.h engine.mod imp.h io.mod label.h wrapper.mod:
Make various changes required for using assembler labels.
1995-02-26 13:52:58 +00:00
Fergus Henderson
d49d51e9f7 Fix typo.
memory.c:
	Fix typo.

wrapper.mod:
	Change default stack size to 512k, since the compiler uses
	more than 128k.
1995-02-22 11:50:48 +00:00
Thomas Conway
90ce96d31f add a new debugging option: -dr which writes the values of
various:
	add a new debugging option: -dr which writes the values of
	the first 8 registers immediately after each goto.
1995-02-12 10:40:27 +00:00
Fergus Henderson
9f4490af21 Add missing newlines in help message.
wrapper.mod:
	Add missing newlines in help message.
1995-02-08 22:02:46 +00:00
Fergus Henderson
674f779cf1 Comment out the "--" hacks since they don't seem to be necessary.
wrapper.mod:
	Comment out the "--" hacks since they don't seem to be necessary.
1995-02-08 06:34:16 +00:00