Estimated hours taken: 7
Branches: main
Add support for thread-local backjumping in grades that support concurrency.
library/backjump.m:
Shift the C definition of backjump handlers and choice ids into the
runtime. This is needed because MR_Context now refers to them and
the runtime should not depend on the library.
Delete the XXX comment regarding pred_is_external/3. (This has been
fixed below.)
runtime/mercury_backjump.h:
runtime/mercury_backjump.c:
New module that defines those parts of the backjumping support that
the runtime requires access to.
In high-level C .par grades make the global state required by
backjumping thread-specific.
Conform to the usual coding conventions in the runtime in the new
versions of the data structures that were originally in backjump.m.
Rename ML_Choice_Id to MR_BackJumpChoiceId, the latter is less
ambiguous.
runtime/mercury_context.h:
runtime/mercury_context.c:
In low-level C grades add two extra fields to the MR_Context structure
to hold the global state required by backjumping.
In high-level C .par grades initialise the the thread-specific data that
is used to store the backjump global state at program startup.
Reformat a function prototype.
runtime/mercury_thread.h:
Reformat a function prototype.
runtime/Mmakefile:
Include the new files.
mdbcomp/program_representation.m:
Update pred_is_external/3 to include backjump.builtin_choice_id/1
and backjump.builtin_backjump/1.
tests/hard_coded/Mmakefile:
tests/hard_coded/tl_backjump_test.m:
tests/hard_coded/tl_backjump_test.exp:
Test thread-local backjumping.
tests/hard_coded/tl_backjump_test.exp2:
Expected output for the above test case for grades in which spawn/3
does not work.