mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-11 03:45:33 +00:00
Construction unifications of partially instantiated values involving direct argument functors (where the single argument is free) did not generate any code in both low-level and high-level backends. Incorrect behaviour could result if the program tried to deconstruct the value at run-time. Also, in the LLDS backend, such a construction unification did not enter the variable into the var_state_map, leading to a compiler abort when the variable is looked up. compiler/ml_unify_gen.m: Generate code for constructions of a direct arg functor with free argument. This amounts to assigning a variable to a tagged null pointer. compiler/llds.m: Add an rval option `mkword_hole', which is like `mkword' but the pointer to be tagged is unspecified. compiler/unify_gen.m: Assign a variable to an `mkword_hole' rval, for a construction unification of a direct arg functor with a free argument. Reassign the variable to an `mkword' rval when the argument becomes bound in a later unification. compiler/code_info.m: compiler/var_locn.m: Add a predicate to reassign a variable from a `mkword_hole' expression to a `mkword' expression. compiler/llds_out_data.m: Write out `mkword_hole' values as a tagged null pointer in C code. compiler/call_gen.m: compiler/code_util.m: compiler/dupelim.m: compiler/dupproc.m: compiler/exprn_aux.m: compiler/global_data.m: compiler/jumpopt.m: compiler/livemap.m: compiler/llds_to_x86_64.m: compiler/middle_rec.m: compiler/opt_debug.m: compiler/opt_util.m: compiler/peephole.m: compiler/stack_layout.m: Conform to addition of `mkword_hole'. tests/hard_coded/Mmakefile: tests/hard_coded/direct_arg_partial_inst.exp: tests/hard_coded/direct_arg_partial_inst.m: tests/hard_coded/direct_arg_partial_inst2.exp: tests/hard_coded/direct_arg_partial_inst2.m: Add test cases.
3 lines
59 B
Plaintext
3 lines
59 B
Plaintext
apple(struct(1, 2, 3, 4, 5))
|
|
orange(struct(1, 2, 3, 4, 5))
|