Estimated hours taken: 4
Implement `recursive' and `non_recursive' pragma c_code declarations.
This allows the compiler to optimize cases when the C code
is known to not call Mercury code. It's also necessary
to allow C code which modifies the hp register to work
(such code must be declared `non_recursive', otherwise
the registers will be saved and restored over it).
To make things bootstrap OK, the old pragma c_code declarations
default to `non_recursive'.
prog_data.m, hlds_goal.m:
Add new field c_is_recursive to pragma c_code goals.
prog_io.m:
Parse the new `recursive' and `non_recursive' pragma c_code
declarations.
make_hlds.m:
Pass the c_is_recursive field from the parse tree to the HLDS.
live_vars.m:
For non-recursive C code, don't save variables on the stack.
code_gen.pp:
For non-recursive C code, don't save variables on the stack,
don't mark the succip as needing to be saved, and don't
call save_registers() and restore_registers().
*.m:
Change c_code/5 to c_code/6.
Estimated hours taken: 0.25
prog_data.m, prog_io.m:
Rename the `pragma' type as `pragma_type', to avoid bootstrapping
problems caused by my change to make `pragma' an operator.
Estimated hours taken: 3
Add a new pragma `:- pragma obsolete(Name/Arity).';
the effect of this pragma is that we issue a warning for
any call to the specified predicate(s) or function(s).
prog_data.m:
Add new pragma type `obsolete'.
prog_io.m:
Parse pragma `obsolete'.
hlds_pred.m, hlds_out.m:
Add new pred_marker `obsolete'
make_hlds.m:
When we encounter a pragma `obsolete', insert `request(obsolete)'
in the pred_marker list for the specified predicate(s) and function(s).
simplify.m:
For each predicate call, check if the called predicate has been
marked as obsolete. If so, return a `warn_obsolete' warning.
det_report.m:
Add a new warning type `warn_obsolete', and add code to print
the warning for this warning type.
det_analysis.m:
Add a comment.
Estimated hours taken: 12
Implement higher-order functions.
Add higher-order function terms
(function lambda expressions, e.g. `Func = (func(X) = Y :- Y is 2 * X)'
and higher-order function calls (apply/N, e.g. `Z = apply(Func, 42)').
Add higher-order function insts and modes.
hlds_goal.m:
Add a new field pred_or_func to lambda_goal.
prog_data.m:
Add a new field pred_or_func to pred_inst_info.
prog_io.m:
Add support for parsing higher-order function terms and
higher-order function insts and modes.
make_hlds.m:
Add support for parsing higher-order function terms.
typecheck.m:
Add support for type-checking higher-order function calls
and higher-order function terms.
modes.m, mode_errors.m:
Add support for mode-checking higher-order function calls
and higher-order function terms.
higher_order.m:
Handle higher-order function types and insts.
hlds_pred.m:
Add new predicate pred_args_to_func_args, for extracting the
function arguments and function return from the arguments
of a predicate that is really a function.
*.m:
Minor changes to handle new pred_or_func field in lambda_goals
and pred_inst_infos.