Commit Graph

67 Commits

Author SHA1 Message Date
Zoltan Somogyi
26caad3050 Remove type_ctor_layouts and type_ctor_functors where not needed.
Estimated hours taken: 8, plus about 12 hours by Tyson.

Remove type_ctor_layouts and type_ctor_functors where not needed.
Simplify type_ctor_layouts by removing code that generates (and
documentations for) particularly representations that are no longer used
now that we use type_ctor_reps.

Several files also had miscellaneous cleanups and documentation fixes,
the most important being the move of the type_ctor_info structures
for preds/funcs from runtime/mercury_type_info.c to library/builtin.m.

compiler/base_type_layout.m:
        Simplify documentation.

        Remove references to representations in type_ctor_layouts that
        are no longer used.compiler/base_type_layout.m:

compiler/base_type_info.m:
	Keep base_type_info__type_ctor_rep_to_int in sync with
	MR_TypeCtorRepresentation.

runtime/mercury_grade.h:
runtime/mercury_cpp.h:
	Move the definitions of MR_STRINGIFY and MR_PASTEn to the new file
	mercury_cpp.h. Add MR_PASTEn for several new values of n, for use by
	mercury_type_info.h.

runtime/mercury_type_info.h:
	Define macros for creating type_ctor_info structures for builtin types.
	These have NULL layout and functor fields.

	Remove several obsolete macros.

runtime/mercury_layout_util.c:
	Use the new macros for defining a dummy type_ctor_info.

runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
	Modify the implementation of some RTTI functions to use the layout
	and functors structures only if they are defined.

runtime/mercury_type_info.c:
	Modify MR_collapse_equivalences to use the type_ctor_rep, not the
	functors indicator, to check for equivalence, since the latter is
	not guaranteed to be present.

	Move the type_ctor_info structure for preds/funcs to builtin.m.

library/array.m:
	Use these macros to define the type_ctor_info structure for array.

library/builtin.m:
	Use these macros to define the type_ctor_info structure for int,
	float, character, string, saved succip etc values, and for preds
	and funcs.

library/private_builtin.m:
	Use these macros to define the type_ctor_info structure for type_infos,
	type_ctor_infos, typeclass_infos and base_typeclass_infos.

	Move a c_header_code to the section that needs it.

library/std_util.m:
	Use the new macros to define the type_ctor_info structure for univ
	and for std_util's own type_info type.

	Modify the implementations of some RTTI predicates to use the
	layout and functors structures only if they are defined.
2000-01-19 09:45:23 +00:00
Peter Ross
f87f9d2120 Ensure that the none.gc and none grades compile using a compiler
Estimated hours taken: 24

Ensure that the none.gc and none grades compile using a compiler
other than gcc.  This is not completely tested as lcc on linux can't
generate code for boehm_gc, and 'cc -std1' on the alpha runs out of
memory while trying to link the compiler.  However the compiler does
bootstrap using just gcc and also with lcc with boehm_gc compiled by
gcc.

configure.in:
    -Wl,opt1,opt2 syntax is not supported by lcc instead use -Wlopt1
    -Wopt2.

compiler/export.m:
    Only output a label declaration if that label is exported, as the
    static label declarations are not legal C.

library/io.m:
compiler/stack_layout.m:
    Replace escape sequence \x with \\x in pragma c code.

library/array.m:
library/std_util.m:
    Define what the struct is before using it, so the correct size for the
    struct can be calculated.

library/private_builtin.m:
    Replace escape sequence \x with \\x in pragma c code.
    Ensure that there is at least one local variable so that the
    structure definition for holding the local vars contains something.

runtime/mercury_faultaddr.h:
    Remove an unnecessary cast.

runtime/mercury_reg_workarounds.h:
    #include sys/time.h for FD_ZERO().

runtime/mercury_stack_trace.h:
    Remove an extraneous ',' which was causing warnings.
1999-11-25 09:09:46 +00:00
Zoltan Somogyi
e475da1d2c Put MR_ prefixes on uses of string_const(), make_aligned_string()
Estimated hours taken: 0.2

library/*.m:
	Put MR_ prefixes on uses of string_const(), make_aligned_string()
	variants, and COMPARE_EQUAL and friends, in order to allow bootstrap
	with -DMR_NO_BACKWARDS_COMPAT.
1999-11-15 10:12:19 +00:00
Fergus Henderson
1249efcde0 Fix gcc 2.95 warnings about "non-static declaration follows static".
Estimated hours taken: 0.5

library/array.m:
library/builtin.m:
library/private_builtin.m:
library/std_util.m:
runtime/mercury_bootstrap.c:
runtime/mercury_memory_zones.c:
	Fix gcc 2.95 warnings about "non-static declaration follows static".
1999-11-14 23:23:19 +00:00
Tyson Dowd
581a89622e Add version information to type_ctor_infos.
Estimated hours taken: 1.5

Add version information to type_ctor_infos.  This way bootstrapping is
easier and binary compatibility can be broken more slowly.

RTTI code can check version numbers before performing operations on
data structures that have recently changed their representation.
At the least they can abort cleanly and let you know that it's time
to re-compile, at best they can handle both forms of the data structure.
It is a bootstrapping problem that currently there is no version number
information in the appropriate slot in pre-built systems.

The version numbers start at 2 simply because 2 "occurs naturally"
much less often than 1 or 0.  And 42 was becoming trite.

compiler/base_type_info.m:
	Generate RTTI version numbers in compiler-generated
	type_ctor_infos.

library/builtin.m:
library/private_builtin.m:
library/std_util.m:
runtime/mercury_bootstrap.c:
runtime/mercury_type_info.c:
	Add RTTI version numbers for handwritten type_ctor_infos.

runtime/mercury_type_info.h:
	Add MR_RTTI_VERSION to define the current version of the RTTI
	info and the first version: MR_RTTI_VERSION_INITIAL which
	happens to have the value of 2.
1999-10-20 07:03:23 +00:00
Fergus Henderson
88a513b580 Reorganize the routines for allocating and deallocating memory:
Estimated hours taken: 8

Reorganize the routines for allocating and deallocating memory:

runtime/mercury_std.h:
runtime/mercury_misc.c:
runtime/mercury_memory.h:
runtime/mercury_memory.c:
	- Put the routines in the proper place.
		Previously the declarations and definitions of the memory
		allocation/deallocation routines were spread amoungst
		all four of these files; I moved the ones in mercury_std.h
		and mercury_misc.c so that they are now all defined
		in mercury_memory.{h,c}
	- Avoid unnecessary duplication
		The following routines did exactly the same thing,
		modulo bugs(!):
			allocate_bytes()	and newmem()
			deallocate_bytes()	and oldmem()
			make()			and allocate_object()
			make_many()		and allocate_array()
	- Use appropriate names.
		I added `MR_' prefixes, and ensured that macros that are not
		function-like macros use all uppercase.  I also used a more
		consistent naming scheme.
		Previously the names used were
			(1) checked_malloc, checked_realloc
			(2a) allocate_bytes, deallocate_bytes, reallocate_bytes,
				allocate_object, allocate_array, resize_array
			(2b) newmem, oldmem, resizemem,
				make, make_many, resize_many
		The new names are
			(1) MR_malloc, MR_free, MR_realloc,
				MR_NEW, MR_NEW_ARRAY, MR_RESIZE_ARRAY
			(2) MR_GC_malloc, MR_GC_free, MR_GC_realloc,
				MR_GC_NEW, MR_GC_NEW_ARRAY, MR_GC_RESIZE_ARRAY

runtime/*.[ch]:
trace/*.[ch]:
library/array.m:
library/benchmarking.m:
library/io.m:
library/std_util.m:
extras/odbc/odbc.m:
extras/aditi/aditi.m:
	Use the new names.
1999-10-18 15:47:39 +00:00
Fergus Henderson
bbdf5229ec Change the documentation to suggest using CFLAGS rather than
Estimated hours taken: 0.1

library/array.m:
	Change the documentation to suggest using CFLAGS rather than
	MGNUCFLAGS for `-DML_OMIT_ARRAY_BOUNDS_CHECKS'.
1999-10-15 21:08:17 +00:00
Fergus Henderson
1f01db85bc Fix problems that broke the jump' and fast' grades.
Estimated hours taken: 3

Fix problems that broke the `jump' and `fast' grades.

library/builtin.m:
library/private_builtin.m:
library/array.m:
library/std_util.m:
	Use MR_MAYBE_STATIC_CODE() in initializers for type_ctor_infos,
	to avoid a compilation error when code addresses are not valid
	initializers.  Call MR_INIT_TYPE_CTOR_INFO() to ensure that the
	type_ctor_infos for c_pointer, type_info, type_ctor_info,
	typeclass_info, base_typeclass_info, array, and univ are
	initialized at runtime if they can't be initialized statically.
1999-10-13 07:01:29 +00:00
Zoltan Somogyi
bca4cb8162 Make the entire Mercury system bootstrap without backwards compatbility.
Estimated hours taken: 12

Make the entire Mercury system bootstrap without backwards compatbility.

compiler/llds_out.m:
compiler/pragma_c_gen.m:
	Add MR_ prefixes on generated code.

library/builtin.m:
library/exception.m:
library/private_builtin.m:
library/std_util.m:
library/store.m:
	Add MR_ prefixes.

runtime/mercury_deep_copy_body.h:
runtime/mercury_heap.h:
runtime/mercury_stacks.h:
runtime/mercury_string.h:
runtime/mercury_tags.h:
runtime/mercury_type_info.h:
	Add MR_ prefixes.

runtime/mercury_bootstrap.c;
runtime/mercury_engine.c;
runtime/mercury_ho_call.c;
runtime/mercury_tabling.c;
runtime/mercury_trace_base.c;
runtime/mercury_type_info.c;
runtime/mercury_wrapper.c;
	Add MR_ prefixes. In some cases, fix indentation; in functions using
	four-space indentation, convert all tabs to spaces.

trace/mercury_trace_browse.m:
trace/mercury_trace_declarative.m:
trace/mercury_trace_external.m:
trace/mercury_trace_help.m:
	Add MR_ prefixes.
1999-09-27 05:20:58 +00:00
Warwick Harvey
3b26c80e4e Changed all type_ctor_info structures to use the MR_TypeCtorInfo type.
Estimated hours taken: 16

Changed all type_ctor_info structures to use the MR_TypeCtorInfo type.  This
is primarily to reduce the number of conflicts when merging independent
changes to the type_ctor_info structures.  As part of this, changed the type
of `string_const' to be `String' rather than `Word *', to avoid type errors
in the initialisers for compiler-generated type_ctor_infos.

compiler/llds_out.m:
	Don't emit definitions for type_ctor_info structs; instead use
	`MR_TypeCtorInfo_struct'.
	Removed a couple of casts of `string_const's to type `String', since
	they are no longer necessary.

compiler/llds.m:
	Changed the entries for `string_const' and `multi_string_const' in
	llds__const_type/2 to be `string' rather than `data_ptr'.

library/array.m:
library/builtin.m:
library/private_builtin.m:
library/std_util.m:
runtime/mercury_bootstrap.c:
runtime/mercury_type_info.c:
	Changed all the hand-defined type_ctor_info structures to just use
	`MR_TypeCtorInfo_struct', and added appropriate casts to the
	initialisers.  This included removing what appears to have been the
	last vestiges of `USE_TYPE_LAYOUT' conditionals since their use was
	so broken that it would probably be easier to re-implement the same
	functionality from scratch than to debug and rebuild on what was left.

runtime/mercury_type_info.h:
	Introduced `struct MR_TypeCtorInfo_struct' as the name of the
	(previously anonymous) struct which `MR_TypeCtorInfo' was a pointer
	to.
	Introduced `MR_DECLARE_TYPE_CTOR_INFO_STRUCT' for declaring
	type_ctor_info structures, since `MR_DECLARE_STRUCT' generates
	old-style names for type_ctor_infos.

runtime/mercury_deep_copy.c:
runtime/mercury_tabling.c:
library/std_util.m:
extras/exceptions/exception.m:
	Changed some uses of `MR_DECLARE_STRUCT' to use
	`MR_DECLARE_TYPE_CTOR_INFO_STRUCT' instead.

runtime/mercury_bootstrap.h:
	Added some `#define's of some old type_ctor_info type names to be
	`MR_TypeCtorInfo_struct', so that during bootstrapping the type
	names generated by the old version of the compiler work with the new
	scheme used in the manual definitions.

runtime/mercury_string.h:
	Changed the type of the macro `string_const/2'.  It used to cast to
	`Word *', now it casts to `String'.
1999-08-12 09:58:49 +00:00
Fergus Henderson
65782f9925 Add functions for the single output det predicates in a number
Estimated hours taken: 5

[This change was by Ralph Becket.
I'm just the person who reviewed it and committed it.  -fjh.]

Add functions for the single output det predicates in a number
of modules in the standard library.  Basically, for each

	:- pred f(in, ..., in, out) is det.

I have added the declaration

	:- func f(in, ..., in) = out.

and definition

	f(X1, ..., Xn) = Y :-
		f(X1, ..., Xn, Y).

library/char.m:
library/dir.m:
library/map.m:
library/string.m:
library/list.m:
library/set.m:
	Make the changes described above.

library/array.m:
	As above, except array input modes are all array_ui or
	array_di as appropriate and array output modes are array_uo.

library/int.m:
	Added forward versions of +/2, */2 and -/2 as plus/2, times/2
	and minus/2 respectively, to make it easier to pass these
	as arguments to higher-order predicates.
	Also added func constants for max_int, min_int and bits_per_int.

library/integer.m:
	Replaced local functions for list head, tail and length with
	calls to equivalent functions now defined in list.m.

library/io.m:
	Added func for error_message/2.

library/list.m:
	Add functions det_head/1 and det_tail/1 which abort on null lists.

library/set.m:
	Add functions map/2, filter_map/2 and fold/3.

library/std_util.m:
	Added utility function to construct a pair object from its
	arguments and general purpose higher order functions for
	partial functions and for function composition, exponentiation
	and exchanging the arguments of a binary function.
1999-07-07 15:19:42 +00:00
Tyson Dowd
eae3174a2c Add MR_TYPECTOR_REP_* to the type_ctor_info to describe the
Estimated hours taken: 30  (including debugging)

Add MR_TYPECTOR_REP_* to the type_ctor_info to describe the
representation of this type.

We want to do this because it allows us to check quickly to see
what kind of data representation is being used.  Previously this
information was spread throughout the type_ctor_layout and
type_ctor_functors data structures.  It was complex to interpret
and contained a lot of unnecessary duplication.

We can now omit data structures such as the type_ctor_layout in many
cases (it is only necessary for discriminated unions).  Because we rule
out some of the possible alternatives, the encodings used in the
type_ctor_layout can be simplified.  Also, the functors indicator in
type_ctor_functors can be removed, as it subsumed by this data
structure.

Use this representation in code that uses RTTI.

compiler/base_type_info.m:
	Add a missing alternative to the type_ctor_rep (this was a
	bug).

library/array.m:
library/builtin.m:
library/private_builtin.m:
runtime/mercury_bootstrap.c:
	Use MR_TYPECTOR_REP_* in the type_ctor_infos for builtin types.

library/std_util.m:
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
	Use MR_TYPECTOR_REP_* and MR_DISCUNION_TAG_* to dispatch on
	data representations.

	Also, fix a bug in deep_copy when copying floating point values.
	I'm not sure when this stopped working, or if this is exactly
	the right fix, but it is more correct than the previous code.

runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
	Update code to use MR_TYPECTOR_REP_*.
	Use a struct for type_ctor_info.

tests/hard_coded/Mmakefile:
tests/hard_coded/deep_copy.m:
tests/hard_coded/deep_copy.exp:
	Add a test case for deep_copy.
1999-07-06 06:32:33 +00:00
Tyson Dowd
3ecbe3eed0 Move the type_ctor_infos for array and univ into their proper places.
Estimated hours taken: 0.5

Move the type_ctor_infos for array and univ into their proper places.
This change has bootstrapped on most of our platforms, but actually
causes trouble linking small programs (because it creates runtime ->
library dependencies).  So we should move it as soon as possible.


library/array.m:
library/std_util.m:
	Add type_ctor_info for array and univ.

runtime/mercury_bootstrap.c:
	Remove type_ctor_info for array and univ.
1999-06-02 10:05:08 +00:00
Zoltan Somogyi
c6812299c2 Remove support for --args simple. We don't use it, we won't use it even for
Estimated hours taken: 4.5

Remove support for --args simple. We don't use it, we won't use it even for
experiments, and it is unnecessary complication.

If anybody were using --args simple, this would need bootstrapping, but
since nobody does, there is no need, and this can be committed as an
ordinary change.

compiler/options.m:
doc/user_guide.texi:
scripts/*.in:
scripts/*.sh-subr:
	Remove the --args option.

compiler/globals.m:
	Remove the args_method global and its access predicates.

compiler/handle_options.m:
	Don't set the args_method global from the option.

compiler/arg_info.m:
	Remove support for --args simple. This allows us to remove a now
	redundant argument from an exported predicate.

compiler/mercury_compile.m:
	Remove the code for passing -DCOMPACT_ARGS to the C compiler.

compiler/bytecode_gen.m:
compiler/fact_table.m:
compiler/follow_vars.m:
compiler/live_vars.m:
compiler/call_gen.m:
	Don't pass the unnecessary argument to arg_info.

compiler/call_gen.m:
compiler/unify_gen.m:
	Remove now unnecessary assertions.

compiler/hlds_pred.m:
	Don't include an args_method in proc_infos; instead, include
	a slot that says whether the procedure's address is taken or not.
	(In most cases, this determined whether the args_method was
	simple or compact.) We will need this bool in the near future
	(when we generate layout structures for procedures whose address
	is taken).

	Modify the signatures of exported predicates to accommodate
	this change to the data structure.

compiler/hlds_out.m:
	Print the new slot, not the args_method.

compiler/lambda.m:
	When creating procedures from lambdas, set the address-taken slot
	to address_is_taken instead of setting up its args_method.

compiler/make_hlds.m:
	Minor changes to conform to the changes in the signatures of
	the predicates exported from hlds_pred.m.

compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/dnf.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/modecheck_call.m:
compiler/pd_info.m:
compiler/post_typecheck.m:
compiler/unify_gen.m:
	Minor changes to conform to the changes in the signatures of
	the predicates exported from hlds_pred.m and make_hlds.m.

runtime/mercury_type_info.h:
	Remove the conditional definition of the macros that provided
	an argument-method-independent way of referring to the registers
	holding the inputs and outputs of e.g. unification procedures.
	We don't need the independence anymore, and using registers instead
	of macros in the code ensures that maintainers are aware of register
	reuse issues (e.g. they copy an input from r1 before overwriting it
	with an output).

runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
	Remove support for the args method component of the grade.

runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
library/*.m:
	Conform to the changes in runtime/mercury_type_info.h by effectively
	applying the #defines appropriate to compact args by hand.

	Remove code and data structures only needed for simple args.
	Remove comments needed only in the presence of uncertainty about
	the args method.
1999-06-01 09:46:20 +00:00
Thomas Conway
c61457da91 Add a new predicate to array.m: array__map.
Estimated hours taken: 0.4


Add a new predicate to array.m: array__map.

NEWS:
	mention the new predicate.

library/array.m:
	add the new predicate array__map/3.
1999-03-31 04:42:49 +00:00
Tyson Dowd
1f312b45e9 During the writing of the RTTI paper, we decided that type_ctor_info
Estimated hours taken: 8

During the writing of the RTTI paper, we decided that type_ctor_info
was a much better name than base_type_info.

Rename base_type* as type_ctor*, except we don't rename the modules
base_type_info and base_type_layout just yet.

Most of these changes were made using the following sed patterns:

s/base_type_info/type_ctor_info/g
s/base_type_layout/type_ctor_layout/g
s/base_type_functors/type_ctor_functors/g
s/BASETYPE_INFO/TYPE_CTOR_INFO/g
s/TYPEFUNCTORS/TYPE_CTOR_FUNCTORS/g
s/TYPELAYOUT/TYPE_CTOR_LAYOUT/g
s/BASE_TYPEINFO/TYPE_CTOR_INFO/g
s/BASE_TYPE_INFO/TYPE_CTOR_INFO/g
s/BaseTypeInfo/TypeCtorInfo/g
s/BaseTypeLayout/TypeCtorLayout/g
s/base_type(/type_ctor(/g
s/:- module type_ctor_info/:- module base_type_info/g
s/:- module type_ctor_layout/:- module base_type_layout/g
s/type_ctor_info__/base_type_info__/g
s/type_ctor_layout__/base_type_layout__/g
/import_module/s/type_ctor_info/base_type_info/g
/import_module/s/type_ctor_layout/base_type_layout/g

compiler/*.m:
library/*.m:
runtime/*.{c,h}:
profiler/demangle.m:
util/mdemangle.c:
	Applied the above sed commands.

runtime/mercury_bootstrap.h:
	Add bootstrapping #defines so the type_ctor_* substitutions in
	the library don't cause link problems.

	Delete some redundant bootstrapping definitions.
1999-03-22 08:09:08 +00:00
Tyson Dowd
8ff682c9d7 Correct a comment: the name of the header file which contains the
Estimated hours taken: 0.1

library/array.m:
	Correct a comment: the name of the header file which contains the
	array definition is wrong.
1998-12-04 04:41:09 +00:00
Zoltan Somogyi
085c8b8113 Make it possible to compile a module (e.g. std_util) without debugging,
Estimated hours taken: 18

Make it possible to compile a module (e.g. std_util) without debugging,
while still allowing debuggable code called from that module via higher-order
predicates (e.g. solutions) to have a proper stack trace.

compiler/options.m:
	Add the new option --stack-trace-higher-order.

compiler/mercury_compile.m:
	Always invoke continuation_info and stack_layout, since it is no
	longer the case that either all procedures or none get layout
	structures generated for them, and the other modules are in a better
	position to make that decision.

compiler/continuation_info.m:
	Handle the extra tests required by the change to mercury_compile.m.

	When we gather info about a procedure, remember whether that
	procedure must have a procedure layout that includes the procedure id
	section.

compiler/stack_layout.m:
	Use the flag remembered by continuation_info to help decide
	whether we need procedure layout structures.

	Fix an old space wastage: after generating marker saying that
	the second and later groups of fields of a procedure layout are
	not present, do not generate another marker saying that the
	third group of fields is not present. Since it was in the wrong
	position, it did not have the right meaning; it only worked because,
	due to the presence of the first marker, it was never looked at anyway.

compiler/code_gen.m:
	Use the new capability of continuation_info.m to require
	procedure layouts including procedure id sections for any predicate
	that has higher-order arguments, if --stack-trace-higher-order is set.

compiler/globals.m:
	Rename want_return_layouts as want_return_var_layouts, since this
	is a more accurate representation of what the predicate does.

compiler/call_gen.m:
compiler/code_info.m:
	Conform to the change in globals.m.

compiler/llds_out.m:
	Separate the c_modules containing compiler-generated code into two
	groups, those that define labels that have stack layouts and those
	that don't. In most cases one or the other category will be empty,
	but with --stack-trace-higher-order, the c_modules containing
	higher-order procedures will have stack layouts, while others will
	not.

	Reorganize the way the way the initialization functions are generated,
	by putting c_modules falling into different categories into different
	bunches. c_module falling into the first category always have their
	initialization code included, while those in the second category
	have it included only if the old flag MR_MAY_NEED_INITIALIZATION
	is set.

	Delete the obsolete #define of MR_STACK_TRACE_THIS_MODULE.

	Improve some predicate names, in an effort to prevent confusion
	about what a "file" is (since the code uses more than one meaning,
	given the presence of --split-c-files).

compiler/pragma_c_gen.m:
	Fix an old bug: s/NONDET_FIXED_SIZE/MR_NONDET_FIXED_SIZE/.
	Required for the change to library/string.m.

doc/user_guide.texi:
	Document the new option.

runtime/mercury_goto.c:
	Simplify the conditions under which labels get added to the label
	table with:

	- The macros init_{entry,label,local}_ai always add
	the label to the label table without a layout structure.

	- The macros init_{entry,label,local}_sl always add it with a layout
	structure.

	- Whether the macros init_{entry,label,local} with no suffix
	add the label to the label table depends on the values of other
	configuration parameters, but they will never include a layout
	structure.

	The intended use is that any label that has a layout structure should
	be initialized with a _sl macro. Any other label that should always
	be in the label table if the label table is needed at all (labels
	such as do_fail) should be initialized with _ai. Everything else
	should be initialized with a suffixless macro.

runtime/mercury_conf_params.c:
	Remove MR_USE_STACK_LAYOUTS and MR_STACK_TRACE_THIS_MODULE, since
	due to the simplification of mercury_goto.h, they are not used anymore.

runtime/mercury_stack_layout.h:
	Remove the old macros for creating layout structures with bogus
	contents, and replace them with new macros for creating layout
	structures with meaningful contents.

runtime/mercury_engine.c:
runtime/mercury_wrapper.c:
	Remove bogus layout structures. Ensure the labels defined here
	always get into the label table.

runtime/mercury_ho_call.c:
	Remove bogus layout structures. Add proper ones where necessary.

runtime/mercury_bootstrap.c:
runtime/mercury_type_info.c:
	Remove bogus layout structures.

runtime/mercury_boostrap.h:
	Add this new file for bootstrapping purposes.

	Temporarily #define NONDET_FIXED_SIZE as MR_NONDET_FIXED_SIZE, since
	pragma_c_gen.m refers to the former until the update to it gets
	installed.

runtime/Mmakefile:
	Add a reference to mercury_boostrap.h.

library/builtin.m:
	Remove bogus layout structures.

library/array.m:
library/benchmarking.m:
library/private_builtin.m:
	Remove bogus layout structures. Add proper ones.

library/std_util.m:
	Remove bogus layout structures. Add proper ones.

	Replace references to framevar(n) with references to MR_framevar(n+1).

	Fix an old bug in code under #ifndef COMPACT_ARGS: in the
	implementation of mercury____Compare___std_util__univ_0_0_i1, the
	succip register was not being saved across the call to
	mercury__compare_3_0.

library/string.m:
	Remove the need for bogus layout structures, by converting the
	implementation of string__append(out, out, in) from hand-written
	C module into nondet pragma C code.
1998-11-05 03:53:34 +00:00
Fergus Henderson
abd526580f Another fix to my change to ensure that the declarations and definitions
Estimated hours taken: 0.5

Another fix to my change to ensure that the declarations and definitions
for data constants specify the same linkage (extern or static).
This one is needed to make it work with --split-c-files.

runtime/mercury_goto.h:
	Add an `MR_' prefix to the MODULE_STATIC_OR_EXTERN.

library/array.m:
library/builtin.m:
library/std_util.m:
extras/clpr/cfloat.m:
	Use MR_MODULE_STATIC_OR_EXTERN instead of `static' on the hand-coded
	definitions of the base_type_functors and base_type_layouts for
	builtin types.
1998-09-04 11:26:10 +00:00
Fergus Henderson
eb580a2609 Ensure that the declarations and definitions for data constants
Estimated hours taken: 3

Ensure that the declarations and definitions for data constants
specify the same linkage (extern or static), because the C standard
says that if the linkage is different, then the behaviour is undefined.
This bug resulted in undefined symbol link errors for the RS/6000 AIX port.

compiler/llds_out.m:
	When printing out declarations for data constants,
	compute the linkage from the data_name, rather than
	always assuming `extern'.  When printing out definitions,
	add a sanity check to ensure that the linkage that would be
	computed from the data_name is the same as the linkage used
	for the definition.

compiler/base_type_info.m:
	Make base_type_infos always exported from the module, never local.
	This is necessary to ensure that the linkage can be
	computed from the data_name.

compiler/base_type_layout.m:
	Make base_type_functors and base_type_info structures
	always local to the module, rather than exported.
	This is necessary to ensure that the linkage can be
	computed from the data_name.

library/array.m:
library/builtin.m:
library/std_util.m:
	Add `static' to the hand-coded definitions of the base_type_functors
	and base_type_layouts for builtin types.

compiler/base_typeclass_info.m:
compiler/llds.m:
compiler/stack_layout.m:
	Add comments pointing to the new predicate linkage/2 in
	llds_out.m, to ensure that future maintenance doesn't break
	the assumptions it makes.
1998-09-03 11:13:53 +00:00
Thomas Conway
e5e42d0184 Improve the multi-threaded execution support.
Estimated hours taken: 1.5

Improve the multi-threaded execution support.

runtime/mercury_context.{c,h}:
	Move the code for runnext from the .h file to the .c file -
	it is reasonably large (in the thread_safe grades) so avoiding
	the duplication is handy. It also makes debugging much easier!

	Also, make scheduling a context as runnable append it to the
	end of the runqueue, rather than consing it to the front. This
	yeilds more useful behaviour for concurrent code that wants to
	yeild in favour of any other runnable context.

library/math.m:
library/string.m:
library/io.m:
	Add thread_safe to the flags for a whole bunch of predicates and
	functions that are thread-safe.
1998-08-24 04:47:03 +00:00
Thomas Conway
d6798de1c9 Convert
Estimated hours taken: 0.5

library/*.m:
	Convert
		:- pragma(c_code, ...
	to
		:- pragma c_code(...

	and introduce will_not_call_mercury in places where it is implicit
	(this is in preparation for changing the default to may_call_mercury).
1998-08-03 00:19:49 +00:00
Zoltan Somogyi
67d8308260 Same as previous message. 1998-04-08 11:36:13 +00:00
Thomas Conway
a233f22598 mention the changes to map and tree234.
Estimated hours taken: 0.5

NEWS:
	mention the changes to map and tree234.

library/map.m:
	added map__foldl/4 and map__map_values/3 which forward to the
	corresponding predicates in tree234.

library/tree234.m:
	implement tree234__foldl and tree234__map_values.
1998-03-31 23:16:29 +00:00
Tyson Dowd
b53dc4132f Fix comments about bounds checking - the "maximum" performance
Estimated hours taken: 0.2

library/array.m:
	Fix comments about bounds checking - the "maximum" performance
	recommendation can be improved by compiling the entire
	module with bounds checking off, not just the bits that
	get intermodule-optimized.
1998-01-30 05:59:40 +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
Tyson Dowd
f9170a0563 Add library and runtime support for stack layouts.
Estimated hours taken: 30

Add library and runtime support for stack layouts.

library/array.m:
library/benchmarking.m:
library/mercury_builtin.m:
library/std_util.m:
library/string.m:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_type_info.c:
	Add MR_MAKE_STACK_LAYOUT_* macros to add basic stack layouts for
	handwritten C code.

runtime/mercury_type_info.c:
	Remove some duplicate label declarations.

runtime/mercury_calls.h:
	Don't use ASM_FIXUP_REGS in calls with NATIVE_GC - we don't
	want (or need) to use it. We define all labels as entry labels
	anyway, so an ASM_FIXUP_REGS is done at each label.

runtime/mercury_label.c:
runtime/mercury_label.h:
runtime/mercury_goto.h:
	Insert references to stack layouts into the label table.
	Use the label table when NATIVE_GC is defined.
	Modify the way labels are declared so they have the necessary
	scope.

runtime/mercury_imp.h:
	Include mercury_accurate_gc.h

runtime/mercury_accurate_gc.h:
	Add some macros to define stack layouts for handwritten
	code, and access various fields of the stack layouts.

util/mkinit.c:
	Add NATIVE_GC to the #ifdef .... that controls the running of
	the initialization code for each module. NATIVE_GC requires the
	label table to be initialized.
	Fix this code so the two instances of this list of #defines are
	replaced by a single string constant. I've been bitten _twice_
	by this double definition, and I refuse to be bitten again.

compiler/stack_layout.m:
	Rename MR_LIVE_LVAL to Mr_Live_Lval in the documentation.
1997-12-03 07:05:13 +00:00
Fergus Henderson
8f3eaa6835 Put code for array bounds checking inside
Estimated hours taken: 0.25

library/array.m:
	Put code for array bounds checking inside
	`#ifndef ML_OMIT_ARRAY_BOUNDS_CHECKS', so that the user
	can disable array bounds checking.
1997-11-02 12:30:23 +00:00
Fergus Henderson
06e476c165 A few small changes towards supporting backtrackable destructive update
Estimated hours taken: 1

A few small changes towards supporting backtrackable destructive update
better.

library/mercury_builtin.m:
	Add new insts mdi/1 and mostly_dead/0.

library/array.m:
	Change the name of the inst for unique arrays
	from `array' to `uniq_array' (someone got over-enthusiastic
	with global search and replace when uniq_array.m was
	renamed array.m).
	Add insts for non-unique arrays and mostly-unique arrays.

library/bt_array.m:
	Add a comment.
1997-09-06 18:23:40 +00:00
Fergus Henderson
77c26e442f Wrap a long line, to avoid a formatting problem in the
Estimated hours taken: 0.1

library/array.m:
	Wrap a long line, to avoid a formatting problem in the
	printed library reference manual.
1997-07-28 12:07:36 +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
5fa09a81be Move `:- import_module std_util' declaration into the
Estimated hours taken: 0.1

library/array.m:
	Move `:- import_module std_util' declaration into the
	interface, since it's needed there for the type `maybe(T)'
	used by array__bsearch.
1997-07-27 12:38:15 +00:00
Fergus Henderson
fd804f25ef Fix a warning: remove unnecessary `:- import_module term'.
Estimated hours taken: 0.1

library/array.m:
	Fix a warning: remove unnecessary `:- import_module term'.
1997-07-26 20:00:47 +00:00
Fergus Henderson
016519938d Remove definitions for type_to_term and term_to_type for arrays.
Estimated hours taken: 0.25

library/array.m:
	Remove definitions for type_to_term and term_to_type for arrays.
	That is now done in term.m.
1997-07-26 10:14:14 +00:00
Andrew Bromage
c485413c8c The main purpose of this change is to rename array.m as bt_array.m, and
Estimated hours taken: 6

The main purpose of this change is to rename array.m as bt_array.m, and
uniq_array.m as array.m.  The interfaces of those two modules have grown
slightly so that they match a little more closely.  Details are in the
file NEWS.

The implementation of bt_array (formerly array) has been changed to use
a slightly more efficient implementation.

NEWS:
	Interface changes documented.

library/array.m:
library/bt_array.m:
	Changes mentioned above and detailed in the NEWS file.

library/uniq_array.m:
	Bereft of life and resting in peace.

library/io.m:
library/library.m:
library/std_util.m:
library/term.m:
compiler/base_type_layout.m:
runtime/deep_copy.c:
runtime/type_info.h:
	Minor changes to fix the special case of base_type_layout
	operations for arrays rather than uniq_arrays.

tests/hard_coded/write.exp:
tests/hard_coded/write.m:
	Test writing of arrays.

tests/general/array_test.exp:
tests/general/array_test.m:
	Test some array/bt_array operations.
1997-07-25 05:15:17 +00:00
Tyson Dowd
cbcb23d17b Enable --warn-interface-imports by default.
Estimated hours taken: 3

Enable --warn-interface-imports by default. This was turned off while
list and term were defined in mercury_builtin.m, since it caused many
warnings.

Fix all the unused interface imports that have been added since then.

compiler/options.m:
	Enable --warn-interface-imports by default.

compiler/module_qual.m:
	Fix formatting inconsistencies with module names in warning
	messages. (".m" was not appended to module names if there was
	only one module).

compiler/*.m:
library/*.m:
tests/invalid/type_loop.m:
tests/warnings/*.m:
	Remove usused interface imports, or move them into
	implementation (mostly bool, list and std_util).
1997-05-21 02:16:53 +00:00
Fergus Henderson
915c78a626 Remove an obsolete comment about call/N not supporting procedures
Estimated hours taken: 0.25

library/array.m:
library/uniq_array.m:
	Remove an obsolete comment about call/N not supporting procedures
	with output arguments preceding input arguments.
1997-05-06 07:47:30 +00:00
Andrew Bromage
cb84bd7b64 Fixed some stuff in array.m.
Estimated hours taken: Not much at all. :-)

Fixed some stuff in array.m.

library/array.m:
	Moved array__fetch_items into the interface.  Some general
	cleanups of the documentation.
1995-10-29 03:55:13 +00:00
Andrew Bromage
6956d4dfe2 Added array__bsearch.m 1995-10-09 01:57:04 +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
21fd6b777d Fix NU-Prolog incompatibility: `X1 is X+1' must be written
library/array.m:
	Fix NU-Prolog incompatibility: `X1 is X+1' must be written
	as `X1 is X + 1'.
1995-05-26 05:53:31 +00:00
Andrew Bromage
a491eb4885 Added array__semidet_lookup. 1995-05-25 04:35:02 +00:00
Andrew Bromage
87940a2ce5 The new array module. 1995-05-25 01:39:43 +00:00
Andrew Bromage
8fb60b9b54 Fixed bug in array 1995-05-24 05:32:21 +00:00
Andrew Bromage
438aa27bfa Zero-length arrays now allowed 1995-05-24 05:30:09 +00:00
Fergus Henderson
93a755d563 Add copyright notices.
library/*:
	Add copyright notices.
1995-03-28 16:19:34 +00:00
Fergus Henderson
a38c689f1d Insert a missing `:- interface' declaration.
array.nl:
	Insert a missing `:- interface' declaration.
1995-01-18 11:36:08 +00:00
Thomas Conway
6a2c0aad85 array.nl : fix the bug fjh pointed out
inlining.nl:	minor bugfix.
1995-01-06 22:33:39 +00:00
Fergus Henderson
d8c9479872 Override the MERCURY_LIB_OBJS variable when invoking ml.
Makefile.mercury:
	Override the MERCURY_LIB_OBJS variable when invoking ml.
	This avoids some bootstrapping problems.
	Also, add mercury_compile.nu.

Makefile.common:
	Bump NU-Prolog's -u option up to 2000 (8M), to avoid some memory
	problems.

array.nl, bintree.nl, char.nl, dir.nl, globals.nl, list.nl, map.nl, modes.nl,
prog_util.nl, stack.nl, std_util.nl, string.nl, term.nl:
	Avoid the use of implied modes.

code_info.nl, bimap.nl, make_hlds.nl, mercury_compile.nl,
mercury_to_mercury.nl, unify_proc.nl:
	Fix determinism errors which had previously not been discovered
	because of either implied modes or running out of memory.
	(Note that I had to change the interface to bimap__lookup, since
	it's not possible to make it bidirectional.)

code_util.nl, llds.nl, opt_debug.nl, value_number.nl:
	Rename `operator' as `binary_op'.

hlds.nl, code_info.nl, unify_gen.nl, llds.nl, opt_debug.nl, switch_gen.nl:
	*** Handle simple cases of higher-order pred terms. ***
	(We don't yet handle taking the address of an overloaded
	predicate or a predicate with multiple modes.
	We don't handle closures.  call/1 and call/N are not yet implemented.
	This has not yet been tested.)

make_hlds.nl:
	Modify the mode priority ordering so that semidet modes get
	selected before det ones.

llds.nl:
	Don't include the priority part of the mode number in the mangled
	label name.  *** Note: this will break some things! ***

mercury_compile.nl:
	Move the NU-Prolog hacks into mercury_compile.nu.nl.

switch_gen.nl:
	Fix a simple logic bug in handling the grab/slap of the code_info.

prog_io.nl, builtins.nl, int.nl:
	Fix bugs and omissions with handling of the new arithmetic operators.

prog_io.nl:
	As a quick hack, strip off calls to io__gc_call
	(this avoids spurious error messages which are due to
	the fact that we don't get mode analysis right in those cases).
1994-10-02 17:00:57 +00:00