Estimated hours taken: 0.25
Branches: main
Merge changes from the reuse branch back onto the main branch.
compiler/ml_unify_gen.m:
Handle the case where the tag on the cell to be reused is unknown.
compiler/hlds_goal.m:
Add a field which records what possible cons_ids the cell to be
reused can be tagged with.
compiler/builtin_ops.m:
Add the unary builtin operator strip_tag.
compiler/bytecode.m:
compiler/c_util.m:
compiler/java_util.m:
compiler/llds.m:
compiler/mlds_to_il.m:
compiler/opt_debug.m:
bytecode/mb_disasm.c:
bytecode/mb_exec.c:
Handle the strip_tag operator.
Estimated hours taken: 200
Converts MLDS to Java source code. The following features
do not work/have not yet been implemented:
* RTTI
* foreign language interface
* multidet and nondet predicates
* higher order predicates
* enforced usage of Java coding conventions
compiler/mlds_to_java.m:
Replaces existing file.
compiler/java_util.m:
New file. Contains utility predicates that are used
by the Java backend.
compiler/c_util.m:
Added comment about Java backend.
Estimated hours taken: 4
Delete the `cast_to_unsigned' unary operator from builtin_ops, and
replace it with an `unsigned_le' binary operator for doing unsigned
less-then-or-equal comparisons.
This change makes the semantics and typing of the builtin operators
more consistent.
compiler/builtin_ops.m:
Delete the `cast_to_unsigned' unary_op.
Add a new `unsigned_le' binary_op.
compiler/dense_switch.m:
compiler/lookup_switch.m:
compiler/ml_simplify_switch.m:
Use `binop(unsigned_le, X, Y)' rather than
`binop(<=, unop(cast_to_unsigned, X), Y)'.
compiler/bytecode.m:
compiler/c_util.m:
compiler/llds.m:
compiler/llds_out.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/opt_debug.m:
compiler/vn_util.m:
compiler/vn_cost.m:
Delete code for handling `cast_to_unsigned'
and instead add code for handling `unsigned_le'.
compiler/vn_cost.m:
Also add `mktag' and `unmktag' as zero_cost_unops.
compiler/c_util.m:
Add a new procedure `c_util__unsigned_comparison_op',
for use by llds_out.m.
Estimated hours taken: 2
Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.
compiler/c_util.m:
compiler/rtti_out.m:
Add MR_ prefixes to various type names in generated code.
compiler/*.m:
browser/*.m:
library/*.m:
Add MR_prefixes to various type and function names in pragma C code.
runtime/*.[ch]:
trace/*.[ch]:
Add MR_prefixes to various type and function names in
hand-written code.
Estimated hours taken: 20
Update the MLDS backend to handle structure reuse and compile time gc.
Note that currently no pass on the main branch currently generates this
information yet.
mlds.m:
Add a new instruction delete_object which is to be inserted
whenever a lval can be compile time garbage collected.
ml_unify_gen.m:
Handle the case where the HowToConstruct field of a construction
is reuse_cell(_).
Handle the case where a deconstruction can be compile time gc'd.
hlds_goal.m:
Add a new field, can_cgc, to deconstruction unifications. This
field is `yes' if the deconstruction unification can be compile time
garbage collected.
hlds_out.m:
Output the can_cgc field. Output unification information if we
request the structure reuse information.
ml_elim_nested.m:
mlds_to_c.m:
Handle the delete_object instruction.
builtin_ops.m:
Fix a bug where body was an unary op instead of a binary op.
bytecode.m:
c_util.m:
llds.m:
opt_debug.m:
vn_cost.m:
Changes to reflect that body is a binary op.
bytecode_gen.m:
code_aux.m:
common.m:
cse_detection.m:
dependency_graph.m:
det_analysis.m:
goal_util.m:
higher_order.m:
mark_static_terms.m:
mode_util.m:
modecheck_unify.m:
pd_cost.m:
pd_util.m:
prog_rep.m:
rl_exprn.m:
rl_key.m:
simplify.m:
switch_detection.m:
term_traversal.m:
unify_gen.m:
unused_args.m:
Handle the can compile time gc field in deconstruction unifications.
Estimated hours taken: 2
Bootstrap the none.gc.debug grade using MSVC as the C compiler.
compiler/c_util.m:
Avoid a limitation in MSVC where string literals are not allowed
to be longer then 2048 chars.
Error C2026 is now avoided by instead of outputing a string as
"a very long string" chunk it up into "a very " "long string"
where each chunk is 512 characters long.
Redefine c_util__output_quoted_string to call
c_util__output_quoted_multi_string, so as to avoid some code
duplication.
compiler/llds_out.m:
The definitions of any types used in the module need to be
output before they are used, so output them first.
Estimated hours taken: 2
Add support for generation of builtins to the MLDS backend.
compiler/ml_code_gen.m:
Add support for generating builtins (mostly copied
from call_gen.m and code_util.m, but with a few
changes).
compiler/code_util.m:
Add a comment warning about the code duplication.
compiler/c_util.m:
compiler/llds_out.m:
compiler/mlds_to_c.m:
Move (most of) the code from llds_out__binary_op_to_string
into a new routine c_util__binary_infix_op/2, and change
llds_out.m and mlds_to_c.m to use it.
compiler/mlds_to_c.m:
(An unrelated change:)
Don't output any comments for "public" access,
since such comments end up being just noise.
Estimated hours taken: 30
A batch of changes related to the development of the new MLDS back-end.
compiler/notes/compiler_design.html:
Reorganize the documentation to reflect the multi-target /
multiple back-end nature of the compiler.
Document mlds.m and the new modules c_util.m and mlds_to_c.m.
compiler/mlds_to_c.m:
New module. This converts MLDS to C/C++ code.
This version compiles, but it is still quite incomplete;
there's lots of parts which are still not yet implemented.
compiler/llds_out.m:
compiler/c_util.m:
Move some procedures from llds_out.m into a new module c_util.m,
so that they can also be used by mlds_to_c.m.
compiler/mlds.m:
- Add new functions for use by mlds_to_c.m:
* get_prog_context/1, for getting the prog_context from an
mlds__context
* get_module_name/1, for getting the module name from the mlds
* module_name_to_sym_name/1, for converting an mlds_module_name
to a sym_name
- Change the mlds__func_signature type to
* allow multiple return values, for consistency with the
MLDS `return' statement;
* include the names of the parameters.
- Undo the premature over-optimization of making the `constness'
and `finality' flags share the same flag bit.