mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 05:12:33 +00:00
d256d24ea57b79c9cf91a6fc83f882cd50a147d1
80 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
afaea7c1ba |
Fix the condition protecting the definition of MR_GC_MALLOC_INLINE,
Branches: 11.07, main runtime/mercury.h: Fix the condition protecting the definition of MR_GC_MALLOC_INLINE, since we are calling the Boehm collector directly we require MR_BOEHM_GC to be defined, not just MR_CONSERVATIVE_GC. MR_GC_MALLOC_ATOMIC does not exist; use GC_MALLOC_ATOMIC instead. Add a couple of XXXs regarding the definition of MR_new_object_atomic in the case where inline allocation is enabled. |
||
|
|
573e6f2f00 |
Support unboxed float fields in high-level C grades.
Branches: main Support unboxed float fields in high-level C grades. When the representation of `float' is no wider than a machine word, d.u. functor arguments of type `float' (or equivalent) will be stored directly within cells constructed for that functor, instead of a pointer to the box containing the value. This was already so for low-level C grades. compiler/mlds.m: Add an option to mlds_type, equivalent to `mlds_array_type(mlds_generic_type)' except that some elements are known to be floats. Update some comments. compiler/ml_global_data.m: Remember the `--unboxed-float' option in `ml_global_data'. Special case generic arrays in `ml_gen_static_scalar_const_addr' and `ml_gen_static_scalar_const_value'. Float literals cannot be used to initialize an element of a generic array in C. If any appear, replace the generic array type by an instance of `mlds_mostly_generic_array_type' with float fields in the positions which have float initializers. compiler/ml_code_util.m: Make `ml_must_box_field_type' and `ml_gen_box_const_rval' depend on the `--unboxed-float' option. Delete some now-misleading comments. Delete an unused predicate. compiler/mlds_to_c.m: Update code that writes out scalar static data to handle `mlds_mostly_generic_array_type'. In one case, for `--high-level-data' only, output float constants by their integer representation, so that they may be cast to pointer types. compiler/ml_unify_gen.m: Rename some predicates for clarity. compiler/ml_accurate_gc.m: compiler/ml_lookup_switch.m: compiler/ml_proc_gen.m: compiler/ml_simplify_switch.m: compiler/mlds_to_cs.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: compiler/mlds_to_java.m: Conform to changes. library/float.m: Add hidden functions to return the integer representation of the bit layout of floating point values. library/exception.m: Delete mention of MR_AVOID_MACROS. runtime/mercury.c: runtime/mercury.h: Make MR_box_float/MR_unbox_float act like "casts" when MR_BOXED_FLOAT is undefined, and only define them in high-level grades. I think they should be replaced by MR_float_to_word/MR_word_to_float (which have less confusing names when there is no boxing) but that would require some header file reshuffling which I don't want to undertake yet. Delete references to MR_AVOID_MACROS. Apparently it existed to support the defunct gcc back-end but I cannot see it ever being defined. runtime/mercury_conf_param.h: MR_HIGHLEVEL_CODE no longer implies MR_BOXED_FLOAT. Delete mention of MR_AVOID_MACROS. runtime/mercury_float.h: Fix a comment. tests/hard_coded/Mmakefile: tests/hard_coded/float_ground_term.exp: tests/hard_coded/float_ground_term.m: Add a test case. |
||
|
|
8af00f7a2a |
Avoid using the __GNUC__ macro in the runtime as a test for the presence of
Branches: main, 11.07 Avoid using the __GNUC__ macro in the runtime as a test for the presence of gcc, since clang also defines that macro. Since clang doesn't support all of the GNU C extensions, we can't actually use __GNUC__ without also checking whether we are actually using clang. runtime/mercury_conf_param.h: Add three new macros, MR_CLANG, MR_GNUC and MR_MSVC that are defined only when the C compiler is clang, gcc, or Visual C respectively. (In particular, MR_GNUC will _not_ be defined when the C compiler is clang.) runtime/mercury.c: runtime/mercury.h: runtime/mercury_atomic_ops.c: runtime/mercury_atomic_ops.h runtime/mercury_bitmap.h: runtime/mercury_float.h: runtime/mercury_getopt.c: runtime/mercury_goto.h: runtime/mercury_heap.h: runtime/mercury_std.h: Replace uses of the __GNUC__ and __clang__ macros with the above. runtime/mercury_regs.h: As above, also #include mercury_conf_param.h directly since this file is #included by some of the tests in the configure script. |
||
|
|
7e26b55e74 |
Implement a new form of memory profiling, which tells the user what memory
Branches: main
Implement a new form of memory profiling, which tells the user what memory
is being retained during a program run. This is done by allocating an extra
word before each cell, which is used to "attribute" the cell to an
allocation site. The attribution, or "allocation id", is an address to an
MR_AllocSiteInfo structure generated by the Mercury compiler, giving the
procedure, filename and line number of the allocation, and the type
constructor and arity of the cell that it allocates.
The user must manually instrument the program with calls to
`benchmarking.report_memory_attribution', which forces a GC and summarises
the live objects on the heap using the attributions. The mprof tool is
extended with a new mode to parse and present that data.
Objects which are unattributed (e.g. by hand-written C code which hasn't
been updated) are still accounted for, but show up in profiles as "unknown".
Currently this profiling mode only works in conjunction with the Boehm
garbage collector, though in principle it can work with any memory allocator
for which we can access a list of the live objects. Since term size
profiling relies on the same technique of using an extra word per memory
cell, the two profiling modes are incompatible.
The output from `mprof -s' looks like this:
------ [1] some label ------
cells words cumul procedure / type (location)
14150 38872 total
* 1949/ 13.8% 4872/ 12.5% 12.5% <predicate `parser.parse_rest/7' mode 0>
975/ 6.9% 1950/ 5.0% list.list/1 (parser.m:502)
487/ 3.4% 1948/ 5.0% term.term/1 (parser.m:501)
487/ 3.4% 974/ 2.5% term.const/0 (parser.m:501)
* 1424/ 10.1% 4272/ 11.0% 23.5% <predicate `parser.parse_simple_term_2/6' mode 0>
708/ 5.0% 2832/ 7.3% term.term/1 (parser.m:643)
708/ 5.0% 1416/ 3.6% term.const/0 (parser.m:643)
...
boehm_gc/alloc.c:
boehm_gc/include/gc.h:
boehm_gc/misc.c:
boehm_gc/reclaim.c:
Add a callback function to be called for every live object after a GC.
Add a function to write out the GC_size_map array.
compiler/layout.m:
Define the alloc_site_info type which is equivalent to the
MR_AllocSiteInfo C structure.
Add alloc_site_array as a kind of "layout" array.
compiler/llds.m:
Add allocation sites to `cfile' structure.
Replace TypeMsg argument (which was also for profiling) on `incr_hp'
instructions by an allocation site identifier.
Add a new foreign_proc_component for allocation site ids.
compiler/code_info.m:
compiler/global_data.m:
compiler/proc_gen.m:
Keep the set of allocation sites in the code_info and global_data
structures.
compiler/unify_gen.m:
Add allocation sites to LLDS allocation instructions.
compiler/layout_out.m:
compiler/llds_out_file.m:
compiler/llds_out_instr.m:
Output MR_AllocSiteInfo arrays in generated C files.
Output code to register the MR_AllocSiteInfo array with the Mercury
runtime.
Output allocation site ids for memory allocation instructions.
compiler/llds_out_util.m:
Add allocation sites to llds_out_info.
compiler/pragma_c_gen.m:
compiler/ml_foreign_proc_gen.m:
Generate a macro MR_ALLOC_ID which resolves to an allocation site
structure, for every foreign_proc whose C code contains the string
"MR_ALLOC_ID". This is to be used by hand-written C code which
allocates memory.
MR_PROC_LABELs are retained for backwards compatibility. Though
they were introduced for profiling, they seem to have been co-opted
for printf-debugging since then.
compiler/ml_global_data.m:
Add allocation site structures to the MLDS global data.
compiler/mlds.m:
compiler/ml_unify_gen.m:
Add allocation site id to `new_object' instruction.
compiler/mlds_to_c.m:
Output allocation site arrays and allocation ids in high-level C code.
Output a call to register the allocation site array with the Mercury
runtime.
Delete an unused predicate.
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/mercury_compile_llds_back_end.m:
compiler/middle_rec.m:
compiler/ml_accurate_gc.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_util.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/use_local_vars.m:
compiler/var_locn.m:
Conform to changes.
compiler/pickle.m:
compiler/prog_event.m:
compiler/timestamp.m:
Conform to changes in memory allocation macros.
library/benchmarking.m:
Add the `report_memory_attribution' instrumentation predicates.
Conform to changes to MR_memprof_record.
library/array.m:
library/bit_buffer.m:
library/bitmap.m:
library/construct.m:
library/deconstruct.m:
library/dir.m:
library/io.m:
library/mutvar.m:
library/store.m:
library/string.m:
library/thread.semaphore.m:
library/version_array.m:
Use attributed memory allocation throughout the standard library so
that objects don't show up in the memory profile as "unknown".
Replace MR_PROC_LABEL by MR_ALLOC_ID.
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
Replace MR_PROC_LABEL by MR_ALLOC_ID.
profiler/Mercury.options:
profiler/globals.m:
profiler/mercury_profile.m:
profiler/options.m:
profiler/output.m:
profiler/snapshots.m:
Add a new mode to `mprof' to parse and present the data from
`Prof.Snapshots' files.
Add options for the new profiling mode.
profiler/process_file.m:
Fix a typo.
runtime/mercury_conf_param.h:
#define MR_MPROF_PROFILE_MEMORY_ATTRIBUTION if memory profiling
is enabled and we are using Boehm GC.
runtime/mercury.h:
Make MR_new_object take an allocation id argument.
Conform to changes in memory allocation macros.
runtime/mercury_memory.c:
runtime/mercury_memory.h:
runtime/mercury_types.h:
Define MR_AllocSiteInfo.
Add memory allocation functions and macros which take into the
account the additional word necessary for the new profiling mode.
These should be used in preferences to the raw memory allocation
functions wherever possible so that objects do not show up in the
profile as "unknown".
Add analogues of realloc/free which take into account the offset
introduced by the attribution word.
Add function versions of the MR_new_object macros, which can't be
written in standard C. They are only used when necessary.
Add built-in allocation site ids, to be used in the runtime and
other hand-written code when context-specific ids are unavailable.
runtime/mercury_heap.h:
Make MR_tag_offset_incr_hp_msg and MR_tag_offset_incr_hp_atomic_msg
allocate an extra word when memory attribution is desired, and store
the allocation id there.
Similarly for MR_create{1,2,3}_msg.
Replace proclabel arguments in allocation macros by alloc_id
arguments.
Replace MR_hp_alloc_atomic by MR_hp_alloc_atomic_msg. It was only
used for boxing floats.
Conform to change to MR_new_object macro.
runtime/mercury_bootstrap.h:
Delete obsolete macro hp_alloc_atomic.
runtime/mercury_heap_profile.c:
runtime/mercury_heap_profile.h:
Add the code to summarise the live objects on the Boehm GC heap and
writes out the data to `Prof.Snapshots', for display by mprof.
Don't store the procedure name in MR_memprof_record: the procedure
address is enough and faster to compare.
runtime/mercury_prof.c:
Finish and close the `Prof.Snapshots' file when the program
terminates.
Conform to changes in MR_memprof_record.
runtime/mercury_misc.h:
Add a macro to expand to the name of the allocation sites array
in LLDS grades.
runtime/mercury_bitmap.c:
runtime/mercury_bitmap.h:
Pass allocation id through bitmap allocation functions.
Delete unused function MR_string_to_bitmap.
runtime/mercury_string.h:
Add MR_make_aligned_string_copy_msg.
Make string allocation macros take allocation id arguments.
runtime/mercury.c:
runtime/mercury_array_macros.h:
runtime/mercury_context.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_dlist.c:
runtime/mercury_engine.c:
runtime/mercury_float.h:
runtime/mercury_hash_table.c:
runtime/mercury_ho_call.c:
runtime/mercury_label.c:
runtime/mercury_prof_mem.c:
runtime/mercury_stacks.c:
runtime/mercury_stm.c:
runtime/mercury_string.c:
runtime/mercury_thread.c:
runtime/mercury_trace_base.c:
runtime/mercury_trail.c:
runtime/mercury_type_desc.c:
runtime/mercury_type_info.c:
runtime/mercury_wsdeque.c:
Use attributed memory allocation throughout the runtime so that
objects don't show up in the profile as "unknown".
runtime/mercury_memory_zones.c:
Attribute memory zones to the Mercury runtime.
runtime/mercury_tabling.c:
runtime/mercury_tabling.h:
Use attributed memory allocation macros for tabling structures.
Delete unused MR_table_realloc_* and MR_table_copy_bytes macros.
runtime/mercury_deep_copy_body.h:
Try to retain the original attribution word when copying values.
runtime/mercury_ml_expand_body.h:
Conform to changes in memory allocation macros.
runtime/mercury_tags.h:
Replace proclabel arguments by alloc_id arguments in allocation macros.
runtime/mercury_wrapper.c:
If memory attribution is enabled, tell Boehm GC that pointers may be
displaced by an extra word.
trace/mercury_trace.c:
trace/mercury_trace_tables.c:
Conform to changes in memory allocation macros.
extras/net/tcp.m:
extras/solver_types/library/any_array.m:
extras/trailed_update/tr_array.m:
Conform to changes in memory allocation macros.
doc/user_guide.texi:
Document the new profiling mode.
doc/reference_manual.texi:
Update a commented out example.
|
||
|
|
21ac46bbc3 |
- Static linking is not available on any Mac OS X system by default
Estimated hours taken: 1 Branches: main configure.in: runtime/mercury.h: runtime/mercury_conf.h.in: - Static linking is not available on any Mac OS X system by default (PPC or intel). - With some versions of gcc on Darwin __builtin_setjmp is broken. (See gcc bug 22099) |
||
|
|
4924dfb1c9 |
One of Hans Boehm's papers says that heap cells allocated by GC_MALLOC_ATOMIC
Estimated hours taken: 5 Branches: main One of Hans Boehm's papers says that heap cells allocated by GC_MALLOC_ATOMIC are grouped together into pages, and these pages aren't scanned during the sweep phase of the garbage collector. I therefore modified the compiler to use GC_MALLOC_ATOMIC instead of GC_MALLOC whereever possible, i.e when the cell being allocated is guaranteed not to have any pointer to GCable memory inside it. My first benchmarking run showed a speedup of 4.5% in asm_fast.gc: EXTRA_MCFLAGS = --use-atomic-cells mercury_compile.01 average of 6 with ignore=1 18.30 EXTRA_MCFLAGS = --no-use-atomic-cells mercury_compile.02 average of 6 with ignore=1 19.17 However, later benchmarks, after the upgrade to version 7.0 of boehm_gc, show a less favourable and more mixed picture, with e.g. a 4% speedup in hlc.gc at -O3, a 3% slowdown in asm_fast.gc at -O4, and little effect otherwise: EXTRA_MCFLAGS = -O1 --use-atomic-cells GRADE = asm_fast.gc mercury_compile.01 average of 6 with ignore=1 23.30 EXTRA_MCFLAGS = -O1 --no-use-atomic-cells GRADE = asm_fast.gc mercury_compile.02 average of 6 with ignore=1 23.28 EXTRA_MCFLAGS = -O2 --use-atomic-cells GRADE = asm_fast.gc mercury_compile.03 average of 6 with ignore=1 18.51 EXTRA_MCFLAGS = -O2 --no-use-atomic-cells GRADE = asm_fast.gc mercury_compile.04 average of 6 with ignore=1 18.66 EXTRA_MCFLAGS = -O3 --use-atomic-cells GRADE = asm_fast.gc mercury_compile.05 average of 6 with ignore=1 18.44 EXTRA_MCFLAGS = -O3 --no-use-atomic-cells GRADE = asm_fast.gc mercury_compile.06 average of 6 with ignore=1 18.48 EXTRA_MCFLAGS = -O4 --use-atomic-cells GRADE = asm_fast.gc mercury_compile.07 average of 6 with ignore=1 18.28 EXTRA_MCFLAGS = -O4 --no-use-atomic-cells GRADE = asm_fast.gc mercury_compile.08 average of 6 with ignore=1 17.70 EXTRA_MCFLAGS = -O1 --use-atomic-cells GRADE = hlc.gc mercury_compile.09 average of 6 with ignore=1 24.78 EXTRA_MCFLAGS = -O1 --no-use-atomic-cells GRADE = hlc.gc mercury_compile.10 average of 6 with ignore=1 24.69 EXTRA_MCFLAGS = -O2 --use-atomic-cells GRADE = hlc.gc mercury_compile.11 average of 6 with ignore=1 19.36 EXTRA_MCFLAGS = -O2 --no-use-atomic-cells GRADE = hlc.gc mercury_compile.12 average of 6 with ignore=1 19.26 EXTRA_MCFLAGS = -O3 --use-atomic-cells GRADE = hlc.gc mercury_compile.13 average of 6 with ignore=1 18.64 EXTRA_MCFLAGS = -O3 --no-use-atomic-cells GRADE = hlc.gc mercury_compile.14 average of 6 with ignore=1 19.38 EXTRA_MCFLAGS = -O4 --use-atomic-cells GRADE = hlc.gc mercury_compile.15 average of 6 with ignore=1 19.39 EXTRA_MCFLAGS = -O4 --no-use-atomic-cells GRADE = hlc.gc mercury_compile.16 average of 6 with ignore=1 19.41 runtime/mercury_heap.h: Define atomic equivalents of the few heap allocation macros that didn't already have one. These macros are used by the LLDS backend. runtime/mercury.h: Define an atomic equivalent of the MR_new_object macro. These macros are used by the MLDS backend. Use MR_new_object_atomic instead of MR_new_object to box floats. compiler/hlds_data.m: compiler/llds.m: compiler/mlds.m: Modify the representations of the heap allocations constructs to include a flag that says whether we should use the atomic variants of the heap allocation macros. compiler/llds_out.m: compiler/mlds_to_c.m: Respect this extract flag when emitting C code. In mlds_to_c.m, also add some white space that makes the code easier for humans to read. compiler/type_util.m: Add a mechanism for finding out whether we can put a value of a given type into an atomic cell. Put the definitions of functions and predicates in this module in the same order as their declarations. Turn some predicates into functions. Change the argument order of some predicates to conform to our usual conventions. compiler/unify_gen.m: compiler/ml_unify_gen.m: Use the new mechanism in type_util.m to generate code that creates atomic heap cells if this is possible and is requested. compiler/code_info.m: compiler/var_locn.m: Act on the information provided by unify_gen.m. compiler/options.m: doc/user_guide.texi: Add an option to control whether the compiler should try to use atomic cells. compiler/dupelim.m: compiler/dupproc.m: compiler/exprn_aux.m: compiler/higher_order.m: compiler/jumpopt.m: compiler/livemap.m: compiler/middle_rec.m: compiler/ml_code_util.m: compiler/ml_elim_nested.m: compiler/ml_optimize.m: compiler/ml_util.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: compiler/mlds_to_java.m: compiler/modecheck_unify.m: compiler/opt_debug.m: compiler/opt_util.m: compiler/par_conj_gen.m: compiler/polymorphism.m: compiler/reassign.m: compiler/size_prof.m: compiler/structure_sharing.domain.m: compiler/use_local_vars.m: Minor diffs to conform to the changes above. compiler/structure_reuse.direct.choose_reuse.m: Add an XXX comment about the interaction of the new capability with structure reuse. |
||
|
|
c6a14c35b0 |
Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
Estimated hours taken: 5 Branches: main Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage collector. The main reason is that thread-local allocation is not supported on Solaris in version 6.x of the collector. boehm_gc/*: Merge in changes from the vendor branch. .README.in: Update Boehm GC version number and copyright notice. Mmake.common.in: configure.in: runtime/RESERVED_MACRO_NAMES: scripts/mgnuc.in: Don't define `THREAD_LOCAL_ALLOC' nor `GC_REDIRECT_TO_LOCAL' as thread-local allocation is automatically enabled in gc 7.0. Consistently use `GC_WIN32_THREADS' and `GC_LINUX_THREADS' as the non-prefixed versions of those symbols are deprecated. Don't define `NO_SIGNALS' as it is no longer necessary. Add librt to the list of thread libraries on Solaris. This is needed for the POSIX semaphore functions now used on Solaris. runtime/mercury_prof_mem.c: runtime/mercury_prof_mem.h: Update comments mentioning `NO_SIGNALS'. compiler/compile_target_code.m: Make `--inline-alloc' do nothing as inline allocation is currently broken in gc 7.0. runtime/mercury.h: runtime/mercury_heap.h: Include `gc_inline.h' instead of `gc_inl.h' as the latter no longer exists. extras/concurrency/semaphore.m: library/par_builtin.m: robdd/bryant.c: Replace instances of `GC_PTR' by `void *' as the former no longer exists. runtime/mercury_wrapper.c: Remove references to `GC_quiet' which no longer exists. Replace uses of `GC_quiet' for the MPS collector by a new variable `MR_mps_quiet'. tools/bootcheck: Copy libatomic_ops-related files and directories when copying boehm_gc. |
||
|
|
459847a064 |
Move the univ, maybe, pair and unit types from std_util into their own
Estimated hours taken: 18 Branches: main Move the univ, maybe, pair and unit types from std_util into their own modules. std_util still contains the general purpose higher-order programming constructs. library/std_util.m: Move univ, maybe, pair and unit (plus any other related types and procedures) into their own modules. library/maybe.m: New module. This contains the maybe and maybe_error types and the associated procedures. library/pair.m: New module. This contains the pair type and associated procedures. library/unit.m: New module. This contains the types unit/0 and unit/1. library/univ.m: New module. This contains the univ type and associated procedures. library/library.m: Add the new modules. library/private_builtin.m: Update the declaration of the type_ctor_info struct for univ. runtime/mercury.h: Update the declaration for the type_ctor_info struct for univ. runtime/mercury_mcpp.h: runtime/mercury_hlc_types.h: Update the definition of MR_Univ. runtime/mercury_init.h: Fix a comment: ML_type_name is now exported from type_desc.m. compiler/mlds_to_il.m: Update the the name of the module that defines univs (which are handled specially by the il code generator.) library/*.m: compiler/*.m: browser/*.m: mdbcomp/*.m: profiler/*.m: deep_profiler/*.m: Conform to the above changes. Import the new modules where they are needed; don't import std_util where it isn't needed. Fix formatting in lots of modules. Delete duplicate module imports. tests/*: Update the test suite to confrom to the above changes. |
||
|
|
9d8ca0ad37 |
Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5 Branches: main Remove residual parts of the Aditi backend that weren't deleted the other day. configure.in: Mmake.common.in: Remove support for enabling the Aditi backend. runtime/mercury_aditi.h: Remove this file. runtime/Mmakefile: runtime/mercury.h: runtime/mercury_imp.h: runtime/mercury_ho_call.[ch]: runtime/mercury_wrapper.[ch]: Delete support for Aditi in the runtime. scripts/Mmake.rules: scripts/Mmake.vars.in: scripts/c2init.in: scripts/parse_ml_options.sh-subr.in: Remove mmake support for building .rlo files, etc. util/mkinit.c: Remove Aditi specific code. compiler/bytecode_data.m: compiler/closure_analysis.m: compiler/code_model.m: compiler/compile_target_code.m: compiler/det_analysis.m: compiler/handle_options.m: compiler/hlds_goal.m: compiler/hlds_module.m: compiler/make.dependencies.m: compiler/make.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds_error.m: compiler/make_hlds_passes.m: compiler/mercury_to_mercury.m: compiler/mlds_to_gcc.m: compiler/modecheck_call.m: compiler/modules.m: compiler/opt_debug.m: compiler/options.m: compiler/prog_data.m: compiler/prog_foreign.m: compiler/prog_mode.m: compiler/prog_type.m: compiler/rtti.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: compiler/term_errors.m: compiler/unify_proc.m: mdbcomp/prim_data.m: Remove residual support for Aditi. library/ops.m: Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the ops table. doc/reference_manual.texi: doc/user_guide.texi: Delete the sections on the Aditi interface. extras/aditi/*: Delete this. |
||
|
|
570f2aa3c5 |
Update the documentation to reflect the fact that mlds_to_c.m
Estimated hours taken: 0.4 Branches: main util/mkinit.c: Update the documentation to reflect the fact that mlds_to_c.m also generates ENDINIT comments. Fix a typo. README.MinGW: library/io.m: library/store.m: runtime/mercury.h: runtime/mercry_wrapper.c: runtime/mercury_goto.h: Fix some typos. |
||
|
|
61e9bcf017 |
Fix the compilation of the runtime in hlc.agc.
Estimated hours taken: 0.5 Branches: main Fix the compilation of the runtime in hlc.agc. XXX This grade is broken on the main branch. library/private_builtin.m: runtime/mercury.h: runtime/mercury_accurate_gc.c: Conform to the new field names of the zone structure. |
||
|
|
95b64f73a1 |
Move changes in the library on the mode-constraints branch onto the trunk.
Estimated hours taken: unknown (but probably several weeks by dmo)
Branches: main
Move changes in the library on the mode-constraints branch onto the trunk.
library/eqvclass.m:
Add some utility functions and predicates.
library/map.m:
Add some utility functions and predicates, and some type
specialization directives.
library/tree234.m:
Add some utility functions and predicates.
library/robdd.m:
Add this module, which provides a Mercury interface to the C code in
robdd/bryant.c. In some places, robustness has been sacrificed for
speed, and the module is not (yet) as well documented as it could be;
therefore it is not (yet) included in the documentation.
library/pprint.m:
Print robdds nicely, since this is essential to debugging code handling
robdds. (This is why adding robdd.m in some other directory, e.g. the
compiler, wouldn't really work.)
library/term.m:
Add a function that returns the highest numbered vars created from
a var_supply.
library/varset.m:
Add a function that returns the highest numbered vars created from
a varset.
library/unsafe.m:
Add this module here, since it may be needed to debug code in the
library (e.g. in robdd.m.).
library/library.m:
Add a reference to the robdd module, and a commented out reference
to the unsafe module. If a developer needs to use unsafe.m anywhere
in the Mercury implementation, they can uncomment this reference
in the relevant workspace.
Make the list of modules easier to maintain (especially in the case
of CVS conflicts) by listing one module per line.
Fix formatting of some foreign_procs.
NEWS:
Mention the new predicates and functions.
Mmake.workspace:
Add a new make variable that specifies the location of the robdd
subdirectory.
Mmakefile:
Add rules for handling the robdd subdirectory.
configure.in:
Check whether the compiler can handle local foreign_decls, since
robdd.m now needs this.
tools/bootcheck:
Add the robdd subdirectory to the stage 2 & 3 directories.
deep_profiler/unsafe.m:
Remove this module from this directory.
doc/Mmakefile:
Do not include the robdd and unsafe modules in the documentation.
The robdd module because (in its present state) it is not stable
enough, the unsafe module because it is not enabled in installed
versions of the library.
robdd/Makefile:
Update the set of default compilation flags. The main code in this
directory, bryant.c, is #included in library/robdd.m, and the only
other programs in this directory are test programs.
robdd/Mmakefile:
New file. Includes a mechanism to compile bryant.c in the robdd
subdirectory, since this can give cleaner error messages than
compiling library/robdd.m.
robdd/bryant.[ch]:
Huge cleanup of these files. Add MR_ROBDD_ prefixes to global symbols,
make the formatting conform to our standards, and fix irregularities
in the uses of the macros that control the use of optional facilities.
robdd/bryantPrint.[ch]:
robdd/table.[ch]:
robdd/test_abexit.c:
robdd/test_abunify.c:
robdd/test_abglb.c:
robdd/test_iff.c:
robdd/test_rename.c:
robdd/test_restrict.c:
robdd/test_rglb.c:
robdd/test_upclose.c:
robdd/test_var.c:
robdd/test_vars.c:
robdd/timing.[ch]:
robdd/var.h:
Conform to the changes in bryant.h. Note that since the code in these
files won't end up in Mercury program code, they don't need to be
namespace clean.
runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
#define GC_I_HIDE_POINTERS before each #include of gc.h (bryant.c
hides pointers). This impact of this #define is so small that it is
not measurable.
runtime/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
Add HIDE_POINTER and REVEAL_POINTER, since defining GC_I_HIDE_POINTERS
makes these macros from gc.h visible.
runtime/mercury_reg_workarounds.[ch]:
Add the MR_memset function.
tests/debugger/declarative/if_then_else.{inp,exp}:
tests/debugger/declarative/ite_2.{inp,exp,exp2}:
Avoid a name conflict with the predicate ite in robdd.m.
|
||
|
|
42025cecfc |
Allow Aditi to call Mercury. At the moment, this involves Aditi
Estimated hours taken: 200
Branches: main
Allow Aditi to call Mercury. At the moment, this involves Aditi
loading a shared library containing the user's code.
runtime/mercury_aditi.h:
Define a structure MR_Aditi_Proc_Info used to describe
a procedure called by Aditi. Aditi will use dlsym() to
look up these structures in the shared library supplied
by the user.
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/ml_code_util.m:
compiler/mlds_to_gcc.m:
compiler/opt_debug.m:
Add an aditi_proc_info alternative to the rtti_data type,
which corresponds to an MR_AditiProcInfo structure in
the generated code.
In the rtti_proc_label type, record the determinism rather
than the code_model for use by Aditi.
compiler/options.m:
doc/user_guide.texi:
Add an option `--aditi-calls-mercury'.
This is needed for the Aditi tests, which currently don't
handle loading the shared libraries for user defined code.
Move `--aditi' into the compilation model options section.
compiler/rl.m:
Sort the constructors for d.u. types when creating an Aditi
type declaration to make it easier to find a particular
constructor.
compiler/code_model.m:
compiler/stack_layout.m:
Move represent_determinism into code_model.m, for use
by rtti_to_mlds.m.
compiler/rl_exprn.m:
compiler/rl_file.pp:
compiler/rl_out.pp:
compiler/hlds_module.m:
compiler/mercury_compile.m:
Create the procedures for each top-down Mercury goal which
needs to be called from Aditi.
Each created procedure has one input and one output argument,
both of which will have a `{}/N' type.
Allow nondet join conditions.
compiler/rl_exprn.m:
Use record syntax.
compiler/rl_out.pp:
Minor changes to the support for memoing.
runtime/Mmakefile:
runtime/mercury_imp.h:
runtime/mercury.h:
Add mercury_aditi.h.
runtime/mercury_stack_layout.m:
Add a comment about the duplication between MR_DETISM_*
and code_model.represent_determinism.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/aditi_calls_mercury.m:
Test case.
Also, enable the Aditi tests in hlc grades.
|
||
|
|
fbe53a5a28 |
Import mercury_library_types.h in high level C grades, as a emporary
Estimated hours taken: 0.1 Branches: main runtime/mercury.h: Import mercury_library_types.h in high level C grades, as a emporary fix for the bootstrap problem caused by Simon's recent change. |
||
|
|
f007b45df8 |
Implement the infrastructure for term size profiling.
Estimated hours taken: 400
Branches: main
Implement the infrastructure for term size profiling. This means adding two
new grade components, tsw and tsc, and implementing them in the LLDS code
generator. In grades including tsw (term size words), each term is augmented
with an extra word giving the number of heap words it contains; in grades
including tsc (term size cells), each term is augmented with an extra word
giving the number of heap cells it contains. The extra word is at the start,
at offset -1, to leave almost all of the machinery for accessing the heap
unchanged.
For now, the only way to access term sizes is with a new mdb command,
"term_size <varspec>". Later, we will use term sizes in conjunction with
deep profiling to do experimental complexity analysis, but that requires
a lot more research. This diff is a necessary first step.
The implementation of term size profiling consists of three main parts:
- a source-to-source transform that computes the size of each heap cell
when it is constructed (and increments it in the rare cases when a free
argument of an existing heap cell is bound),
- a relatively small change to the code generator that reserves the extra
slot in new heap cells, and
- extensions to the facilities for creating cells from C code to record
the extra information we now need.
The diff overhauls polymorphism.m to make the source-to-source transform
possible. This overhaul includes separating type_ctor_infos and type_infos
as strictly as possible from each other, converting type_ctor_infos into
type_infos only as necessary. It also includes separating type_ctor_infos,
type_infos, base_typeclass_infos and typeclass_infos (as well as voids,
for clarity) from plain user-defined type constructors in type categorizations.
This change needs this separation because values of those four types do not
have size slots, but they ought to be treated specially in other situations
as well (e.g. by tabling).
The diff adds a new mdb command, term_size. It also replaces the proc_body
mdb command with new ways of using the existing print and browse commands
("print proc_body" and "browse proc_body") in order to make looking at
procedure bodies more controllable. This was useful in debugging the effect
of term size profiling on some test case outputs. It is not strictly tied
to term size profiling, but turns out to be difficult to disentangle.
compiler/size_prof.m:
A new module implementing the source-to-source transform.
compiler/notes/compiler_design.html:
Mention the new module.
compiler/transform_hlds.m:
Include size_prof as a submodule of transform_hlds.
compiler/mercury_compile.m:
If term size profiling is enabled, invoke its source-to-source
transform.
compiler/hlds_goal.m:
Extend construction unifications with an optional slot for recording
the size of the term if the size is a constant, or the identity of the
variable holding the size, if the size is not constant. This is
needed by the source-to-source transform.
compiler/quantification.m:
Treat the variable reference that may be in this slot as a nonlocal
variable of construction unifications, since the code generator needs
this.
compiler/compile_target_code.m:
Handle the new grade components.
compiler/options.m:
Implement the options that control term size profiling.
doc/user_guide.texi:
Document the options and grade components that control term size
profiling, and the term_size mdb command. The documentation is
commented out for now.
Modify the wording of the 'u' HLDS dump flag to include other details
of unifications (e.g. term size info) rather than just unification
categories.
Document the new alternatives of the print and browse commands. Since
they are for developers only, the documentation is commented out.
compiler/handle_options.m:
Handle the implications of term size profiling grades.
Add a -D flag value to print HLDS components relevant to HLDS
transformations.
compiler/modules.m:
Import the new builtin library module that implements the operations
needed by term size profiling automatically in term size profiling
grades.
Switch the predicate involved to use state var syntax.
compiler/prog_util.m:
Add predicates and functions that return the sym_names of the modules
needed by term size profiling.
compiler/code_info.m:
compiler/unify_gen.m:
compiler/var_locn.m:
Reserve an extra slot in heap cells and fill them in in unifications
marked by size_prof.
compiler/builtin_ops.m:
Add term_size_prof_builtin.term_size_plus as a builtin, with the same
implementation as int.+.
compiler/make_hlds.m:
Disable warnings about clauses for builtins while the change to
builtin_ops is bootstrapped.
compiler/polymorphism.m:
Export predicates that generate goals to create type_infos and
type_ctor_infos to add_to_construct.m. Rewrite their documentation
to make it more detailed.
Make orders of arguments amenable to the use of state variable syntax.
Consolidate knowledge of which type categories have builtin unify and
compare predicates in one place.
Add code to leave the types of type_ctor_infos alone: instead of
changing their types to type_info when used as arguments of other
type_infos, create a new variable of type type_info instead, and
use an unsafe_cast. This would make the HLDS closer to being type
correct, but this new code is currently commented out, for two
reasons. First, common.m is currently not smart enough to figure out
that if X and Y are equal, then similar unsafe_casts of X and Y
are also equal, and this causes the compiler do not detect some
duplicate calls it used to detect. Second, the code generators
are also not smart enough to know that if Z is an unsafe_cast of X,
then X and Z do not need separate stack slots, but can use the same
slot.
compiler/type_util.m:
Add utility predicates for returning the types of type_infos and
type_ctor_infos, for use by new code in polymorphism.m.
Move some utility predicates here from other modules, since they
are now used by more than one module.
Rename the type `builtin_type' as `type_category', to better reflect
what it does. Extend it to put the type_info, type_ctor_info,
typeclass_info, base_typeclass_info and void types into categories
of their own: treating these types as if they were a user-defined
type (which is how they used to be classified) is not always correct.
Rename the functor polymorphic_type to variable_type, since types
such as list(T) are polymorphic, but they fall into the user-defined
category. Rename user_type as user_ctor_type, since list(int) is not
wholly user-defined but falls into this category. Rename pred_type
as higher_order_type, since it also encompasses functions.
Replace code that used to check for a few of the alternatives
of this type with code that does a full switch on the type,
to ensure that they are updated if the type definition ever
changes again.
compiler/pseudo_type_info.m:
Delete a predicate whose updated implementation is now in type_util.m.
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
Still treat type_infos, type_ctor_infos, typeclass_infos and
base_typeclass_infos as user-defined types, but prepare for when
they won't be.
compiler/hlds_pred.m:
Require interface typeinfo liveness when term size profiling is
enabled.
Add term_size_profiling_builtin.increase_size as a
no_type_info_builtin.
compiler/hlds_out.m:
Print the size annotations on unifications if HLDS dump flags call
for unification details. (The flag test is in the caller of the
modified predicate.)
compiler/llds.m:
Extend incr_hp instructions and data_addr_consts with optional fields
that allow the code generator to refer to N words past the start of
a static or dynamic cell. Term size profiling uses this with N=1.
compiler/llds_out.m:
When allocating memory on the heap, use the macro variants that
specify an optional offset, and specify the offset when required.
compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/jumpopt.m:
compiler/lambda.m:
compiler/livemap.m:
compiler/ll_pseudo_type_info.m:
compiler/lookup_switch.m:
compiler/magic_util.m:
compiler/middle_rec.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modecheck_unify.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_conj_gen.m:
compiler/post_typecheck.m:
compiler/reassign.m:
compiler/rl.m:
compiler/rl_key.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/static_term.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unused_args.m:
compiler/use_local_vars.m:
Minor updates to conform to the changes above.
library/term_size_prof_builtin.m:
New module containing helper predicates for term size profiling.
size_prof.m generates call to these predicates.
library/library.m:
Include the new module in the library.
doc/Mmakefile:
Do not include the term_size_prof_builtin module in the library
documentation.
library/array.m:
library/benchmarking.m:
library/construct.m:
library/deconstruct.m:
library/io.m:
library/sparse_bitset.m:
library/store.m:
library/string.m:
Replace all uses of MR_incr_hp with MR_offset_incr_hp, to ensure
that we haven't overlooked any places where offsets may need to be
specified.
Fix formatting of foreign_procs.
Use new macros defined by the runtime system when constructing
terms (which all happen to be lists) in C code. These new macros
specify the types of the cell arguments, allowing the implementation
to figure out the size of the new cell based on the sizes of its
fields.
library/private_builtin.m:
Define some constant type_info structures for use by these macros.
They cannot be defined in the runtime, since they refer to types
defined in the library (list.list and std_util.univ).
util/mkinit.c:
Make the addresses of these type_info structures available to the
runtime.
runtime/mercury_init.h:
Declare these type_info structures, for use in mkinit-generated
*_init.c files.
runtime/mercury_wrapper.[ch]:
Declare and define the variables that hold these addresses, for use
in the new macros for constructing typed lists.
Since term size profiling can refer to a memory cell by a pointer
that is offset by one word, register the extra offsets with the Boehm
collector if is being used.
Document the incompatibility of MR_HIGHTAGS and the Boehm collector.
runtime/mercury_tags.h:
Define new macros for constructing typed lists.
Provide macros for preserving the old interface presented by this file
to the extent possible. Uses of the old MR_list_cons macro will
continue to work in grades without term size profiling. In term
size profiling grades, their use will get a C compiler error.
Fix a bug caused by a missing backslash.
runtime/mercury_heap.h:
Change the basic macros for allocating new heap cells to take
an optional offset argument. If this is nonzero, the macros
increment the returned address by the given number of words.
Term size profiling specifies offset=1, reserving the extra
word at the start (which is ignored by all components of the
system except term size profiling) for holding the size of the term.
Provide macros for preserving the old interface presented by this file
to the extent possible. Since the old MR_create[123] and MR_list_cons
macros did not specify type information, they had to be changed
to take additional arguments. This affects only hand-written C code.
Call new diagnostic macros that can help debug heap allocations.
Document why the macros in this files must expand to expressions
instead of statements, evn though the latter would be preferable
(e.g. by allowing them to declare and use local variables without
depending on gcc extensions).
runtime/mercury_debug.[ch]:
Add diagnostic macros to debug heap allocations, and the functions
behind them if MR_DEBUG_HEAP_ALLOC is defined.
Update the debugging routines for hand-allocated cells to print the
values of the term size slot as well as the other slots in the relevant
grades.
runtime/mercury_string.h:
Provide some needed variants of the macro for copying strings.
runtime/mercury_deconstruct_macros.h:
runtime/mercury_type_info.c:
Supply type information when constructing terms.
runtime/mercury_deep_copy_body.h:
Preserve the term size slot when copying terms.
runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
Reduce code duplication by using a now standard macro for copying
strings.
runtime/mercury_grade.h:
Handle the two new grade components.
runtime/mercury_conf_param.h:
Document the C macros used to control the two new grade components,
as well as MR_DEBUG_HEAP_ALLOC.
Detect incompatibilities between high level code and profiling.
runtime/mercury_term_size.[ch]:
A new module to house a function to find and return term sizes
stored in heap cells.
runtime/mercury_proc_id.h:
runtime/mercury_univ.h:
New header files. mercury_proc_id.h contains the (unchanged)
definition of MR_Proc_Id, while mercury_univ.h contains the
definitions of the macros for manipulating univs that used to be
in mercury_type_info.h, updated to use the new macros for allocating
memory.
In the absence of these header files, the following circularity
would ensue:
mercury_deep_profiling.h includes mercury_stack_layout.h
- needs definition of MR_Proc_Id
mercury_stack_layout.h needs mercury_type_info.h
- needs definition of MR_PseudoTypeInfo
mercury_type_info.h needs mercury_heap.h
- needs heap allocation macros for MR_new_univ_on_hp
mercury_heap.h includes mercury_deep_profiling.h
- needs MR_current_call_site_dynamic for recording allocations
Breaking the circular dependency in two places, not just one, is to
minimize similar problems in the future.
runtime/mercury_stack_layout.h:
Delete the definition of MR_Proc_Id, which is now in mercury_proc_id.h.
runtime/mercury_type_info.h:
Delete the macros for manipulating univs, which are now in
mercury_univ.h.
runtime/Mmakefile:
Mention the new files.
runtime/mercury_imp.h:
runtime/mercury.h:
runtime/mercury_construct.c:
runtime/mercury_deep_profiling.h:
Include the new files at appropriate points.
runtime/mercury.c:
Change the names of the functions that create heap cells for
hand-written code, since the interface to hand-written code has
changed to include type information.
runtime/mercury_tabling.h:
Delete some unused macros.
runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
Use the new macros supplying type information when constructing lists.
scripts/canonical_grade_options.sh-subr:
Fix an undefined sh variable bug that could cause error messages
to come out without identifying the program they were from.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade components and the options controlling them.
trace/mercury_trace_internal.c:
Implement the mdb command "term_size <varspec>", which is like
"print <varspec>", but prints the size of a term instead of its value.
In non-term-size-profiling grades, it prints an error message.
Replace the "proc_body" command with optional arguments to the "print"
and "browse" commands.
doc/user_guide.tex:
Add documentation of the term_size mdb command. Since the command is
for implementors only, and works only in grades that are not yet ready
for public consumption, the documentation is commented out.
Add documentation of the new arguments of the print and browse mdb
commands. Since they are for implementors only, the documentation
is commented out.
trace/mercury_trace_vars.[ch]:
Add the functions needed to implement the term_size command, and
factor out the code common to the "size" and "print"/"browse" commands.
Decide whether to print the name of a variable before invoking the
supplied print or browse predicate on it based on a flag design for
this purpose, instead of overloading the meaning of the output FILE *
variable. This arrangement is much clearer.
trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
Supply type information when constructing terms.
browser/program_representation.m:
Since the new library module term_size_prof_builtin never generates
any events, mark it as such, so that the declarative debugger doesn't
expect it to generate any.
Do the same for the deep profiling builtin module.
tests/debugger/term_size_words.{m,inp,exp}:
tests/debugger/term_size_cells.{m,inp,exp}:
Two new test cases, each testing one of the new grades.
tests/debugger/Mmakefile:
Enable the two new test cases in their grades.
Disable the tests sensitive to stack frame sizes in term size profiling
grades.
tests/debugger/completion.exp:
Add the new "term_size" mdb command to the list of command completions,
and delete "proc_body".
tests/debugger/declarative/dependency.{inp,exp}:
Use "print proc_body" instead of "proc_body".
tests/hard_coded/nondet_c.m:
tests/hard_coded/pragma_inline.m:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
tests/valid/Mmakefile:
Disable the IL tests in term size profiling grades, since the term size
profiling primitives haven't been (and probably won't be) implemented
for the MLDS backends, and handle_options causes a compiler abort
for grades that combine term size profiling and any one of IL, Java
and high level C.
|
||
|
|
f42c8d430e |
Delete some old bootstrapping code.
Estimated hours taken: 0.1 Branches: main runtime/mercury.h: Delete some old bootstrapping code. |
||
|
|
42ccbac1b8 |
Fix improper references to the type_ctor_infos of builtin types.
Estimated hours taken: 2 Branches: main Fix improper references to the type_ctor_infos of builtin types. runtime/mercury_builtin_types.h: Declare the type_ctor_infos of builtin types even for the low level backend. runtime/mercury.h: Avoid duplicating the declarations in mercury_builtin_types.h; include mercury_builtin_types.h instead. runtime/mercury_type_desc.h: Include mercury_builtin_types.h, and refer to the type_ctor_infos of the builtin variable-arity type constructors directly. library/table_builtin.m: Declare only the type_ctor_infos we need that aren't declared by mercury_builtin_types.h. |
||
|
|
ebbb5d529d |
Fix a bug in my previous change: the #include of mercury_heap.h
Estimated hours taken: 2 Branches: main runtime/mercury.h: Fix a bug in my previous change: the #include of mercury_heap.h needs to come *after* the definition of MR_new_object(). |
||
|
|
9efaf24ca7 |
Fix a bug which broke tests/hard_coded/foreign_type with --target asm.
Estimated hours taken: 0.25 Branches: main Fix a bug which broke tests/hard_coded/foreign_type with --target asm. mercury.h: #include "mercury_heap.h". |
||
|
|
17d5aa732e |
Add support for interfacing Mercury with the MPS garbage collector.
Estimated hours taken: 20
Branches: main
Add support for interfacing Mercury with the MPS garbage collector.
This change is broken into three parts:
1. Import version 1.100.1 of the MPS kit into the Mercury
CVS repository, in the directory `mps_gc'.
2. Make some changes to the MPS kit for Mercury,
to support fully-conservative collection and tagged pointers,
and to wrap it in an interface that is similar to that of
the Boehm collector.
3. Modify the rest of the Mercury implementation
to support linking with the MPS kit instead
of the Boehm collector. This involved defining
`mps' as a new GC method and a new grade component.
This is part 3 of 3.
Mmake.workspace:
Include the MPS directories in the header file and library search
paths.
tools/bootcheck:
Link the mps_gc directory into the stage2 and stage3 directories.
Mmake.workspace:
runtime/Mmakefile:
scripts/ml.in:
For *.mps grades, link in mps.a.
(XXX ml.in is linking in libmps.a, which is wrong.)
runtime/Mmakefile:
trace/Mmakefile:
In the rule for `check_headers', which checks macro namespace
cleanliness, allow names to start with `MPS_' or `mps_'.
runtime/RESERVED_MACRO_NAMES:
Add `mercury_mps_h', which is used by mps_gc/code/mercury_mps.h
for its header guard. (Normally it would be better to use
uppercase for header guard macro names, but that would be
inconsistent with the coding style used in mps_gc/code.)
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
Handle the new `mps' GC method and grade component.
compiler/globals.m:
compiler/options.m:
doc/user_guide.texi:
Replace gc_method `conservative' with two alternatives
`boehm' and `mps'. ("--gc conservative" is still allowed,
and treated as equivalent to "--gc boehm".)
Add new function `gc_is_conservative' to globals.m.
compiler/mercury_compile.m:
compiler/handle_options.m:
Use `gc_is_conservative' rather than `= conservative'.
compiler/handle_options.m:
Handle the "mps" grade component.
(XXX need to document this in options.m and user_guide.texi)
compiler/compile_target_code.m:
Pass the appropriate C defines for the new GC methods.
compiler/mercury_compile.m:
Wrap the work-around for a Boehm GC bug inside `#ifndef MR_MPS_GC'.
library/array.m:
Use GC_FREE() rather than GC_free().
This is needed for two reasons:
- so that it works with MPS, which only defines GC_FREE
- so that it works with then Boehm collector when
GC debugging is enabled
library/benchmarking.m:
Output GC statistics for the MPS collector.
runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
If MR_MPS_GC is defined, use mercury_mps.h rather than gc.h.
runtime/mercury_conf_param.h:
Add configuration macros MR_BOEHM_GC and MR_MPS_GC.
Set MR_CONSERVATIVE_GC if either of these is set.
Default to MR_BOEHM_GC if only MR_CONSERVATIVE_GC is set.
runtime/mercury_context.h:
runtime/mercury_deep_copy.h:
runtime/mercury_engine.h:
runtime/mercury_float.h:
runtime/mercury_heap.h:
Explictly #include "mercury_conf.h", so that
MR_CONSERVATIVE_GC will be set properly before it is tested.
runtime/mercury_grade.h:
Handle the .mps grade component.
runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
runtime/mercury_memory_handlers.c:
Move the call to MR_setup_signals() earlier in the
initialization sequence, so that the MPS signal handlers
get installed after our signal handlers. This is needed
because our signal handlers assume that any signals that
they can't handle are fatal errors, which interfere's
with MPS's use of signal handlers for memory barriers.
runtime/mercury_wrapper.c:
Add code to initialize the MPS collector.
Put code which is specific to the Boehm collector inside
#ifdef MR_BOEHM_GC rather than #ifdef MR_CONSERVATIVE_GC.
runtime/mercury_wrapper.h:
Update a comment.
|
||
|
|
904c577d72 |
Avoid a bunch of warning messages from the C compiler.
Estimated hours taken: 0.1 Branches: main Avoid a bunch of warning messages from the C compiler. runtime/mercury.h: #include mercury_misc.h, for the declaration of MR_fatal_error. (mercury_imp.h already #includes mercury_misc.h.) |
||
|
|
bac4b47f2a |
Harmonize the treatment of the builtin types by the runtime system across
Estimated hours taken: 36
Branches: main
Harmonize the treatment of the builtin types by the runtime system across
the MLDS and LLDS C backends. (Their treatment by the .NET and Java backends
is unchanged, at least for now.)
Previously, the RTTI data structures and unify and compare predicates for the
builtin types were defined in runtime/mercury.c for the MLDS backend but in
library/{builtin,private_builtin,type_desc}.m for the LLDS backend. This
make several kinds of maintenance difficult, and more likely to be forgotten.
The two backends also had their generic unify/compare code in different modules
(mercury.c and mercuy_ho_call.c) and used distinct macros for defining RTTI
data structures. This change fixes those problems by defining a consistent
set of macros (with backend-specific implementations but backend-independent
semantics), concentrating the definitions of all the RTTI structures and of all
the unify and compare predicates for builtin types in a new module in the
runtime, mercury_builtin_types.[ch], and concentrating all the generic
unify/compare predicates in mercury_ho_call.[ch].
This change also makes the runtime use consistently module qualified names
for the RTTI data structures for the builtin types. Since they are not module
qualified by the Mercury compiler, we module qualify them by macros that map
the mmc-generated names to the ones expected by the runtime system. This makes
it easier to use the same macros in LLDS and MLDS grades.
runtime/mercury_builtin_types.[ch]:
New module to contain all the C code for the implementation of
unify and compare predicates for the builtin types. Its contents
comes from mercury.c in the runtime (for the MLDS C backend) and
builtin.m, private_builtin.m and type_desc.m in the library (for the
LLDS C backend).
The unify/compare predicates for tuples now report errors. This is
necessary because the tuple is a variable arity constructor. Their
previous implementations for the MLDS backend relied on only being
called from the generic unify/compare routines with a nonstandard
interface, being passed a typeinfo for the tuple type, rather than
the typeinfos for the arguments of the type constructor. This worked
because we don't currently specialize unifies/compares of tuple types,
but was a potential problem if we ever started to do such
specialization. The fix is to handle tuples in the generic
unify/compare routines, just as in the LLDS backend.
runtime/mercury_ho_call.c:
Move the generic unify/compare routines for the MLDS backend here
from mercury.c.
Conform to the coding standard wrt indentation.
runtime/mercury_ho_call.h:
Declare the generic unify/compare routines for both backends.
Delete a typedef that now needs to be in mercury_types.h to avoid
circular dependencies.
runtime/mercury_type_info.h:
Use the same macros for defining type_ctor_info structures for the MLDS
and LLDS backends.
This required moving the definitions of MR_UnifyFunc_N and
MR_CompareFunc_N here from mercury.c.
runtime/mercury_hlc_types.h:
A new file containing definitions of types needed by the MLDS C
backend. These definitions used to be in mercury.h, but now they are
needed in mercury_type_info.h, a header file that doesn't and shouldn't
include mercury.h. They can't easily be put in mercury_types.h because
they depend on mercury_std.h, and we are not allowed to include
mercury_std.h in mercury_types.h.
runtime/mercury.h:
Delete the definitions of the C types representing type_info and
pseudo_type_infos, since these are now in mercury_type_info.h.
#include mercury_type_info.h.
Delete the definitions now in mercury_hlc_types.h.
runtime/mercury.c:
Delete the definitions of the C types representing unify and compare
predicates, since these are now in mercury_type_info.h.
runtime/mercury_bootstrap.h:
Module qualify the RTTI data structures of the builtin types, since
it makes it easier to use the same macros to define RTTI structures
in the LLDS and MLDS backend. (Previously, mercury_bootstrap.h had
macros to delete such module qualification for the variable arity
types.)
runtime/mercury_types.h:
Move some type definitions from mercury_ho_call.h and
mercury_deep_profiling.h to mercury_types.h to prevent problems
with circular dependencies between header files.
runtime/mercury_debug.h:
Delete a #include to prevent a circular dependency.
runtime/mercury_profiling_builtin.[ch]:
A new module containing the {call,exit,redo,fail} port predicates
for deep profiling, moved here from library/profiling_builtin.m.
They are referred to by the implementations of the unify and compare
predicates of builtin types, and thus they need to be in the runtime
directory to avoid references from the runtime to the library.
runtime/Mmakefile:
Add the new files.
tools/make_port_code:
A script to generate runtime/mercury_profiling_builtin.[ch] fully
automatically.
library/array.m:
Use the new backend-independent macros to reduce the amount of code
that was duplicated for the two backends.
library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
Delete RTTI structures and unify and compare predicates
that are now in runtime/mercury_builtin_types.c.
library/profiling_builtin.m:
Replace the definitions of the predicates implementing the
{call,exit,redo,fail} port predicates with external declarations.
trace/mercury_trace_vars.c:
Use a now backend-independent macro to refer to a type_ctor_info.
trace/Mmakefile:
Do not define MERCURY_BOOTSTRAP_H, since mercury_bootstrap.h now
contains some definitions needed by code in the trace directory.
Replace it with MR_NO_BACKWARDS_COMPAT.
util/mkinit.c:
Module qualify the references to the RTTI structures of builtin types,
since the generated _init.c files don't include mercury_bootstrap.h.
Note that after this change has bootstrapped, we should be able to
delete those references, since they were only needed to give the
runtime access to the addresses of RTTI structures that used to be
defined in the library, but are now defined in the runtime.
|
||
|
|
404abb0c57 |
Another step towards RTTI in Mercury.
Estimated hours taken: 32
Branches: main
Another step towards RTTI in Mercury.
This step redefines the representation of type_ctor_infos inside the compiler
to be identical to the representation we will need for efficient interpretation
of RTTI data structures in Mercury, following on from an earlier step which
did the same for (pseudo)typeinfos.
Instead of the type_ctor_info being broken down into its components in
type_ctor_info.m, the breakdown process is now performed in rtti_out.m (for the
LLDS backend) and rtti_to_mlds.m (for the MLDS backend). Eventually, the IL and
Java backends will stop using rtti_to_mlds.m for this purpose, and will instead
write out the type_ctor_data structures as static data to be interpreted
directly.
We now predefine the C types representing type_info and pseudo_type_infos
for types of arity up to 20 for the LLDS C backend as well as for the
MLDS C backend. The LLDS backend can define them for higher arities
on demand; the MLDS backend (for now) still cannot.
runtime/mercury_type_info.h:
To be able to represent all the kinds of types we now support
- add a data structure for converting values of reserved_addr types
from their printable representation to their internal representation
(it was previously missing), and
- add a type_ctor_rep to represent foreign types.
Add missing MR_ prefixes on some field names.
Add typedefs for all the types that the rtti_names can refer to.
There were already such typedefs in runtime/mercury.h for the MLDS
grades, we now have them for the LLDS grades too.
Predefine the C types representing type_info and pseudo_type_infos
for types of arity up to 20. There were already such typedefs in
runtime/mercury.h for the MLDS grades, we now have them for the
LLDS grades too.
runtime/mercury.h:
Delete the typedefs that are now in mercury_type_info.h.
runtime/mercury.h:
Delete the definitions of the C types representing type_info and
pseudo_type_infos, since these are now in mercury_type_info.h.
#include mercury_type_info.h.
compiler/rtti.m:
Add new, purely Mercury data structures for representing
type_ctor_infos and their components, designed both for efficient
interpretation and as a source for the generation of static data
structures in C.
This entailed deleting most of the alternatives of the rtti_data type
while preserving their rtti_name equivalents; the deleted alternatives
represent tables are no longer created in type_ctor_info.m but which
are created dynamically in rtti_out.m and rtti_to_mlds.m (which need
a way for one table to refer to another).
Centralize the correspondence between rtti_names and the C and Java
types of the corresponding structures (the C and Java names differ in
prefixes only). Among other things, this remove the double maintenance
problem we have previously with the LLDS and MLDS backends maintaining
their own maps of the correspondence.
Add utility predicates on the new data structures for use by both
rtti_out.m and rtti_to_mlds.m.
compiler/hlds_module.m:
Always store the ids of unification and comparison procedures in
type_ctor_gen_infos, to simplify their handling.
compiler/type_ctor_info.m:
Generate the new data structures for representing type_ctor_infos.
Conform to the changed data structures for type_ctor_gen_infos.
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
Rewrite substantial parts of these modules to convert the new data
structures for representing type_ctor_infos to sets of discrete
structures dynamically.
Most of the dynamically created structures are unique by construction,
but this is not true for typeinfos and pseudo-typeinfos. Therefore
add mechanisms to ensure that we don't generate redundant structures
representing typeinfos and pseudo-typeinfos.
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
Use the standard mechanisms for creating C and Java type names.
compiler/mlds_to_gcc.m:
Conform to the changed data structures in rtti.m and
mercury_type_info.h.
compiler/opt_debug.m:
Conform to the changed data structures in rtti.m.
compiler/dead_proc_elim.m:
Conform to the changed data structures for type_ctor_gen_infos.
compiler/pseudo_type_info.m:
Add a predicate to construct a representation of a type that may or may
not be ground.
compiler/mlds_to_gcc.m:
java/runtime/TypeCtorRep.java:
library/private_builtin.m:
library/rtti_implemenation.m:
runtime/mercury_mcpp.{cpp,h}:
Add the type_ctor_rep for foreign types to the lists of type_ctor_reps.
library/construct.m:
library/deconstruct.m:
Add missing MR_ prefixes on field names.
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
runtime/mercury_unify_compare_body.h:
Handle the type_ctor_rep for foreign types.
Add missing MR_ prefixes on field names.
library/list.m:
Add two utility predicates, is_empty and is_not_empty, for use with
higher order code.
NEWS:
Mention the new predicates in list.m. Delete a duplicate entry.
|
||
|
|
56e818af67 |
Implement compare_representation/3, which is like compare except that it
Estimated hours taken: 5.5 Branches: main Implement compare_representation/3, which is like compare except that it is cc_multi, and it doesn't abort on non-canonical types. The implementation only works for the LLDS backend; in other cases, the runtime aborts with a "sorry" message. For this reason, it is not officially part of the standard library yet. library/std_util.m: Add the new predicate, which is implemented via "external". runtime/mercury_ho_call.c: Implement compare_representation/3, and also a C version. runtime/mercury_unify_compare_body.h: Implement the body of compare_representation/3. When the macro include_compare_rep_code is defined comparison of preds and funcs doesn't abort, the code that is used for MR_COMPARE_BY_RTTI is enabled, and usereq types are treated as normal types. runtime/mercury_conf_param.h: Document the fact that calls to compare_representation are counted as calls to compare for the purposes of MR_TYPE_CTOR_STATS. runtime/Mmakefile: Bug fix: add missing pic_o versions of the explicit dependencies. Use variables for the suffixes in these dependencies. runtime/mercury.c: runtime/mercury.h: Supply a HIGHLEVEL_CODE version of the new predicate. This just gives a "Sorry, not implemented" message and aborts. tests/hard_coded/Mmakefile: tests/hard_coded/compare_rep_usereq.exp: tests/hard_coded/compare_rep_usereq.m: tests/hard_coded/compare_representation.exp: tests/hard_coded/compare_representation.m: Test cases. tests/hard_coded/compare_rep_array.m: A test case which doesn't work yet. |
||
|
|
194cef40da |
Add some #defines to avoid bootstrapping problems in hlc grades.
Estimated hours taken: 0.5 Branches: main runtime/mercury.h: Add some #defines to avoid bootstrapping problems in hlc grades. |
||
|
|
43fbf4b956 |
A step towards RTTI in Mercury.
Estimated hours taken: 40 Branches: main A step towards RTTI in Mercury. This step redefines the representation of pseudo-typeinfos inside the compiler to be identical to the representation we will need for efficient interpretation of RTTI data structures in Mercury. Later steps will do likewise for typectorinfos. In the end, we will have two implementations of RTTI: the current low-level, very efficient one written in C, which will be used by the C backends (both LLDS and MLDS), and a new, higher-level one which will use Mercury data structures and Mercury predicates for interpretation (along the lines of library/rtti_implementation.m) for the Java and IL backends. A large part of this change concerns the fact that pseudo-typeinfos can now contain typeinfos as well as other pseudo-typeinfos, and they do in the frequent case that the type of an argument is ground. Given that typeinfos are just special cases of pseudo-typeinfos, the code for handling the two types is usually similar, with common code factored out when relevant. In the process of redesigning the data structures concerning (pseudo-) typeinfos, I also fixed an old naming scheme that has become misleading. The representation of a (pseudo-) typeinfo depends on whether the principal type constructor is fixed arity or not. We used to denote this distinction with the phrases first-order vs higher-order, since at first the only variable arity type constructors were pred and func. However, this hasn't been true since we added tuples. I have changed the naming scheme to be fixed-arity vs variable-arity. compiler/rtti.m: Add new, purely Mercury data structures for representing typeinfos and pseudo-typeinfos, designed both for efficient interpretation and as a source for the generation of static data structures in C. compiler/pseudo_type_info.m: Delete the type definitions here, since they are superseded by the new definitions in rtti.m. Add predicates for constructing typeinfos as well as pseudo-typeinfos, since now we need those too. Conform to the changed data structures for (pseudo-) typeinfos. compiler/ll_pseudo_type_info.m: compiler/ml_closure_gen.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: compiler/opt_debug.m: compiler/type_ctor_info.m: Conform to the changed data structures for (pseudo-) typeinfos. compiler/mlds.m: Since the MLDS now refers to type_infos, add their type (mlds__type_info_type) to the list of types the MLDS knows about. compiler/ml_code_util.m: compiler/mlds_to_c.m: compiler/mlds_to_il.m: compiler/mlds_to_java.m: Handle mlds__type_info_type. compiler/mlds_to_gcc.m: Conform to the changed data structures for (pseudo-) typeinfos, and handle mlds__type_info_type. runtime/mercury_bootstrap.h: Override the compiler-generated names of the type_ctor_infos of the variable arity type constructors. The MLDS backend requires these to be module qualified; the LLDS backend requires them to be unqualified. This is a problem because the same code now generates the compiler's internal representation of pseudo-typeinfos for both backends. The temporary solution is to have the compiler generate these names module qualified, and have these macros convert them to the unqualified form. (The long term solution should be to always module qualify everything, but doing that is for another change.) runtime/mercury_type_info.h: Change the naming scheme from first order vs higher order to fixed arity vs variable arity. library/construct.m: library/deconstruct.m: runtime/mercury.c: runtime/mercury_construct.c: runtime/mercury_deconstruct.c: runtime/mercury_deep_copy_body.h: runtime/mercury_make_type_info_body.h: runtime/mercury_ml_expand_body.h: runtime/mercury_tabling.c: runtime/mercury_type_desc.c: runtime/mercury_type_info.c: runtime/mercury_unify_compare_body.h: Conform to the new naming scheme. runtime/mercury.h: Conform to the new naming scheme. Declare fixed and variable arity types for typeinfos as well as pseudo-typeinfos, since pseudo-typeinfos can now refer to typeinfos. |
||
|
|
0acbaa7bca |
Some more steps towards accurate GC for the MLDS->C back-end.
Estimated hours taken: 24 Branches: main Some more steps towards accurate GC for the MLDS->C back-end. compiler/ml_closure_gen.m: Generate GC tracing code for some (XXX but still not yet all) of the local variables declared in closure wrapper functions. compiler/ml_code_util.m: Add a new procedure ml_gen_maybe_gc_trace_code_with_typeinfo, for use by ml_closure_gen.m. compiler/ml_elim_nested.m: Update the comments about accurate GC. runtime/mercury.h: Include "mercury_layout_util.h", because the code that we generate for tracing variables in closure wrapper functions uses MR_materialize_closure_type_params(). |
||
|
|
62c3375f5d |
Fix the RTTI of type_descs and type_ctor_descs.
Estimated hours taken: 40
Branches: main
Fix the RTTI of type_descs and type_ctor_descs. Make comparisons between
type_ctor_descs and type_ctor_infos (and therefore between type_descs and
type_infos) more predictable and consistent across backends by basing them
on programmer-visible attributes instead of accident of location in the
executable.
runtime/mercury_type_desc.[ch]:
Implement unification and comparison functions for type_ctor_descs.
(The unification and comparison functions for type_infos also double
as the unification and comparison functions for type_descs.)
Make the comparison function work on the module name, type name and
arity instead of the address of the type_ctor_info structure. This
ensures consistency across back ends.
Add some useful macros.
runtime/mercury_type_info.[ch]:
Make the comparison function on type_ctor_infos also work on module
name, type name and arity. Since this makes comparison slower, add
specialized unification functions for type_infos and type_ctor_infos.
runtime/mercury_type_info.h:
runtime/mercury_mcpp.{h,cpp}:
runtime/mercury.h:
library/private_builtin.m:
library/rtti_implementation.m:
java/runtime/TypeCtorRep.java:
compiler/mlds_to_gcc.m:
Add type_ctor_reps for type_descs and type_ctor_descs. Type_ctor_descs
definitely need it, since their representation is very low level and
not shared with anything else. Type_descs could use the type_ctor_rep
of type_infos, since type_descs and type_infos share the same
representation at the moment. However, we add a new one because
profiling cares about the conceptual distinction between type_infos
and type_descs.
library/type_desc.m:
Delete the Mercury "definition" of type_desc, because it is misleading.
Implement it as a builtin type.
runtime/mercury.[ch]:
Implement type_ctor_desc as a builtin type.
Add missing implementations of unify/compare on type_ctor_infos.
runtime/mercury_deconstruct.c:
runtime/mercury_ml_expand_body.h:
Implement deconstruction for type_descs and type_ctor_descs.
runtime/mercury_ho_call.c:
runtime/mercury_unify_compare_body.h:
Implement unify and compare for type_descs and type_ctor_descs.
Implement unify for type_infos, type_ctor_infos, type_descs and
type_ctor_descs by calling the relevant unification function,
not the relevant comparison function, since the unification
function will be faster.
runtime/mercury_deep_copy_body.h:
runtime/mercury_construct.c:
runtime/mercury_tabling.c:
Minor changes to handle type_descs and type_ctor_descs.
trace/mercury_trace_vars.c:
Enable the printing of type_descs and type_ctor_descs.
tests/debugger/type_desc_test.{m,inp,exp,exp2}:
New test case to check the printing of type_descs and type_ctor_descs.
tests/debugger/Mmakefile:
Enable the new test case.
tests/hard_coded/type_ctor_desc_manip.{m,exp}:
New test case to check the deconstruction and comparison of type_descs
and (especially) type_ctor_descs. Before this change, we got different
results for comparisons of type_ctor_descs, results that were
inconsistent with the results of comparisons of the type_descs
that the type_ctor_descs were derived from.
tests/hard_coded/Mmakefile:
Enable the new test case.
|
||
|
|
a25440e708 |
Fix a bug with the handling of zero-arity higher-order types that broke
Estimated hours taken: 0.25 Branches: main Fix a bug with the handling of zero-arity higher-order types that broke tests/valid/lambda_quant.m. The bug was exposed by my recent change to generate closure layouts in the MLDS back-end. runtime/mercury.h: Define MR_HO_PseudoTypeInfo_Struct0. |
||
|
|
b7c4a317e9 |
Add MR_ prefixes to the remaining non-prefixed symbols.
Estimated hours taken: 4 Branches: main Add MR_ prefixes to the remaining non-prefixed symbols. This change will require all workspaces to be updated The compiler will start generating references to MR_TRUE, MR_bool, etc., which are not defined in the old runtime header files. runtime/mercury_std.h: Add MR_ prefixes to bool, TRUE, FALSE, max, min, streq, strdiff, strtest, strntest, strneq, strndiff, strntest, NO_RETURN. Delete a commented out definition of `reg'. runtime/mercury_tags.h: Add an MR_ prefix to TAGBITS. configure.in: runtime/mercury_goto.h: runtime/machdeps/i386_regs.h/mercury_goto.h: Add an MR_ prefix to PIC. runtime/mercury_conf_param.h: Allow non-prefixed PIC and HIGHTAGS to be defined on the command line. runtime/mercury_bootstrap.h: Add backwards compatibility definitions. RESERVED_MACRO_NAMES: Remove the renamed macros. compiler/export.m: compiler/ml_code_gen.m: Use MR_bool rather than MR_Bool (MR_Bool is meant to be for references to the Mercury type bool__bool). runtime/mercury_types.h: Add a comment the MR_Bool is for references to bool__bool. */*.c: */*.h: */*.m: Add MR_ prefixes. |
||
|
|
c66cea0665 |
Add MR_ prefixes to uses of configuration macros.
Estimated hours taken: 2.5 Branches: main Add MR_ prefixes to uses of configuration macros. Bootcheck now succeeds with MR_NO_CONF_BACKWARDS_COMPAT. Mmake.common.in: Define MR_NO_CONF_BACKWARDS_COMPAT when checking for namespace cleanliness. RESERVED_MACRO_NAMES: Remove the configuration macros. runtime/mercury_conf_bootstrap.h: Remove a duplicate definition of BOXED_FLOAT. configure.in: */*.c: */*.h: */*.m: Add MR_ prefixes. |
||
|
|
af62036bff |
Two related changes for accurate GC with the MLDS->C back-end:
Estimated hours taken: 2 Branches: main Two related changes for accurate GC with the MLDS->C back-end: - Add a new runtime option --heap-margin-size for the threshold of free heap space before a collection is invoked, rather than the previous hack of reusing --heap-zone-size for that purpose. - A minor optimization to reduce the cost of MR_gc_check(): cache the value of MR_zone_end - MR_heap_margin_size. runtime/mercury_wrapper.h: runtime/mercury_wrapper.c: runtime/mercury_memory.c: Add new variable `MR_heap_margin_size', and add a new runtime option `--heap-margin-size' to set it. runtime/mercury_memory_zones.h: Add new field `gc_threshold' to the MR_MemoryZone struct. runtime/mercury_memory_zones.c: Initialize the new field to point to the zone end minus MR_heap_margin_size. runtime/mercury.h: Change MR_GC_check() to use the `gc_threshold' field. |
||
|
|
7622e889e0 |
Define the `heap_pointer' type in private_builtin.m as a new builtin
Estimated hours taken: 2 Branches: main Define the `heap_pointer' type in private_builtin.m as a new builtin type with representation MR_TYPECTOR_REP_HP, rather than as equivalent to `c_pointer'. This is needed so that the accurate garbage collector can tell saved heap pointer values apart from other c_pointer values, which it needs to do in order to handle saved heap pointer values. library/private_builtin.m: runtime/mercury.h: runtime/mercury.c: Define the type_ctor_info etc. for the heap_pointer type. compiler/type_util.m: Add a new function `heap_pointer_type'. compiler/add_heap_ops.m: Use `heap_pointer_type' from type_util.m. |
||
|
|
98ce6a1dcc |
Fix a compilation error in grade hl.gc:
Estimated hours taken: 0.25 Branches: main runtime/mercury.h: Fix a compilation error in grade hl.gc: s/std_util__type_desc/type_desc__type_desc/ |
||
|
|
eee5c27261 |
Extend the workaround for a module qualification bug that we use for
Estimated hours taken: 0.1 Branches: main runtime/mercury.h: runtime/RESERVED_MACRO_NAMES: Extend the workaround for a module qualification bug that we use for the other builtin types to void and func. |
||
|
|
2b559ad054 |
Move the RTTI-related parts of std_util.m to three new modules in the standard
Estimated hours taken: 8
Branches: main
Move the RTTI-related parts of std_util.m to three new modules in the standard
library, and (in the case of embedded C code) to new modules in the runtime.
The main reason for this is to allow a reorganization of some of the
RTTi-related functionality without breaking backward compatibility. However,
the new arrangement should also be easier to maintain.
Use a separate type_ctor_rep for functions, to distinguish them from predicates
for RTTI code. (At one point, I thought this could avoid the need for the
change to the initialization files mentioned below. It can't, but it is a good
idea in any case.)
library/std_util.m:
Remove the functionality moved to the new modules, and replace them
with type equivalences and forwarding code. There are no changes in
the meanings of the user-visible predicates, with two exceptions.
- First, the true, equivalence-expanded names of what used to be
std_util:type_desc and std_util:type_ctor_desc are now
type_desc:type_desc and type_desc: type_ctor_desc.
- Second, deconstructing a function term now yields
"<<function>>" instead of "<<predicate>>".
The intention is that the RTTI predicates in std_util.m will continue
to work in a backwards-compatible manner for the near future, i.e. as
the new modules are updated, the code in std_util will be updated to
maintain the same functionality, modulo improvements such as avoiding
unwanted exceptions. When the RTTI functionality in the other modules
has stabilised, the RTTI predicates in std_util.m should be marked
obsolete.
The exported but non-documented functionality of std_util has been
moved to one of the new modules without forwarding code, with one
of the moved predicates being turned into the function it should have
been in the first place.
library/construct.m:
library/deconstruct.m:
library/type_desc.m:
Three new modules for the code moved from std_util.m.
library/library.m:
compiler/modules.m:
Record the names of the three new library modules.
runtime/mercury.[ch]:
compiler/mlds_to_il.m:
Record that type_desc is now in type_desc.m, not std_util.m.
compiler/static_term.m:
Import the deconstruct module, since we are using its undocumented
facilities.
runtime/Mmakefile:
Mention the two new modules.
runtime/mercury_construct.[ch]:
runtime/mercury_type_desc.[ch]:
Two new modules holding the C functions that used to be in foreign_code
in std_util, now using MR_ instead of ML_ prefixes, and being more
consistent about indentation.
runtime/mercury_type_info.h:
Add a new type_ctor_rep for functions, separate from predicates.
(It reuses the EQUIV_VAR type_ctor_rep, which hasn't been used
in ages.)
Use type_ctor_reps to distinguish between the type_ctor_infos of
pred/0 and func/0. However, to create higher order typeinfos, we
still need to know the addresses of the type_ctor_infos for
pred/0 and func/0, and we still need to know the address of the
type_ctor_info for tuples to create typeinfos for tuples. Since
these three type_ctor_infos are defined in the library,
we cannot access them directly from the runtime. We therefore need
to access them indirectly in the usual manner, via address_of
variables initialized by mkinit-generated code.
library/builtin.m:
library/private_builtin.m:
library/rtti_implementation.m:
runtime/mercury.c:
runtime/mercury_mcpp.{h,cpp}:
java/TypeCtorRep.java:
Updates to accommondate the new function type_ctor_rep.
runtime/mercury_type_info.[ch]:
Add some functions from foreign_code in std_util that fit in best here.
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.h:
runtime/mercury_unify_compare_body.h:
Delete the code for handling EQUIV_VAR, and add code for handling
functions.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
Add three variables holding the address of the type_ctor_infos
representing functions, predicates and tuples.
util/mkinit.c:
Fill in these three variables.
tests/general/accumulator/construct.{m,exp}:
tests/general/accumulator/deconstruct.{m,exp}:
tests/hard_coded/construct.{m,exp}:
Rename these tests by adding a _test at the ends of their names,
in order to avoid collisions with the names of the new standard library
modules. The test cases have not changed, with the exception of the :-
module declaration of course.
tests/general/accumulator/Mmakefile:
tests/general/accumulator/INTRODUCED:
tests/hard_coded/Mmakefile:
Record the name changes.
tests/hard_coded/existential_float.exp:
Updated the expected output to reflect that deconstructions now print
"<<function>>" instead of "<<predicate>>" when appropriate.
tests/hard_coded/higher_order_type_manip.exp:
Updated the expected output to reflect the new name of what used to be
std_util:type_desc.
trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
#include type_desc.h instead of std_util.h, since the C functions
we want to call are now defined there.
trace/mercury_trace_vars.c:
Update to account for the movement of type_desc from std_util to
type_desc, and ensure that we don't refer to any type_ctor_infos
in MLDS grades.
|
||
|
|
71c25b3d11 |
More improvements to accurate GC for the MLDS->C back-end.
Estimated hours taken: 8 Branches: main More improvements to accurate GC for the MLDS->C back-end. runtime/mercury_accurate_gc.h: runtime/mercury_accurate_gc.c: Add new routine MR_garbage_collect(). runtime/mercury_memory_handlers.c: Wrap `#ifndef MR_HIGHLEVEL_CODE' around some LLDS-specific code for accurate GC. runtime/mercury_accurate_gc.c: runtime/mercury_memory_handlers.c: Fix some software rot: missing `MR_' and `MR_eng_' prefixes. runtime/mercury.h: Add MR_GC_check() macro, which invokes MR_garbage_collect() if needed. compiler/mlds.m: Add gc_check as a new mlds__atomic_statement. compiler/ml_elim_nested.m: Insert gc_check statements at the start of every procedure that does any heap allocation. compiler/ml_elim_nested.m: compiler/mlds_to_c.m: compiler/mlds_to_java.m: compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: Minor changes to handle gc_check statements. compiler/ml_code_util.m: Fix some bugs in the way that we were calling private_builtin__gc_trace/1. |
||
|
|
d3d54478df |
Fix a bug in my earlier change to add the first part of
Estimated hours taken: 3 Branches: main Fix a bug in my earlier change to add the first part of support for accurate GC for the MLDS->C back-end. The bug was that it was trying to access `stack_chain->prev' when `stack_chain' had type `void *'. compiler/ml_elim_nested.m: Use a field offset, rather than a named field, to access the `prev' field of the the `stack_chain' global. runtime/mercury.h: Mention that ml_elim_nested.m assumes that the `prev' field is at offset zero. |
||
|
|
af15e1f5d1 |
Preliminary steps towards support for accurate GC
Branches: main Estimated hours taken: 20 Preliminary steps towards support for accurate GC in the MLDS->C back-end. compiler/ml_elim_nested.m: Add support for a new pass that puts local variables that might contain pointers into a struct, and chains these structs together. compiler/mercury_compile.m: Invoke the new pass (if `--gc accurate'). runtime/mercury.h: runtime/mercury.c: Declare the `stack_chain' global variable that points to the head of the chain. |
||
|
|
32dbe7dbf1 |
Increase the fixed limit on the arity of types from 10 to 20,
Estimated hours taken: 1 Branches: main runtime/mercury.h: Increase the fixed limit on the arity of types from 10 to 20, since the limit of 10 is exceeded by extras/quickcheck/qcheck.m. |
||
|
|
bb52e7bc8d |
Add support for `--gc none' to the MLDS->C back-end,
Estimated hours taken: 8 Branches: main Add support for `--gc none' to the MLDS->C back-end, i.e. support the `hlc' and `hl' grades. runtime/mercury_float.h: Extra some of the code from MR_float_to_word() out into a new macro MR_make_hp_float_aligned(), for use in MR_box_float(). runtime/mercury.h: If CONSERVATIVE_GC is not defined, include "mercury_regs.h" and "mercury_engine.h", so that we get the definition of MR_hp, and "mercury_overflow.h", for MR_heap_overflow_check(). Define MR_new_object() and MR_box_float() correctly for the !CONSERVATIVE_GC case. runtime/mercury_context.h: runtime/mercury_context.c: runtime/mercury_engine.c: runtime/mercury_debug.c: runtime/mercury_thread.c: runtime/mercury_stack_trace.c: trace/mercury_trace_util.c: Add `#ifndef MR_HIGHLEVEL_CODE ... #endif' wrappers around sections of code that are specific to the LLDS back-end. runtime/mercury_wrapper.c: library/benchmarking.m: Initialize (in mercury_wrapper.c) and use (in benchmarking.m) the MercuryEngine struct in the !CONSERVATIVE_GC case, as well as in the !MR_HIGHLEVEL_CODE case. The MercuryEngine struct is needed because that is where the heap pointer and heap zone are stored. library/table_builtin.m: Use the correct names for type_ctor_infos when MR_HIGHLEVEL_CODE is enabled. (Previously this was not an issue because these type_ctor_infos were only being used in the !CONSERVATIVE_GC case.) tests/hard_coded/Mmakefile: For the test cases which use lots of memory, increase the heap size (using the MERCURY_OPTIONS environment variable) rather than compiling them with `--gc conservative'. This avoids spurious test case failures when running the tests via `tools/bootcheck --grade hlc --no-bootcheck'. |
||
|
|
404ee96dad |
Fix C compiler warnings in the C code generated
Branches: main Estimated hours taken: 1.5 Fix C compiler warnings in the C code generated when using reserved addresses. compiler/ml_unify_gen.m: When generating reserved address constants, add an explicit downcast, for targets that need it. This avoids compiler warnings in the C code generated by the MLDS->C back-end. compiler/rtti_to_mlds.m: Pass the module_info to ml_gen_reserved_address. runtime/mercury.h: Fix a bug where there was one too many levels of indirection in the definition of MR_ReservedAddrs. runtime/mercury_type_info.h: runtime/mercury_deep_copy_body.h: Add `const' to the definition of MR_DuTypeLayout. |
||
|
|
def21a3675 |
Add RTTI support for the new reserved address data representations.
Estimated hours taken: 18 Branches: main Add RTTI support for the new reserved address data representations. runtime/mercury_type_info.h: runtime/mercury_mcpp.h: runtime/mercury.h: library/private_builtin.m: library/rtti_implementation.m: Add MR_TYPECTOR_REP_RESERVED_ADDR (with and without _USEREQ) to the MR_TypeCtorRep enum, for discriminated union types containing one or more functors represented using reserved addresses, and add new RTTI structs to hold information about how such types are represented. compiler/type_ctor_info.m: compiler/mlds_to_gcc.m: compiler/opt_debug.m: compiler/rtti.m: compiler/rtti_out.m: compiler/rtti_to_mlds.m: Add appropriate code to generate these new RTTI structs. runtime/mercury_deep_copy_body.h: runtime/mercury_ml_expand_body.h: runtime/mercury_unify_compare_body.h: runtime/mercury_tabling.c: library/std_util.m: Add code to handle the MR_TYPECTOR_REP_RESERVED_ADDR alternative, using the information in the new RTTI structs. |
||
|
|
04e614485d |
Implement deep profiling; merge the changes on the deep2 branch back
Estimated hours taken: 500 Branches: main Implement deep profiling; merge the changes on the deep2 branch back onto the trunk. The main documentation on the general architecture of the deep profiler is the deep profiling paper. doc/user_guide.texi: Document how to use the deep profiler. deep_profiler: deep_profiler/Mmakefile: A new directory holding the deep profiler and its mmakefile. Mmakefile: Add targets for the new directory. Add support for removing inappropriate files from directories. deep_profiler/interface.m: The deep profiler consists of two programs: mdprof_cgi.m, which acts as a CGI "script", and mdprof_server.m, which implements the server process that the CGI script talks to. Interface.m defines the interface between them. script/mdprof.in: A shell script template. ../configure uses it to generate mdprof, which is a wrapper around mdprof_cgi that tells it how to find mdprof_server. deep_profiler/mdprof_cgi.m: The CGI "script" program. deep_profiler/mdprof_server.m: The top level predicates of the server. deep_profiler/profile.m: The main data structures of the server and their operations. deep_profiler/read_profile.m: Code for reading in profiling data files. deep_profiler/startup.m: Code for post-processing the information in profiling data files, propagating costs from procedures to their ancestors and performing various kinds of summaries. deep_profiler/server.m: Code for responding to requests from the CGI script. deep_profiler/cliques.m: Code to find cliques in graphs. deep_profiler/array_util.m: deep_profiler/util.m: Utility predicates. deep_profiler/dense_bitset.m: An implementation of (part of) the set ADT with dense bit vectors. deep_profiler/measurements.m: Operations on profiling measurements. deep_profiler/timeout.m: An implementation of a timeout facility. deep_profiler/conf.m: Functions that depend on autoconfigured settings. configure.in: Find out what command to use to find the name of the local host. Install deep profiling versions of the standard library along with the other profiling versions. runtime/mercury_conf.h.in: Add some macros for deep_profiler/conf.m to use. library/profiling_builtin.m: runtime/mercury_deep_call_port_body.h: runtime/mercury_deep_leave_port_body.h: runtime/mercury_deep_redo_port_body.h: A new library module that implements deep profiling primitives. Some of these primitives have many versions, whose common code is factor is factored out in three new include files in the runtime. compiler/deep_profiling.m: New module to perform the program transformations described in the paper. compiler/notes/compiler_design.html: Document the new compiler module. compiler/mercury_compiler.m: Invoke the new module in deep profiling grades. Allow global static data to be generated by deep_profiling.m. compiler/options.m: Add options to turn on deep profiling and (for benchmarking purposes) control its implementation. Add an optiooption disable tailcall optimization in the LLDS backend, to help benchmarking deep profiling. compiler/jumpopt.m: compiler/optimize.m: Obey the option to disable tailcalls. compiler/handle_options.m: Handle the implications of deep profiling. compiler/modules.m: In deep profiling grades, automatically import profiling_builtin.m. compiler/prog_util.m: doc/Makefile: library/library.m: Handle the new builtin module. compiler/export.m: In deep profiling grades, wrap deep profiling code around exported procedures to handle the "unscheduled call" aspects of callbacks to Mercury from the foreign language. compiler/higher_order.m: profiler/demangle.m: util/demangle.c: When creating a name for a higher-order-specialized predicate, include the mode number in the name. compiler/add_trail_ops.m: compiler/type_util.m: Move c_pointer_type from add_trail_ops to type_util, so it can also be used by deep_profiling.m. compiler/hlds_goal.m: Add a new goal feature that marks a tail call, for use by deep_profiling.m. compiler/hlds_pred.m: Add a new field to proc_info structures for use by deep_profiling.m. Add a mechanism for getting proc_ids for procedure clones. Remove next_proc_id, an obsolete and unused predicate. compiler/hlds_data.m: Add a new cons_id to refer to the proc_static structure of a procedure. compiler/bytecode_gen.m: compiler/code_util.m: compiler/dependency_graph.m: compiler/hlds_out.m: compiler/mercury_to_mercury.m: compiler/ml_unify_gen.m: compiler/opt_debug.m: compiler/prog_rep.m: compiler/rl_exprn.m: compiler/switch_util.m: compiler/unify_gen.m: Trivial changes to handle the new cons_id, goal feature and/or proc_info argument. compiler/rtti.m: Add a utility predicate for extracting pred_id and proc_id from an rtti_proc_label, for use by hlds_out.m compiler/layout.m: compiler/layout_out.m: compiler/llds.m: compiler/llds_common.m: Add support for proc_static and call_site_static structures. compiler/layout_out.m: compiler/llds_out.m: Add code for the output of proc_static structures. compiler/code_util.m: Make code_util__make_proc_label_from_rtti a function, and export it. util/mkinit.c: compiler/llds_out.m: compiler/layout.m: compiler/modules.m: Add support for a fourth per-module C function, for writing out proc_static structures (and the call_site_static structures they contains). Since proc_static structures can be referred to from LLDS code (and not just from other static structures and compiler-generated C code), reorganize the declarations of static structures slightly. Change the schema for the name of the first per-module C function slightly, to make it the addition of the fourth function easier. The scheme now is: mercury__<modulename>__init mercury__<modulename>__init_type_tables mercury__<modulename>__init_debugger mercury__<modulename>__write_out_proc_statics Improve formatting of the generated C code. library/*.m: runtime/mercury.c: runtime/mercury_context.c: runtime/mercury_engine.c: runtime/mercury_ho_call.c: runtime/mercury_tabling.c: runtime/mercury_trace_base.c: runtime/mercury_wrapper.c: trace/mercrury_trace.[ch]: trace/mercrury_trace_declarative.c: trace/mercrury_trace_external.c: trace/mercrury_trace_internal.c: Conform to the new scheme for initialization functions for hand-written modules. compiler/mercury_compile.m: library/benchmarking.m: runtime/mercury_conf_param.h: runtime/mercury.h: runtime/mercury_engine.c: runtime/mercury_goto.c: runtime/mercury_grade.h: runtime/mercury_ho_call.c: runtime/mercury_label.[ch]: runtime/mercury_prof.[ch]: Add an MR_MPROF_ prefix in front of the C macros used to control the old profiler. compiler/handle_options.m: runtime/mercury_grade.h: scripts/canonical_grade.sh-subr: scripts/init_grade_options.sh-subr: scripts/parse_grade_options.sh-subr: Make deep profiling completely separate from the old profiling system, by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME and the compiler option --profile-time. library/array.m: library/builtin.m: library/std_util.m: runtime/mercury_hand_unify_body.h: runtime/mercury_hand_compare_body.h: In deep profiling grades, wrap the deep profiling call, exit, fail and redo codes around the bodies of hand-written unification and comparison procedures. Make the reporting of array bounds violations switchable between making them fatal errors, as we currently, and reporting them by throwing an exception. Throwing an exception makes debugging code using arrays easier, but since exceptions aren't (yet) propagated across engine boundaries, we keep the old behaviour as the default; the new behaviour is for implementors. runtime/mercury_deep_profiling_hand.h: New file that defines macros for use in Mercury predicates whose definition is in hand-written C code. library/exception.m: runtime/mercury_exception_catch_body.h: runtime/mercury_stacks.h: In deep profiling grades, wrap the deep profiling call, exit, fail and redo codes around the bodies of the various modes of builtin_catch. Provide a function that C code can use to throw exceptions. library/benchmarking.m: library/exception.m: library/gc.m: library/std_util.m: runtime/mercury_context.[ch]: runtime/mercury_engine.[ch]: runtime/mercury_debug.c: runtime/mercury_deep_copy.c: runtime/mercury_overflow.h: runtime/mercury_regs.h: runtime/mercury_stacks.h: runtime/mercury_thread.c: runtime/mercury_wrapper.c: Add prefixes to the names of the fields in the engine and context structures, to make code using them easier to understand and modify. runtime/mercury_deep_profiling.[ch]: New module containing support functions for deep profiling and functions for writing out a deep profiling data file at the end of execution. runtime/mercury_debug.[ch]: Add support for debugging deep profiling. Add support for watching the value at a given address. Make the buffered/unbuffered nature of debugging output controllable via the -du option. Print register contents only if -dr is specified. runtime/mercury_goto.h: runtime/mercury_std.h: Use the macros in mercury_std.h instead of defining local variants. runtime/mercury_goto.h: runtime/mercury_stack_layout.h: runtime/mercury_stack_trace.c: runtime/mercury_tabling.c: trace/mercury_trace.c: trace/mercury_trace_declarative.c: trace/mercury_trace_external.c: trace/mercury_trace_vars.c: Standardize some of the macro names with those used in the debugger paper. runtime/mercury_heap.h: Add support for memory profiling with the deep profiler. runtime/mercury_prof.[ch]: runtime/mercury_prof_time.[ch]: Move the functionality that both the old profiler and the deep profiler need into the new module mercury_prof_time. Leave mercury_prof containing stuff that is only relevant to the old profiler. runtime/mercury_prof.[ch]: runtime/mercury_strerror.[ch]: Move the definition of strerror from mercury_prof to its own file. runtime/mercury_wrapper.[ch]: Add support for deep profiling. Add suppory for controlling whether debugging output is buffered or not. Add support for watching the value at a given address. runtime/Mmakefile: Mention all the added files. scripts/mgnuc.in: Add an option for turning on deep profiling. Add options for controlling the details of deep profiling. These are not documented because they are intended only for benchmarking the deep profiler itself, for the paper; they are not for general use. tools/bootcheck: Compile the deep_profiler directory as well as the other directories containing Mercury code. Turn off the creation of deep profiling data files during bootcheck, since all but one of these in each directory will be overwritten anyway. Add support for turning on --keep-objs by default in a workspace. tools/speedtest: Preserve any deep profiling data files created by the tests. trace/mercury_trace.c: Trap attempts to perform retries in deep profiling grades, since they would lead to core dumps otherwise. util/Mmakefile: Avoid compile-time warnings when compiling getopt. tests/*/Mmakefile: tests/*/*/Mmakefile: In deep profiling grades, switch off the tests that test features that don't work with deep profiling, either by design or because the combination hasn't been implemented yet. |
||
|
|
ea529d99ee |
Don't use __builtin_{set,lng}jmp for versions of gcc unless the gcc
Estimated hours taken: 1
Branches: main release
runtime/mercury.h:
Don't use __builtin_{set,lng}jmp for versions of gcc unless the gcc
version is greater than 2.8.*, as they doesn't exist.
|
||
|
|
8c6ec7d6e7 |
Change the units for the size field in MLDS new_object
Estimated hours taken: 1 Change the units for the size field in MLDS new_object statements from bytes to words. compiler/mlds.m: Update the documentation for the size field. compiler/ml_unify_gen.m: Generate the sizes in words rather than bytes. Delete the ml_sizeof_word_lval function, since it's no longer used. compiler/mlds_to_c.m: Multiply the size passed to MR_new_object() by `sizeof(MR_Word)' to convert from words to bytes. compiler/mlds_to_gcc.m: compiler/mlds_to_il.m: Simplify the code by deleting hacks needed to convert the size from bytes to words. runtime/mercury.h: Document that the definition of SIZEOF_WORD should not be needed any longer, except for bootstraping. |
||
|
|
6199787a07 |
Fix a bug with the GCC back-end interface where it was generating
Estimated hours taken: 1.5 Fix a bug with the GCC back-end interface where it was generating calls to `MR_box_float', but `MR_box_float' was not defined in the runtime library. mercury/runtime/mercury.h: mercury/runtime/mercury.c: Add a new function `MR_asm_box_float'. This is the same as `MR_box_float' except that it is always defined as an external function, never as a macro or inline function. Also fix a bug where the return type of `MR_box_float' was declared as `MR_Float *' rather than `MR_Box'. gcc/mercury/mercury-gcc.c: mercury/compiler/gcc.m: Generate calls to `MR_asm_box_float' rather than to `MR_box_float'. |
||
|
|
452d9b27de |
Some efficiency improvements to the MLDS->C back-end.
Estimated hours taken: 8 Some efficiency improvements to the MLDS->C back-end. In particular, use GCC's __builtin_setjmp/__builtin_longjmp(), and generate better code for switches whose default case is unreachable. These changes also help to ensure that the MLDS->C back-end should generate exactly the same assembler code as the MLDS->GCC back-end, which makes it easier to debug the latter (by using `diff' on the generated `.s' files). compiler/mlds_to_c.m: For unreachable default cases, use `MR_assert(0)' rather than `assert(0)'. This improves efficiency, since `MR_assert' is disabled unless you compile with -DMR_LOWLEVEL_DEBUG. These checks were useful in debugging the MLDS back-end, but it's probably not worth keeping them enabled by default now. Put the default case first, so that if it is empty (as it will be if the default is unreachable and MR_assert() is not enabled), it gets merged with. Replace an obsolete comment about a problem with setjmp() and volatile with a comment explaining how that problem was fixed. Generate calls to MR_builtin_setjmp() and MR_builtin_longjmp() rather than to setjmp() and longjmp(). runtime/mercury.h: Define MR_builtin_setjmp() and MR_builtin_longjmp(). These expand to __builtin_setjmp()/__builtin_longjmp() for GNU C and to the standard setjmp()/longjmp() otherwise. compiler/mlds.m: compiler/ml_code_gen.m: Add some comments about __builtin_setjmp() and __builtin_longjmp(). |
||
|
|
fe7ee9ac33 |
Remove the declarations of the unify and compare functions for
Estimated hours taken: 0.75
runtime/mercury.h:
Remove the declarations of the unify and compare functions for
univ; these functions are no longer defined in mercury.c,
since univ is no longer a builtin type.
The declarations here were clashing with the automatically-generated
ones in --high-level-data grades.
(The clash was actually because we are including the wrong version
of the header files when compiling things in --high-level-data
grades, but previously that problem only resulted in compiler
warnings, whereas here it caused a compiler error.)
|
||
|
|
28dfba60cb |
Avoid a dependency where the runtime depends on the library.
Estimated hours taken: 5
Avoid a dependency where the runtime depends on the library.
library/array.m:
runtime/mercury.c:
runtime/mercury.h:
runtime/mercury_type_info.h:
Move code for doing array comparisons and unifications into the std
library.
|