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.
Estimated hours taken: 2
Branches: main
compiler/add_heap_ops.m:
Avoid saving and restoring the heap pointer across goals which
are known not to allocate any heap space.
Branches: main
Estimated hours taken: 8
Implement heap reclamation on failure for the MLDS back-end.
library/private_builtin.m:
Add impure procedures for saving and restoring the heap pointer.
compiler/add_heap_ops.m:
New file, similar to add_trail_ops.m.
An HLDS->HLDS transformation to add heap reclamation operations.
compiler/mercury_compile.m:
Call the new pass.
compiler/notes/compiler_design.html:
Mention the new pass.
compiler/add_trail_ops.m:
compiler/table_gen.m:
compiler/goal_util.m:
Abstract out the common code from `generate_call' in table_gen.m,
add_trail_ops.m, and add_heap_ops.m, and put it in a new procedure
`generate_simple_goal' in goal_util.m.
compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
Apply a review suggestion from Peter Ross: when putting code
in places that should not be reachable, insert code that calls
private_builtin__unused (which calls error/1) rather
than just inserting `true'.