Commit Graph

117 Commits

Author SHA1 Message Date
Fergus Henderson
d97c71cb51 Temporarily resurrected, for bootstrapping reasons.
Estimated hours taken: 0.5

runtime/imp.h:
	Temporarily resurrected, for bootstrapping reasons.
	(Can't remove this until the change to make llds_out.m
	reference mercury_imp.h instead of imp.h has been installed.)
1997-11-23 15:44:47 +00:00
Tyson Dowd
bd19208eb9 Remove old .h files.
Estimated hours taken: 1

runtime/*.h:
runtime/*.c:
runtime/mercury_conf.h.in:
	Remove old .h files.
	Update #includes to refer to mercury_*.h
	Update #ifdef MODULE_H to be #ifdef MERCURY_MODULE_H
1997-11-23 07:21:53 +00:00
Tyson Dowd
7ce7d489a2 Cleaned up runtime directory.
Estimated hours taken: 2

Cleaned up runtime directory.

runtime/*.c:
	- Renamed all .c files as mercury_*.c
	  Some have been renamed to make their purpose clearer.
	  	call.mod -> mercury_ho_call.c

runtime/*.h:
	- Moved contents of .h files to mercury_*.h
	- *.h now contain #include mercury_*.h. They be removed later.
	- Updated references to conf.h -> mercury_conf.h

runtime/conf.h.in:
	- Renamed conf.h.in as mercury_conf.h.in.
	  Didn't leave a forwarding header for this one, as conf.h was
	  never part of the repository anyway.

runtime/Mmakefile:
	- Convert lists to one-per-line lists.
	- Add mercury_accurate_gc.h to HDRS.
	- Remove all .mod files
	- Make sure runtime.init uses the ORIG_CS not MOD_CS.
	- Fix the rules for "clean_o" and "clean_mod_c", which used
	  wildcards like "*.o" to remove files.  The one that removed
	  all .c files corresponding with *.mod, instead of using MOD_CS
	  was particularly vicious.
	- Cope with the file renamings.

configure.in:
	- Cope with the file renamings.
1997-11-20 02:04:40 +00:00
Fergus Henderson
1d245a72a5 A small change that I forgot to commit when I added mercury_grade.h.
Estimated hours taken: 0.1

A small change that I forgot to commit when I added mercury_grade.h.

runtime/imp.h:
	#include "mercury_grade.h".
1997-10-02 17:13:57 +00:00
Fergus Henderson
78a981f028 Fix a bug in the ordering of the #include statements
Estimated hours taken: 0.25

runtime/imp.h:
	Fix a bug in the ordering of the #include statements
	that caused problems when using DLLs on Windows.

runtime/conf.h.in:
	Add a comment.
1997-09-30 13:31:38 +00:00
Fergus Henderson
f2df787842 Fix a few things in my recent changes for DLL support.
configure.in:
runtime/conf.h.in:
	Define USE_DLLS in conf.h.

runtime/imp.h:
runtime/init.h:
runtime/memory.c:
runtime/table.c:
util/mkinit.c:
boehm_gc/gc.h:
	Conditionalize things on `#ifdef(USE_DLLS)' rather than on
	`#ifdef(__CYGWIN32__)'.  Testing for specific systems tends
	to lead to code that is difficult to maintain.

util/mkinit.c:
	Fix a bug: it was checking `#if defined(libmer_USE_DLL)', but it
	should have been checking `#if !defined(libmer_DEFINE_DLL)'.
1997-08-28 18:21:48 +00:00
Fergus Henderson
c6af510323 Implement support for DLLs on Windows.
Estimated hours taken: 24

Implement support for DLLs on Windows.
The changes consisted of

1.  Adding `Makefile.DLLs', which is a file I wrote contains
    GNU Make rules for building DLLs.  Making sure that
    the various Mmakefiles include that one.

2.  Making sure we #include the "libfoo_dll.h" header file
    generated by `Makefile.DLLs' before every place that
    references a global variable.

3.  Making sure that code which defines the DLLs is
    compiled with -Dlibfoo_DEFINE_DLL.

5.  Changing various places to explicitly register the data
    segment as a root set with the conservative garbage collector.
    This was necessary to get GC working with DLLs under Windows
    (there doesn't seem to be any way of automatically finding
    the data segments of DLLs under win32).

6.  Changing the way names are mangled to ensure that the assembler
    names always contain a leading underscore, since `dlltool'
    on gnu-win32 requires this.

TODO:
- Document how users can create their own DLLs.
- Add support for that to Mmake.

configure.in:
Mmake.common.in:
	Add USE_DLLS variable.  (Most of the Makefile changes below are
	conditionalized on this variable.)

boehm_gc/Makefile:
	Add dependency $(OBJS) : libgc_dll.h.
	Add `-DGC_DEFINE_DLL' to CFLAGS.
	Include Mmakefile.DLLs.
	Add new targets `dll' and `test_dll'.

boehm_gc/Mmakefile:
	Add stuff to install libgc_dll.h and libgc_globals.h.

boehm_gc/gc.h:
	For __CYGWIN32__, #include "libgc_dll.h".
	This is necessary to handle global variables in DLLs on Windows.
	For __CYGWIN32__, define GC_INIT() to add the
	data segment of the current DLL or executable as
	a new root set.

library/Mmakefile:
	Add stuff needed for building DLLs.

runtime/wrapper.mod:
library/io.m:
	Add call to GC_INIT() to register the root set for
	libmer.dll and libmercury.dll respectively.
	In wrapper.mod, move the call to GC_is_visible
	_after_ the calls to GC_INIT().

runtime/Mmakefile:
	Add stuff needed for building DLLs.

runtime/init.h:
runtime/imp.h:
runtime/dummy.c:
runtime/label.c:
runtime/memory.c:
runtime/table.c:
	For __CYGWIN32__, make sure we #include "libmer_dll.h".
	before defining global variables.
	This is necessary to handle global variables in DLLs
	on Windows.

runtime/goto.h:
util/mdemangle.c:
prof/demangle.m:
	Change the way names are mangled to ensure that the assembler
	names always contain a leading underscore, since `dlltool'
	on gnu-win32 requires this.

util/mkinit.c:
	For __CYGIN32__, when using DLLs, make sure we initialize the
	_impure_ptr of the DLLs that we're using.

library/Mmake:
runtime/Mmake:
	Compile with -Dlibfoo_USE_DLL options.
	Add code to install libfoo_dll.h and libfoo_globals.h.
	Include Mmakefile.DLLs.
1997-08-28 17:52:54 +00:00
Fergus Henderson
d21f5cedf3 Generalize the current support for trailing.
Estimated hours taken: 8

Generalize the current support for trailing.
Previously, the trail was hardwired, either for interfacing to CLP(R),
or (in my alternative not-checked-in version) for backtrackable destructive
arrays.  But it couldn't handle both of these at the same time and it
couldn't be extended.  So we have replaced this with a more generic
trail.  The trail has two sorts of entries, value trail entries and
function trail entries.

runtime/mercury_trail.h:
runtime/mercury_trail.c:
	New files. They provide macros MR_trail_value(),
	MR_trail_function(), etc. which are the new interface to
	the Mercury trail.  (All the trailing stuff is done inside
	`#ifdef MR_USE_TRAIL'.)

	These files also implement the save_ticket(), restore_ticket(),
	and discard_ticket() macros that are used in the C code that
	the Mercury compiler generates, except that I've renamed them
	and changed the interface slightly.

	These files also define the trail memory zone MR_trail_zone,
	and the new virtual machine registers MR_trail_ptr and
	MR_ticket_counter.  (Perhaps these should instead be in memory.c
	and regs.h respectively?)

runtime/mercury_solver_backtrack.h:
	Deleted, since this file has been replaced by mercury_trail.h.

runtime/imp.h:
	#include "mercury_trail.h" rather than "mercury_solver_backtrack.h"

runtime/Mmakefile:
	Add mercury_trail.c and mercury_trail.h.
	Remove mercury_solver_backtrack.h.

runtime/context.h:
	Add new fields to the Context struct to hold MR_trail_zone,
	MR_trail_ptr and MR_ticket_counter.  Add code to handle these
	in save_context()/load_context().

runtime/context.mod:
	Add code to new_context() to initialize the trail.

runtime/wrapper.h:
runtime/wrapper.mod:
runtime/memory.c:
	Add code to handle setting the trail size via the
	MERCURY_OPTIONS environment variable.
	Remove old stuff to support the solver_stack.

runtime/wrapper.mod:
runtime/regs.h:
runtime/regorder.h:
	Count the usage of the new virtual machine registers
	MR_trail_ptr and MR_ticket_counter.
	(Currently they are implemented just as global variables,
	not registers.)
1997-08-23 22:34:18 +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
Bert Thompson
b85660aaf9 Replaced all occurences of assert() with the new macro
Estimated hours taken: 0.2

runtime/context.mod:
runtime/debug.h:
runtime/dlist.c:
runtime/imp.h:
runtime/regs.h:
runtime/std.h:
runtime/wrapper.mod:
	Replaced all occurences of assert() with the new macro
	MR_assert(), which does nothing if SPEED is defined.

	Previously, we defined NDEBUG if SPEED was defined, which
	had the unfortunate consequence of turning off assertions
	in the code of Mercury users that includes the standard
	Mercury headers. Users' assertions no longer get turned off
	inadvertently.
1997-06-03 08:14:40 +00:00
Bert Thompson
616c652ea4 Modified C code to make it conform to the C coding standards.
Estimated hours taken: 5

Modified C code to make it conform to the C coding standards.

runtime/
	Mmake call.mod calls.h context.h context.mod debug.h
	deep_copy.c deep_copy.h dlist.c dlist.h dummy.c engine.h
	engine.mod getopt.h goto.h heap.h imp.h init.h label.c label.h
	memory.c memory.h mercury_float.h mercury_solver_backtrack.h
	mercury_string.h mercury_types.h misc.c misc.h overflow.h
	prof.c prof.h prof_mem.c prof_mem.h regorder.h regs.h
	spinlock.c spinlock.h stacks.h std.h table.c table.h tags.h
	timing.c timing.h type_info.h wrapper.h wrapper.mod
runtime/machdeps/
	alpha_regs.h i386_regs.h mips_regs.h no_regs.h pa_regs.h
	regtest.c rs6000_regs.h sparc_regs.h
util/
	demangle.c mkinit.c
1997-02-12 02:18:54 +00:00
Fergus Henderson
8520a4c88c A general cleanup of the code in the runtime directory, aimed at
Estimated hours taken: 6

A general cleanup of the code in the runtime directory, aimed at
formulating a more coherent header file inclusion policy.  This change
fixes a couple of bugs that prevented the runtime from compiling in
certain configurations (e.g. on muse) due to missing #includes, and
also fixes a few minor unrelated things such as the use of `size_t'
instead of `unsigned'.

Our header file inclusion policy is that every header file should
#include any other header files needed by the declarations or by the
macros it defines.  Cyclic interface dependencies, where two header
files each #include the other, must be avoided (by splitting up header
files into smaller indepdent units, if necessary).

At some stage in the future we should rename all the header files to
`mercury_*.h', to avoid any possible name clashes with system or user
header files.

runtime/Mmake:
	Add a new target `check_headers' to check that each
	header file is syntactically valid in isolation.

runtime/imp.h:
runtime/mercury_float.h:
runtime/mercury_string.h:
runtime/mercury_types.h:
runtime/calls.h:
	Move the code in "imp.h" into new header files.
	"imp.h" now contains nothing but #includes.

runtime/conf.h.in:
runtime/*.h:
runtime/{label,prof,prof_mem}.c:
runtime/*.mod:
	Update the #includes to reflect the new header file structure.
	Add some missing header guards.  Add some comments.
	Put the correct years in most of the copyright notices.

runtime/heap.h:
	Fix a bug: add #include "context.h", needed for
	min_heap_reclamation_point.

runtime/context.h:
	Fix a bug: add #include "memory.h", needed for MemoryZone.
	Move the general description comment to the top of the file.
	Fix the indentation of some comments.  Add a couple of new comments.

runtime/context.mod:
	Delete a couple of unnecessary declarations.

runtime/wrapper.mod:
	Change the type used for memory sizes from `unsigned' to `size_t'.
	Change the `-p' (primary cache size) option so that it is always
	a size in kilobytes, rather than being schitzophrenic about
	whether it is bytes or kilobytes.

runtime/regorder_base.h:
	Removed, since it not used (and constitutes a
	double-maintenance problem).
1997-02-08 12:40:13 +00:00
Fergus Henderson
f27a871ff5 The following diff fixes a few bugs in Tom's recent changes,
Estimated hours taken: 2

The following diff fixes a few bugs in Tom's recent changes,
some of which meant that it didn't compile on Solaris.
It also fixes a few stylistic things, e.g. using a
higher level of abstraction and avoiding the use of `Word'
where it is not needed.

I also changed several of the types in some of the existing
code in the runtime: the stuff for computing memory sizes,
offsets, etc., should use `size_t', not `unsigned',
and the `num_uses' array can be `unsigned long', not `Word'.

runtime/Mmake:
	Add missing entries for context.h, spinlock.h, and spinlock.c.

runtime/context.h:
	Delete an unnecessary #include.
	Use `typedef Word AtomicBool' rather than spreading that
	particular assumption throughout the code.

runtime/context.mod:
	Don't forget to #include "context.h".
	Use AtomicBool and SpinLock rather than Word.
	Use allocate_object() and allocate_array()
	rather than allocate_byte() and allocate_word().
	Fix a bug in some calls to get_lock() and release_lock()
	where it was passing the SpinLock itself rather than the
	SpinLock's address.  Add casts from `Word *' to `SpinLock *'
	to avoid depending on the assumption that SpinLock == Word.

runtime/imp.h:
	Delete the typedef for SpinLock, since it belongs in
	spinlock.h, not here.

runtime/memory.h:
	Define allocate_object() and allocate_array() macros.
	Delete the allocate_words() function, since allocate_array()
	should be used instead.
	Delete allocate_spinlock(), since that belongs in spinlock.h,
	not here.
	Use `size_t' rather than `unsigned' for counting memory sizes
	and offsets.

runtime/memory.c:
	Change the type of num_uses from `Word[]' to `unsigned long[]'.
	Use `size_t' rather than `unsigned' for counting memory sizes
	and offsets.  Use `int' rather than `Word' for the offset_count.
	Use SpinLock rather than Word for the offset_lock.
	Use allocate_object() and allocate_array()
	rather than allocate_byte() and allocate_word().
	Fix the indentation in a couple of places.
	Fix the syntax of a #error directive.

runtime/spinlock.c:
	Fix a syntax error.  This file had never been compiled.

runtime/spinlock.h:
	Add allocate_spinlock(), which was previous in memory.h.
	Add deallocate_spinlock().
	Separate out the interface and the implementation
	details and document the interface.
	Add missing #include statements that are needed
	to define things used in this file.
	Change the get_lock() and release_lock() macros so that
	they do not cast their argument; instead, the caller
	should cast it, if necessary.

runtime/wrapper.mod:
	Eliminate a cast which is no longer necessary.
1997-02-07 18:40:14 +00:00
Thomas Conway
8042fb4c10 This change is a major reorganisation of the runtime engine.
Estimated hours taken: 40

This change is a major reorganisation of the runtime engine.
The main point of this change is to make the Mercury engine
multithreaded - so that more than one goal can be evaluated
at a time.

runtime/*.{c,h,mod}:
	Lots of changes - new files: context.{h,mod} spinlock.{c,h}

library/std_util.m:
	Fix solitons to work in the presence of multiple contexts.
1997-02-06 23:11:50 +00:00
Fergus Henderson
a718d93873 Fix five bugs in the make_aligned_string() macro:
Estimated hours taken: 0.5

runtime/imp.h:
	Fix five bugs in the make_aligned_string() macro:
	- the sense of the test was inverted
	- in one spot, one of the arguments was not enclosed in parentheses
	- it had a bogus trailing semicolon
	- the first argument to incr_hp_atomic should have been
	  cast (using LVALUE_CAST) to type Word
	- the second argument to incr_hp_atomic was not parenthesized
	  properly -- the precedence of division is higher than that
	  of addition -- causing it to allocate too much memory.
	I also made a couple of minor changes to make it more readable.
1997-01-16 11:32:29 +00:00
Tyson Dowd
c1c2aa201c Implementation of
Estimated hours taken: 45

Implementation of
	functor/3
	arg/3	(and det_arg/3)
	expand/4 (like Prolog's =..)

runtime/imp.h:
	Add macro `make_aligned_string' which copies strings onto the
	heap if they are unaligned.

runtime/type_info.h:
	Add definitions of offsets for finding functors and arities.
1997-01-14 01:23:01 +00:00
Fergus Henderson
5c9cb18006 If double' is the same size as void *', then don't box floats.
Estimated hours taken: 2

If `double' is the same size as `void *', then don't box floats.

runtime/imp.h:
	Remove the unconditional `#define BOXED_FLOAT'.

runtime/conf.h.in:
	Add BOXED_FLOAT.
1996-12-13 00:02:04 +00:00
Tyson Dowd
cd22a7476d Create base_type_layout structures, which store information about how
Estimated hours taken: 50

Create base_type_layout structures, which store information about how
Mercury data is represented in memory.

runtime/type_info.h:
    Use USE_TYPE_TO_TERM to determine whether we are using type-to-term,
    rather than checking the offset of ARG_TYPE_INFOS.
    Set the offsets according to USE_TYPE_TO_TERM (presently #undefed).
    Add macros and defintions for constants used in layout tables.

runtime/imp.h:
    Add type_info.h to the list of standard #includes.
1996-12-09 13:51:53 +00:00
Fergus Henderson
2b68e79f1d Renamed aux.{c,h} as misc.{c,h}, because in Windows the name
Estimated hours taken: 0.5

runtime/*:
	Renamed aux.{c,h} as misc.{c,h}, because in Windows the name
	`aux' is reserved as the name of a device file.
1996-05-14 08:13:36 +00:00
Zoltan Somogyi
853c33fbf4 Put back the definitions of call_{det,semidet,nondet}_closure
Estimated hours taken: 0.1

imp.h:
	Put back the definitions of call_{det,semidet,nondet}_closure
	until the code generation changes have been reflected in all
	the installed compilers.
1996-04-24 10:02:52 +00:00
Zoltan Somogyi
b95bedb1f3 Removed the call_{det,semidet,nondet}_closure macros, since they are
Estimated hours taken: 0.2

imp.h:
	Removed the call_{det,semidet,nondet}_closure macros, since they are
	not needed anymore.

solutions:
	Use the new method of calling closures.

call.mod:
	Cosmetic changes.
1996-04-24 09:01:13 +00:00
Fergus Henderson
0b45949b04 Fix a bug in the definition of float_const for the
Estimated hours taken: 0.25

runtime/imp.h:
	Fix a bug in the definition of float_const for the
	USE_SINGLE_PREC_FLOAT case.
1996-04-06 22:05:21 +00:00
Fergus Henderson
e343cf50f0 Suppress a warning about no previous declaration for
Estimated hours taken: 0.1

runtime/imp.h:
	Suppress a warning about no previous declaration for
	hash_string() in aux.c.
1996-04-06 21:06:30 +00:00
Fergus Henderson
62d6d7ca50 Fix a problem with the definition of float_to_word and word_to_float
Estimated hours taken: 0.1

runtime/imp.h:
	Fix a problem with the definition of float_to_word and word_to_float
	for the case of USE_SINGLE_PREC_FLOAT; gcc didn't like the cast
	from Integer to union FloatWord - it wanted a cast from Integer
	to Word first.
1996-04-06 17:31:52 +00:00
Fergus Henderson
913cda0f4a Add inline assembler hacks for restoring the $gp register on the alpha,
Estimated hours taken: 24

Add inline assembler hacks for restoring the $gp register on the alpha,
to make the `asm_fast.gc' grade work on the alpha.

runtime/goto.h:
	For the alpha, change the GOTO macro so that it sets up
	register $27 (the "procedure value" register) to contain the
	address to which you are going to jump, and change the
	Define_{entry,local,static} macros so that they have a `ldgp'
	instruction after the label which restores the gp register from
	$27.

runtime/call.mod:
	For the alpha, change the call macro so that it uses a `ldgp'
	instruction to restore the gp register on return from a call.
	Add new call_localret macro, for the case when the continuation
	label is a local label (this is like the inverse of the localcall
	macro), because a call_localret is two instructions cheaper
	than the equivalent call would be.

runtime/engine.mod:
	In call_engine(), we need to use `Define_label(engine_done)'
	rather than just `engine_done:', so that it works on the alpha.

These changes improve the speed of the compiler by about 21%,
and cut executable size by about 24%.

There's still a fair bit of room for improving efficiency by
avoiding moves to $27 and `ldgp' instructions in situations
where they aren't needed.
1996-04-01 19:03:47 +00:00
Fergus Henderson
06d359d2d2 Fix a problem noticed by Andreas Kuehlmann.
Estimated hours taken: 0.25

Fix a problem noticed by Andreas Kuehlmann.

runtime/{imp.h,aux.c}:
	Define hash_string() as a function in aux.c unconditionally,
	even if we're not using gcc.  This avoids trouble when linking
	programs compiled with cc with a runtime library that was
	compiled with gcc.
1996-04-01 18:46:53 +00:00
Fergus Henderson
ac8c719bbe Fix a missing cast warning for the non-gcc version of hash_string().
Estimated hours taken: 0.25

runtime/{imp.h,aux.c}:
	Fix a missing cast warning for the non-gcc version of hash_string().
1996-03-30 09:30:18 +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
Zoltan Somogyi
fe2eb0323a Fix the byzantine inclusion relationship between prof.h and imp.h.
Estimated hours taken: 1

imp.h, prof.h:
	Fix the byzantine inclusion relationship between prof.h and imp.h.

prof.c:
	Fix the hashing function for code addresses so that it doesn't waste
	three quarters of the hash table.

	In each hash slot, use a binary search tree instead of an unordered
	list of entries. This can be expected to handle high loads better,
	which is necessary because the hash table size is not adaptive.
	(Making it adaptive would be a better fix.)

	Instead of turning signals off and on in the handler of profiling
	signals, simply set a volatile variable to detect cases when two
	profiling signals arrive too closely.
1996-03-24 06:40:57 +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
300df90c9a Fix a bug in the code for float_to_word() in non-gc grades:
Estimated hours taken: 0.75

runtime/imp.h:
	Fix a bug in the code for float_to_word() in non-gc grades:
	the part which was supposed to ensure correct alignment
	of floats allocated on the heap was not working correctly.
1996-03-19 09:14:24 +00:00
Fergus Henderson
505c3504f1 Move the C implementation of various builtins from the `runtime' directory
to inside pragma(c_code) declarations in the `library' directory sources.

runtime/{Mmake,{math,io}_rt.mod}:
	Remove math_rt.mod and io_rt.mod, since the code has been moved
	into `.m' files in the library directory.

runtime/main.mod:
	Remove this file, since it wasn't used.

runtime/imp.h:
	Add SUCCESS_INDICATOR as a macro for r1, for use by
	pragma_c_code.

Also a few minor unrelated changes:

runtime/imp.h:
	Avoid code duplication in hash_string macros.

runtime/tags.h:
	Use sizeof(Word) rather than WORD_SIZE (in this old code, the
	extra level of indirection only obfuscated things).

runtime/{aux.c,aux.h,prof.c}:
	Add some more #ifdefs to avoid including debugging/profiling
	code in the non-debugging/non-profiling version of the library.
1996-02-28 15:46:04 +00:00
Fergus Henderson
89d22843e4 Add type Char', to hold a Mercury char'.
Estimated hours taken: 0.25

runtime/imp.h:
	Add type `Char', to hold a Mercury `char'.
1996-02-03 14:18:02 +00:00
Fergus Henderson
d82309baad Add typedef of continuation function `Cont' for use with the
Estimated hours taken: 0.1

runtime/imp.h:
	Add typedef of continuation function `Cont' for use with the
	`--high-level-C' option.
1996-01-15 00:26:53 +00:00
Fergus Henderson
6e2801a6fe Fix problem on Linux where global register declarations occur after
Estimated hours taken: 0.5

Fix problem on Linux where global register declarations occur after
inline function definitions in system header files.

runtime/imp.h:
	Make sure that "reg.h" is the first header file included.
1995-12-28 03:57:36 +00:00
Fergus Henderson
e4e25c2cdf Suppress a spurious warning about `cast from pointer to integer
Estimated hours taken: 0.25

runtime/imp.h:
	Suppress a spurious warning about `cast from pointer to integer
	of different size' when compiling in a non-gc grade on the alpha.
1995-11-24 16:48:07 +00:00
Fergus Henderson
fe81c61efe Add `typedef char *String' which is now used by the C interface.
Estimated hours taken: 0.25

runtime/imp.h:
	Add `typedef char *String' which is now used by the C interface.
1995-11-24 01:21:33 +00:00
Fergus Henderson
a624d928c0 Add a couple of comments.
imp.h:
	Add a couple of comments.
1995-10-07 09:07:37 +00:00
Fergus Henderson
fd9798eb03 Oops, fix missing \ line continuations in macro.
imp.h:
	Oops, fix missing \ line continuations in macro.
	(This only showed up when compiling in a non-gc grade.)
1995-10-04 01:10:41 +00:00
Fergus Henderson
627831b89b When not using conservative GC, ensure appropriate alignment of
runtime/imp.h:
	When not using conservative GC, ensure appropriate alignment of
	floating point constants.  Also fix a couple of missing
	parentheses in the float_to_word macro.
1995-10-03 16:13:07 +00:00
Fergus Henderson
bf3df78c41 Add #include of <string.h> for strcmp().
runtime/imp.h:
	Add #include of <string.h> for strcmp().
	(This missing #include was not previously noted because gcc has
	a builtin-declaration for strcmp() - it only caused a warning
	when compiled with `-fno-builtin'.)
1995-09-09 01:58:07 +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
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
Zoltan Somogyi
ab52fbdeb0 Changed format fields to use %ld in most cases of printing integers.
aux.c, label.c:
	Changed format fields to use %ld in most cases of printing integers.

imp.h:
	Added a new type Uinteger.

list.c:
	This has been renamed dlist.c a long time ago.
1995-07-21 09:43:37 +00:00
Zoltan Somogyi
332db2aa35 Set up the type of Word at configuration time.
conf.h.in:
	Set up the type of Word at configuration time.

imp.h:
	Changed definition of Word. Also gathered two of the three
	definitions of hash_string into one place, defining a macro
	for use by aux.c.

aux.c:
	Use the macro in imp.h for the body of hash_string.

engine.mod:
	Minor formatting change.
1995-07-12 15:16:43 +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
Zoltan Somogyi
0f46c5d4e7 Merged in changes from the pass_str_branch. 1995-05-06 07:29:58 +00:00
Fergus Henderson
deec160d03 Implement solutions/2. (We still haven't implemented mode/determinism
checking for higher-order preds, though, so the compiler doesn't
diagnose errors correctly - if you use the wrong mode you will probably
just get a core dump.)
1995-04-18 03:57:05 +00:00
Fergus Henderson
6e8294eee2 Add incr_hp_atomic macro, which for USE_CONSERVATIVE_GC
imp.h:
	Add incr_hp_atomic macro, which for USE_CONSERVATIVE_GC
	invokes GC_MALLOC_ATOMIC() rather than GC_MALLOC().

io.mod:
	Use the new incr_hp_atomic() macro for allocating strings.
	Add implementations of string__index/2, string__length/2,
	and string__append/3.

Note - these changes sped up the compiler by nearly 40%!
1995-04-15 06:09:39 +00:00
Fergus Henderson
3fc5389b53 Add copyright notices.
runtime/*:
	Add copyright notices.
1995-03-30 21:57:11 +00:00