[m-rev.] For review: Implement several things for rbmm
Quan Phan
quan.phan at cs.kuleuven.be
Fri Nov 9 03:45:58 AEDT 2007
Hi,
I sent this email a while ago. Could I commit it?
The change is internal to the rbmm stuff so it will likely not affect
anyone.
Regards,
Quan
On Tue, Oct 16, 2007 at 06:25:33PM +0200, Quan Phan wrote:
> Hi,
>
> Estimated hours taken: 8.
> Branch: main
>
> Implement several things for region-based memory management:
> Improve debugging messages.
> Collect more profiling information.
> Fix some bugs.
> Change more pointer arithmetics to structs.
>
> runtime/mercury_region.c:
> runtime/mercury_region.h:
> Implement all the above changes.
>
> Regards,
> Quan.
> cvs diff: Diffing .
> cvs diff: Diffing analysis
> cvs diff: Diffing bench
> cvs diff: Diffing bench/progs
> cvs diff: Diffing bench/progs/compress
> cvs diff: Diffing bench/progs/icfp2000
> cvs diff: Diffing bench/progs/icfp2001
> cvs diff: Diffing bench/progs/nuc
> cvs diff: Diffing bench/progs/ray
> cvs diff: Diffing bench/progs/tree234
> cvs diff: Diffing bindist
> cvs diff: Diffing boehm_gc
> cvs diff: Diffing boehm_gc/Mac_files
> cvs diff: Diffing boehm_gc/cord
> cvs diff: Diffing boehm_gc/cord/private
> cvs diff: Diffing boehm_gc/doc
> cvs diff: Diffing boehm_gc/include
> cvs diff: Diffing boehm_gc/include/private
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
> cvs diff: Diffing boehm_gc/tests
> cvs diff: Diffing boehm_gc/windows-untested
> cvs diff: Diffing boehm_gc/windows-untested/vc60
> cvs diff: Diffing boehm_gc/windows-untested/vc70
> cvs diff: Diffing boehm_gc/windows-untested/vc71
> cvs diff: Diffing browser
> cvs diff: Diffing browser/test
> cvs diff: Diffing bytecode
> cvs diff: Diffing bytecode/test
> cvs diff: Diffing compiler
> cvs diff: Diffing compiler/notes
> cvs diff: Diffing debian
> cvs diff: Diffing debian/patches
> cvs diff: Diffing deep
> cvs diff: Diffing deep_profiler
> cvs diff: Diffing deep_profiler/notes
> cvs diff: Diffing detail
> cvs diff: Diffing doc
> cvs diff: Diffing extras
> cvs diff: Diffing extras/aditi
> cvs diff: Diffing extras/base64
> cvs diff: Diffing extras/cgi
> cvs diff: Diffing extras/complex_numbers
> cvs diff: Diffing extras/complex_numbers/samples
> cvs diff: Diffing extras/complex_numbers/tests
> cvs diff: Diffing extras/concurrency
> cvs diff: Diffing extras/concurrency/samples
> cvs diff: Diffing extras/concurrency/samples/midi
> cvs diff: Diffing extras/concurrency/tests
> cvs diff: Diffing extras/curs
> cvs diff: Diffing extras/curs/samples
> cvs diff: Diffing extras/curses
> cvs diff: Diffing extras/curses/sample
> cvs diff: Diffing extras/dynamic_linking
> cvs diff: Diffing extras/error
> cvs diff: Diffing extras/exceptions
> cvs diff: Diffing extras/fixed
> cvs diff: Diffing extras/gator
> cvs diff: Diffing extras/gator/generations
> cvs diff: Diffing extras/gator/generations/1
> cvs diff: Diffing extras/graphics
> cvs diff: Diffing extras/graphics/easyx
> cvs diff: Diffing extras/graphics/easyx/samples
> cvs diff: Diffing extras/graphics/mercury_allegro
> cvs diff: Diffing extras/graphics/mercury_allegro/examples
> cvs diff: Diffing extras/graphics/mercury_allegro/samples
> cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
> cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
> cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
> cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
> cvs diff: Diffing extras/graphics/mercury_glut
> cvs diff: Diffing extras/graphics/mercury_opengl
> cvs diff: Diffing extras/graphics/mercury_tcltk
> cvs diff: Diffing extras/graphics/samples
> cvs diff: Diffing extras/graphics/samples/calc
> cvs diff: Diffing extras/graphics/samples/gears
> cvs diff: Diffing extras/graphics/samples/maze
> cvs diff: Diffing extras/graphics/samples/pent
> cvs diff: Diffing extras/lazy_evaluation
> cvs diff: Diffing extras/lazy_evaluation/examples
> cvs diff: Diffing extras/lex
> cvs diff: Diffing extras/lex/samples
> cvs diff: Diffing extras/lex/tests
> cvs diff: Diffing extras/log4m
> cvs diff: Diffing extras/logged_output
> cvs diff: Diffing extras/moose
> cvs diff: Diffing extras/moose/samples
> cvs diff: Diffing extras/moose/tests
> cvs diff: Diffing extras/mopenssl
> cvs diff: Diffing extras/morphine
> cvs diff: Diffing extras/morphine/non-regression-tests
> cvs diff: Diffing extras/morphine/scripts
> cvs diff: Diffing extras/morphine/source
> cvs diff: Diffing extras/net
> cvs diff: Diffing extras/odbc
> cvs diff: Diffing extras/opium_m
> cvs diff: Diffing extras/opium_m/non-regression-tests
> cvs diff: Diffing extras/opium_m/scripts
> cvs diff: Diffing extras/opium_m/source
> cvs diff: Diffing extras/posix
> cvs diff: Diffing extras/posix/samples
> cvs diff: Diffing extras/quickcheck
> cvs diff: Diffing extras/quickcheck/tutes
> cvs diff: Diffing extras/references
> cvs diff: Diffing extras/references/samples
> cvs diff: Diffing extras/references/tests
> cvs diff: Diffing extras/solver_types
> cvs diff: Diffing extras/solver_types/library
> cvs diff: Diffing extras/stream
> cvs diff: Diffing extras/stream/tests
> cvs diff: Diffing extras/trailed_update
> cvs diff: Diffing extras/trailed_update/samples
> cvs diff: Diffing extras/trailed_update/tests
> cvs diff: Diffing extras/windows_installer_generator
> cvs diff: Diffing extras/windows_installer_generator/sample
> cvs diff: Diffing extras/windows_installer_generator/sample/images
> cvs diff: Diffing extras/xml
> cvs diff: Diffing extras/xml/samples
> cvs diff: Diffing extras/xml_stylesheets
> cvs diff: Diffing java
> cvs diff: Diffing java/library
> cvs diff: Diffing java/runtime
> cvs diff: Diffing library
> cvs diff: Diffing lp_solve
> cvs diff: Diffing lp_solve/lp_examples
> cvs diff: Diffing mdbcomp
> cvs diff: Diffing profiler
> cvs diff: Diffing quickcheck
> cvs diff: Diffing quickcheck/tutes
> cvs diff: Diffing readline
> cvs diff: Diffing readline/doc
> cvs diff: Diffing readline/examples
> cvs diff: Diffing readline/shlib
> cvs diff: Diffing readline/support
> cvs diff: Diffing robdd
> cvs diff: Diffing runtime
> Index: runtime/mercury_region.c
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_region.c,v
> retrieving revision 1.3
> diff -u -r1.3 mercury_region.c
> --- runtime/mercury_region.c 15 Oct 2007 08:14:56 -0000 1.3
> +++ runtime/mercury_region.c 16 Oct 2007 16:02:15 -0000
> @@ -35,12 +35,14 @@
> MR_RegionProfUnit MR_rbmmp_pages_used = {0, 0, 0};
> unsigned int MR_rbmmp_pages_requested = 0;
> unsigned int MR_rbmmp_biggest_region_size = 0;
> -MR_RegionProfUnit MR_rbmmp_regions_saved_at_commit = {0, 0, 0};
> -unsigned int MR_rbmmp_regions_protected_at_ite;
> -unsigned int MR_rbmmp_snapshots_saved_at_ite;
> +unsigned int MR_rbmmp_regions_saved_at_commit = 0;
> +unsigned int MR_rbmmp_regions_protected_at_ite = 0;
> +unsigned int MR_rbmmp_snapshots_saved_at_ite = 0;
> unsigned int MR_rbmmp_regions_protected_at_disj;
> -unsigned int MR_rbmmp_snapshots_saved_at_disj;
> +unsigned int MR_rbmmp_snapshots_saved_at_disj = 0;
> double MR_rbmmp_page_utilized;
> +unsigned int MR_rbmmp_words_snapshot_instant_reclaimed = 0;
> +unsigned int MR_rbmmp_pages_snapshot_instant_reclaimed = 0;
>
> #endif
>
> @@ -68,6 +70,9 @@
> MR_RegionProfUnit *profiling_unit);
> #endif
>
> +static void MR_region_get_new_pages_and_new_words(
> + MR_RegionSnapshot *snapshot, int *new_pages,
> + int *new_words);
> /*---------------------------------------------------------------------------*/
> /* Page operations. */
>
> @@ -162,9 +167,7 @@
> region->MR_region_previous_region = NULL;
> MR_live_region_list = region;
>
> -#if defined(MR_RBMM_DEBUG)
> MR_region_debug_create_region(region);
> -#endif
>
> #if defined(MR_RBMM_PROFILING)
> MR_region_update_profiling_unit(&MR_rbmmp_regions_used, 1);
> @@ -241,8 +244,6 @@
> void
> MR_region_destroy_region(MR_Region *region)
> {
> - MR_region_debug_destroy_region(region);
> -
> if (region->MR_region_commit_frame != NULL) {
> MR_region_nullify_entries_in_commit_stack(region);
> }
> @@ -281,12 +282,10 @@
> MR_region_debug_try_remove_region(region);
> if ( !MR_region_is_disj_protected(region) ) {
> MR_region_destroy_region(region);
> + MR_region_debug_destroy_region(region);
> } else {
> region->MR_region_logical_removed = 1;
> -
> -#if defined(MR_RBMM_DEBUG)
> - MR_region_logically_remove_region_msg(region);
> -#endif
> + MR_region_debug_logically_remove_region(region);
> }
> }
>
> @@ -305,12 +304,10 @@
> if ( !MR_region_is_disj_protected(region) ) {
> MR_region_nullify_in_ite_frame(region);
> MR_region_destroy_region(region);
> + MR_region_debug_destroy_region(region);
> } else {
> region->MR_region_logical_removed = 1;
> -
> -#if defined(MR_RBMM_DEBUG)
> - MR_region_logically_remove_region_msg(region);
> -#endif
> + MR_region_debug_logically_remove_region(region);
> }
> }
>
> @@ -441,7 +438,7 @@
> {
> if (disj_frame->MR_rdff_disj_prot_seq_number !=
> MR_REGION_DISJ_FRAME_DUMMY_SEQ_NUMBER &&
> - disj_frame->MR_rdff_disj_prot_seq_number <
> + disj_frame->MR_rdff_disj_prot_seq_number >
> region->MR_region_sequence_number) {
> return MR_TRUE;
> }
> @@ -473,8 +470,8 @@
> void
> MR_region_create_region_msg(MR_Region *region)
> {
> - printf("Create region #%d:\n", region->MR_region_sequence_number);
> - printf("\tHandle: %d\n", region);
> + printf("Create region #%d (%d).\n", region->MR_region_sequence_number,
> + region);
> }
>
> void
> @@ -487,28 +484,26 @@
> void
> MR_region_destroy_region_msg(MR_Region *region)
> {
> - printf("Destroy region ");
> - MR_region_region_struct_removal_info_msg(region);
> + printf("Destroy region #%d.\n", region->MR_region_sequence_number);
> }
>
> void
> MR_region_logically_remove_region_msg(MR_Region *region)
> {
> - printf("Logically remove region ");
> - MR_region_region_struct_removal_info_msg(region);
> + printf("Logically removed region #%d.\n",
> + region->MR_region_sequence_number);
> }
>
> void
> MR_region_region_struct_removal_info_msg(MR_Region *region)
> {
> - printf("#%d\n", region->MR_region_sequence_number);
> - printf("\tHandle: %d\n", region);
> + printf("#%d (%d)\n", region->MR_region_sequence_number, region);
> printf("\tLogically removed: %d\n", region->MR_region_logical_removed);
> - printf("\tProtected by ite frame #%d: %d\n",
> + printf("\tIte-protected by #%d: %d\n",
> MR_region_get_frame_number((MR_Word *)region->MR_region_ite_protected),
> region->MR_region_ite_protected);
> if ( MR_region_is_disj_protected(region) ) {
> - printf("\tProtected by a disj frame.\n");
> + printf("\tDisj-protected.\n");
> } else {
> printf("\tNot disj-protected.\n");
> }
> @@ -522,15 +517,18 @@
> void
> MR_region_push_ite_frame_msg(MR_RegionIteFixedFrame *ite_frame)
> {
> - int frame_number;
> + int frame_number;
> + MR_Region *region;
>
> frame_number = MR_region_get_frame_number( (MR_Word *) ite_frame);
> printf("Push ite frame #%d: %d\n", frame_number, ite_frame);
> - printf("\tPrevious frame at push #%d: %d\n",
> + printf("\tPrevious #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) (ite_frame->MR_riff_previous_ite_frame)),
> ite_frame->MR_riff_previous_ite_frame);
> - printf("\tSaved most recent region at push: %d\n",
> + region = ite_frame->MR_riff_saved_region_list;
> + printf("\tSaved newest region: #%d (%d)\n",
> + (region ? region->MR_region_sequence_number : (MR_Word) region),
> ite_frame->MR_riff_saved_region_list);
> }
>
> @@ -539,11 +537,11 @@
> {
> printf("Ite frame #%d: %d\n",
> MR_region_get_frame_number( (MR_Word *) ite_frame), ite_frame);
> - printf("\tPrevious frame #%d: %d\n",
> + printf("\tPrevious #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) (ite_frame->MR_riff_previous_ite_frame)),
> ite_frame->MR_riff_previous_ite_frame);
> - printf("\tSaved most recent: %d\n", ite_frame->MR_riff_saved_region_list);
> + printf("\tSaved newest region: %d\n", ite_frame->MR_riff_saved_region_list);
> MR_region_ite_frame_protected_regions_msg(ite_frame);
> MR_region_ite_frame_snapshots_msg(ite_frame);
> }
> @@ -568,7 +566,7 @@
> (MR_Word *) ite_frame + MR_REGION_ITE_FRAME_FIXED_SIZE);
> for (i = 0; i < ite_frame->MR_riff_num_prot_regions; i++, ite_prot++) {
> printf("\tAt slot: %d, ite-protect region: %d\n",
> - ite_prot, ite_prot->MR_ite_prot_region);
> + ite_prot, ite_prot->MR_ite_prot_region->MR_region_sequence_number);
> }
> }
>
> @@ -589,22 +587,28 @@
> snapshot = (MR_RegionSnapshot *) ((MR_Word *) ite_frame +
> MR_REGION_ITE_FRAME_FIXED_SIZE + protection_size);
> for (i = 0; i < ite_frame->MR_riff_num_snapshots; i++, snapshot++) {
> - printf("\tAt slot: %d, snapshot of region: %d\n", snapshot,
> - snapshot->MR_snapshot_region);
> + printf("\tAt slot: %d, snapshot of region: #%d\n", snapshot,
> + snapshot->MR_snapshot_region->MR_region_sequence_number);
> }
> }
>
> void
> MR_region_push_disj_frame_msg(MR_RegionDisjFixedFrame *disj_frame)
> {
> + MR_Region *region;
> +
> printf("Push disj frame #%d: %d\n",
> MR_region_get_frame_number((MR_Word *) disj_frame), disj_frame);
> - printf("\tPrevious frame at push #%d: %d\n",
> + printf("\tPrevious #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) (disj_frame->MR_rdff_previous_disj_frame)),
> disj_frame->MR_rdff_previous_disj_frame);
> - printf("\tSaved most recent region at push: %d\n",
> - disj_frame->MR_rdff_saved_region_list);
> + region = disj_frame->MR_rdff_saved_region_list;
> + printf("\tSaved newest region: #%d (%d)\n",
> + (region ? region->MR_region_sequence_number : (MR_Word) region),
> + region);
> + printf("\tDisj protection sequence number: %d\n",
> + disj_frame->MR_rdff_disj_prot_seq_number);
> }
>
> void
> @@ -612,12 +616,14 @@
> {
> printf("Disj frame #%d: %d\n",
> MR_region_get_frame_number((MR_Word *) disj_frame), disj_frame);
> - printf("\tPrevious frame #%d: %d\n",
> + printf("\tPrevious #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) disj_frame->MR_rdff_previous_disj_frame),
> disj_frame->MR_rdff_previous_disj_frame);
> - printf("\tSaved most recent region: %d\n",
> + printf("\tSaved newest region: %d\n",
> disj_frame->MR_rdff_saved_region_list);
> + printf("\tDisj protection sequence number: %d\n",
> + disj_frame->MR_rdff_disj_prot_seq_number);
> }
>
> void
> @@ -646,13 +652,13 @@
>
> printf("Push commit frame #%d: %d\n",
> MR_region_get_frame_number((MR_Word *) commit_frame), commit_frame);
> - printf("\tPrevious frame at push #%d: %d\n",
> + printf("\tPrevious #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) commit_frame->MR_rcff_previous_commit_frame),
> commit_frame->MR_rcff_previous_commit_frame);
> - printf("\tSequence number at push: %d\n",
> + printf("\tSequence number: %d\n",
> commit_frame->MR_rcff_saved_sequence_number);
> - printf("\tDisj frame at push #%d: %d\n",
> + printf("\tDisj frame #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) (commit_frame->MR_rcff_saved_disj_sp)),
> commit_frame->MR_rcff_saved_disj_sp);
> @@ -670,9 +676,9 @@
> MR_region_get_frame_number(
> (MR_Word *) commit_frame->MR_rcff_previous_commit_frame),
> commit_frame->MR_rcff_previous_commit_frame);
> - printf("\tSequence number at push: %d\n",
> + printf("\tSequence number: %d\n",
> commit_frame->MR_rcff_saved_sequence_number);
> - printf("\tDisj frame at push #%d: %d\n",
> + printf("\tDisj frame #%d: %d\n",
> MR_region_get_frame_number(
> (MR_Word *) (commit_frame->MR_rcff_saved_disj_sp)),
> commit_frame->MR_rcff_saved_disj_sp);
> @@ -721,6 +727,97 @@
>
> }
>
> +void
> +MR_region_start_msg(const char *name)
> +{
> + printf("Start %s:\n", name);
> +}
> +
> +void
> +MR_region_end_msg(const char *name)
> +{
> + printf("End %s.\n", name);
> +}
> +
> +void
> +MR_region_fill_ite_protect_msg(MR_RegionIteProtect *ite_prot,
> + MR_Region *region)
> +{
> + if (ite_prot == NULL) {
> + printf("\tNot protect region #%d.\n",
> + region->MR_region_sequence_number);
> + } else {
> + printf("\tAt slot: %d, protect region #%d.\n", ite_prot,
> + region->MR_region_sequence_number);
> + }
> +}
> +
> +void
> +MR_region_fill_ite_snapshot_removed_msg(MR_RegionSnapshot *snapshot,
> + MR_Region *region)
> +{
> + if (snapshot == NULL) {
> + printf("\tNot take snapshot of region #%d.\n",
> + region->MR_region_sequence_number);
> + } else {
> + printf("\tAt slot: %d, save snapshot of region #%d.\n", snapshot,
> + region->MR_region_sequence_number);
> + }
> +}
> +
> +void
> +MR_region_fill_ite_snapshot_not_removed_msg(MR_RegionSnapshot *snapshot,
> + MR_Region *region)
> +{
> + printf("\tAt slot: %d, save snapshot of region #%d.\n", snapshot,
> + region->MR_region_sequence_number);
> +}
> +
> +void
> +MR_region_fill_disj_snapshot_msg(MR_RegionSnapshot *snapshot,
> + MR_Region *region)
> +{
> + printf("\tAt slot: %d, save snapshot of region #%d.\n", snapshot,
> + region->MR_region_sequence_number);
> +}
> +
> +void
> +MR_region_fill_commit_msg(MR_RegionCommitSave *commit_save,
> + MR_Region *region)
> +{
> + if (commit_save == NULL) {
> + printf("\tNot save region #%d.\n", region->MR_region_sequence_number);
> + } else {
> + printf("\tAt slot: %d, save region #%d.\n", commit_save,
> + region->MR_region_sequence_number);
> + }
> +}
> +
> +void
> +MR_region_ite_unprotect_msg(MR_Region *region)
> +{
> + MR_RegionIteFixedFrame *old_ite_frame;
> + MR_RegionIteFixedFrame *new_ite_frame;
> +
> + old_ite_frame = region->MR_region_ite_protected;
> + new_ite_frame = MR_region_ite_sp->MR_riff_previous_ite_frame;
> + printf("Ite protected by #%d (%d), now by #%d (%d).\n",
> + MR_region_get_frame_number((MR_Word *) old_ite_frame), old_ite_frame,
> + MR_region_get_frame_number((MR_Word *) new_ite_frame), new_ite_frame);
> +}
> +
> +void
> +MR_region_restore_from_snapshot_msg(MR_RegionSnapshot *snapshot)
> +{
> + int new_words;
> + int new_pages;
> +
> + MR_region_get_new_pages_and_new_words(snapshot, &new_pages, &new_words);
> + printf("Restore region #%d: reclaim %d pages, %d words.\n",
> + snapshot->MR_snapshot_region->MR_region_sequence_number,
> + new_pages, new_words);
> +}
> +
> #endif /* End of MR_RBMM_DEBUG. */
>
> /*---------------------------------------------------------------------------*/
> @@ -765,28 +862,24 @@
> void
> MR_region_profile_restore_from_snapshot(MR_RegionSnapshot *snapshot)
> {
> - MR_Region *restoring_region;
> - MR_RegionPage *first_new_page;
> int new_words;
> int new_pages;
> + MR_Region *restoring_region;
>
> + MR_region_get_new_pages_and_new_words(snapshot, &new_pages, &new_words);
> + MR_region_update_profiling_unit(&MR_rbmmp_pages_used, -new_pages);
> restoring_region = snapshot->MR_snapshot_region;
> - first_new_page = snapshot->MR_snapshot_saved_last_page->MR_regionpage_next;
> -
> - if (first_new_page != NULL) {
> - new_pages = MR_region_get_number_of_pages(first_new_page,
> - restoring_region->MR_region_last_page);
> - MR_region_update_profiling_unit(&MR_rbmmp_pages_used, -new_pages);
> - new_words = (new_pages * MR_REGION_PAGE_SPACE_SIZE -
> - restoring_region->MR_region_available_space +
> - snapshot->MR_snapshot_saved_available_space);
> - } else {
> - new_words = snapshot->MR_snapshot_saved_available_space -
> - restoring_region->MR_region_available_space;
> - }
> ((MR_RegionPage *) restoring_region)->MR_regionpage_allocated_size
> -= new_words;
> MR_region_update_profiling_unit(&MR_rbmmp_words_used, -new_words);
> + MR_rbmmp_pages_snapshot_instant_reclaimed += new_pages;
> + MR_rbmmp_words_snapshot_instant_reclaimed += new_words;
> +}
> +
> +void
> +MR_region_profile_increase_counter(unsigned int *counter)
> +{
> + *counter += 1;
> }
>
> int
> @@ -810,7 +903,7 @@
> MR_region_print_profiling_unit(const char *str,
> MR_RegionProfUnit *profiling_unit)
> {
> - printf(str); /* XXX This is dangerous. */
> + printf("%s", str);
> printf("\n");
> printf("\tTotal: %d.\n", profiling_unit->MR_rbmmpu_total);
> printf("\tMaximum: %d.\n", profiling_unit->MR_rbmmpu_max);
> @@ -820,11 +913,25 @@
> void
> MR_region_print_profiling_info(void)
> {
> + printf("\n---------- Profiling information ----------\n");
> MR_region_print_profiling_unit("Regions:", &MR_rbmmp_regions_used);
> printf("Biggest region size: %d.\n", MR_rbmmp_biggest_region_size);
> MR_region_print_profiling_unit("Words:", &MR_rbmmp_words_used);
> MR_region_print_profiling_unit("Pages used:", &MR_rbmmp_pages_used);
> printf("Pages requested: %d.\n", MR_rbmmp_pages_requested);
> + printf("Pages utilized: %lf.\n",
> + MR_rbmmp_pages_used.MR_rbmmpu_total / (double)MR_rbmmp_pages_requested);
> + printf("Regions protected at ite frames: %d.\n",
> + MR_rbmmp_regions_protected_at_ite);
> + printf("Regions saved at commit frames: %d.\n",
> + MR_rbmmp_regions_saved_at_commit);
> + printf("Snapshots at ite frames: %d.\n", MR_rbmmp_snapshots_saved_at_ite);
> + printf("Snapshots at disj frames: %d.\n",
> + MR_rbmmp_snapshots_saved_at_disj);
> + printf("Words instant reclaimed thanks to snapshot: %d.\n",
> + MR_rbmmp_words_snapshot_instant_reclaimed);
> + printf("Pages instant reclaimed thanks to snapshot: %d.\n",
> + MR_rbmmp_pages_snapshot_instant_reclaimed);
> }
>
> #else /* Not define MR_RBMM_PROFILING. */
> @@ -847,6 +954,12 @@
> /* do nothing */
> }
>
> +void
> +MR_region_profile_increase_counter(unsigned int *counter)
> +{
> + /* do nothing */
> +}
> +
> int
> MR_region_get_number_of_pages(MR_RegionPage *fp, MR_RegionPage *tp)
> {
> @@ -860,4 +973,28 @@
>
> #endif /* End of Not define MR_RBMM_PROFILING. */
>
> +static void
> +MR_region_get_new_pages_and_new_words(MR_RegionSnapshot *snapshot,
> + int *new_pages, int *new_words)
> +{
> + MR_Region *restoring_region;
> + MR_RegionPage *first_new_page;
> +
> + restoring_region = snapshot->MR_snapshot_region;
> + first_new_page = snapshot->MR_snapshot_saved_last_page->MR_regionpage_next;
> +
> + if (first_new_page != NULL) {
> + *new_pages = MR_region_get_number_of_pages(first_new_page,
> + restoring_region->MR_region_last_page);
> + *new_words = (*new_pages * MR_REGION_PAGE_SPACE_SIZE -
> + restoring_region->MR_region_available_space +
> + snapshot->MR_snapshot_saved_available_space);
> + } else {
> + *new_pages = 0;
> + *new_words = snapshot->MR_snapshot_saved_available_space -
> + restoring_region->MR_region_available_space;
> + }
> +}
> +
> +
> #endif /* MR_USE_REGIONS */
> Index: runtime/mercury_region.h
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_region.h,v
> retrieving revision 1.4
> diff -u -r1.4 mercury_region.h
> --- runtime/mercury_region.h 15 Oct 2007 16:57:03 -0000 1.4
> +++ runtime/mercury_region.h 16 Oct 2007 16:02:15 -0000
> @@ -300,20 +300,27 @@
> #define MR_region_fill_ite_protect(ite_sp, region_ptr, \
> num_protected_regions, region_slot_reg) \
> do { \
> - MR_Region *region; \
> + MR_Region *region; \
> + MR_RegionIteProtect *ite_prot; \
> \
> + MR_region_debug_start("fill_ite_protect"); \
> region = (MR_Region *) (region_ptr); \
> if (!MR_region_is_disj_protected(region) && \
> region->MR_region_ite_protected == NULL) \
> { \
> - *((MR_Word *) (region_slot_reg)) = (MR_Word) region; \
> + ite_prot = (MR_RegionIteProtect *) (region_slot_reg); \
> + ite_prot->MR_ite_prot_region = region; \
> (num_protected_regions)++; \
> - (region_slot_reg) = (MR_Word) \
> - (((MR_Word *) (region_slot_reg)) + \
> - MR_REGION_ITE_PROT_SIZE); \
> + (region_slot_reg) = (MR_Word)(ite_prot + 1); \
> region->MR_region_ite_protected = \
> (MR_RegionIteFixedFrame *) (ite_sp); \
> + MR_region_profile_increase_counter( \
> + &MR_rbmmp_regions_protected_at_ite); \
> + MR_region_debug_fill_ite_protect(ite_prot, region); \
> + } else { \
> + MR_region_debug_fill_ite_protect(NULL, region); \
> } \
> + MR_region_debug_end("fill_ite_protect"); \
> } while (0)
>
> /*
> @@ -336,27 +343,49 @@
> #define MR_region_fill_ite_snapshot_removed(ite_sp, region_ptr, \
> num_snapshots, snapshot_block) \
> do { \
> - MR_Region *region; \
> + MR_Region *region; \
> + MR_RegionSnapshot *snapshot; \
> \
> + MR_region_debug_start( \
> + "fill_ite_snapshot_removed"); \
> region = (MR_Region *) (region_ptr); \
> + snapshot = (MR_RegionSnapshot *) (snapshot_block); \
> if (region->MR_region_ite_protected != NULL || \
> MR_region_is_disj_protected(region)) \
> { \
> - MR_save_snapshot(region, snapshot_block); \
> - MR_next_snapshot_block(snapshot_block); \
> + MR_save_snapshot(region, snapshot); \
> + MR_region_profile_increase_counter( \
> + &MR_rbmmp_snapshots_saved_at_ite); \
> + (snapshot_block) = (MR_Word) (snapshot + 1); \
> (num_snapshots)++; \
> - } /* Else the region is not protected. */ \
> + MR_region_debug_fill_ite_snapshot_removed(snapshot, \
> + region); \
> + } else { \
> + /* Else the region is not protected. */ \
> + MR_region_debug_fill_ite_snapshot_removed(NULL, region);\
> + } \
> + MR_region_debug_end("fill_ite_snapshot_removed"); \
> } while (0)
>
> #define MR_region_fill_ite_snapshot_not_removed(ite_sp, region_ptr, \
> num_snapshots, snapshot_block) \
> do { \
> - MR_Region *region; \
> + MR_Region *region; \
> + MR_RegionSnapshot *snapshot; \
> \
> + MR_region_debug_start( \
> + "fill_ite_snapshot_not_removed"); \
> region = (MR_Region *) (region_ptr); \
> - MR_save_snapshot(region, (snapshot_block)); \
> - MR_next_snapshot_block(snapshot_block); \
> + snapshot = (MR_RegionSnapshot *) (snapshot_block); \
> + MR_save_snapshot(region, snapshot); \
> + MR_region_profile_increase_counter( \
> + &MR_rbmmp_snapshots_saved_at_ite); \
> + (snapshot_block) = (MR_Word) (snapshot + 1); \
> (num_snapshots)++; \
> + MR_region_debug_fill_ite_snapshot_not_removed(snapshot, \
> + region); \
> + MR_region_debug_end( \
> + "fill_ite_snapshot_not_removed"); \
> } while (0)
>
> #define MR_region_fill_disj_protect(disj_sp, region_ptr, \
> @@ -367,12 +396,19 @@
> #define MR_region_fill_disj_snapshot(disj_sp, region_ptr, \
> num_snapshots, snapshot_block) \
> do { \
> - MR_Region *region; \
> + MR_Region *region; \
> + MR_RegionSnapshot *snapshot; \
> \
> + MR_region_debug_start("fill_disj_snapshot"); \
> region = (MR_Region *) (region_ptr); \
> - MR_save_snapshot(region, (snapshot_block)); \
> - MR_next_snapshot_block(snapshot_block); \
> + snapshot = (MR_RegionSnapshot *) (snapshot_block); \
> + MR_save_snapshot(region, snapshot); \
> + MR_region_profile_increase_counter( \
> + &MR_rbmmp_snapshots_saved_at_disj); \
> + (snapshot_block) = (MR_Word) (snapshot + 1); \
> (num_snapshots)++; \
> + MR_region_debug_fill_disj_snapshot(snapshot, region); \
> + MR_region_debug_end("fill_disj_snapshot"); \
> } while (0)
>
> /*
> @@ -383,20 +419,27 @@
> #define MR_region_fill_commit(commit_sp, region_ptr, \
> num_saved_region_reg, region_slot_reg) \
> do { \
> - MR_Region *region; \
> + MR_Region *region; \
> + MR_RegionCommitSave *commit_save; \
> \
> + MR_region_debug_start("fill_commit"); \
> region = (MR_Region *) (region_ptr); \
> if (!MR_region_is_disj_protected(region) && \
> region->MR_region_ite_protected == NULL) \
> { \
> - *((MR_Word *) (region_slot_reg)) = (MR_Word) region; \
> + commit_save = (MR_RegionCommitSave *) (region_slot_reg);\
> + commit_save->MR_commit_save_region = region; \
> num_saved_region_reg++; \
> - (region_slot_reg) = (MR_Word) \
> - (((MR_Word *) (region_slot_reg)) + \
> - MR_REGION_COMMIT_SAVE_SIZE); \
> + (region_slot_reg) = (MR_Word) (commit_save + 1); \
> region->MR_region_commit_frame = \
> (MR_RegionCommitFixedFrame *) (commit_sp); \
> + MR_region_profile_increase_counter( \
> + &MR_rbmmp_regions_saved_at_commit); \
> + MR_region_debug_fill_commit(commit_save, region); \
> + } else { \
> + MR_region_debug_fill_commit(NULL, region); \
> } \
> + MR_region_debug_end("fill_commit"); \
> } while (0)
>
> /*---------------------------------------------------------------------------*/
> @@ -409,7 +452,6 @@
> \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> top_ite_frame->MR_riff_num_prot_regions = (num); \
> - MR_region_debug_ite_frame_protected_regions(top_ite_frame); \
> } while (0)
>
> #define MR_region_set_ite_num_snapshots(ite_sp, num) \
> @@ -418,7 +460,6 @@
> \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> top_ite_frame->MR_riff_num_snapshots = (num); \
> - MR_region_debug_ite_frame_snapshots(top_ite_frame); \
> } while (0)
>
> #define MR_region_set_disj_num_protects(disj_sp, num) \
> @@ -431,7 +472,6 @@
> \
> top_disj_frame = (MR_RegionDisjFixedFrame *) (disj_sp); \
> top_disj_frame->MR_rdff_num_snapshots = (num); \
> - MR_region_debug_disj_frame_snapshots(top_disj_frame); \
> } while (0)
>
> #define MR_region_set_commit_num_entries(commit_sp, num) \
> @@ -441,8 +481,6 @@
> top_commit_frame = \
> (MR_RegionCommitFixedFrame *) (commit_sp); \
> top_commit_frame->MR_rcff_num_saved_regions = (num); \
> - MR_region_debug_commit_frame_saved_regions( \
> - top_commit_frame); \
> } while (0)
>
> /*---------------------------------------------------------------------------*/
> @@ -465,6 +503,7 @@
> MR_RegionIteProtect *ite_prot; \
> int i; \
> \
> + MR_region_debug_start("use_region_ite_then_semidet"); \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> ite_prot = (MR_RegionIteProtect *) ( (ite_sp) + \
> MR_REGION_ITE_FRAME_FIXED_SIZE); \
> @@ -474,6 +513,7 @@
> ite_prot->MR_ite_prot_region); \
> } \
> MR_pop_region_ite_frame(top_ite_frame); \
> + MR_region_debug_end("use_region_ite_then_semidet"); \
> } while (0)
>
> #define MR_use_region_ite_then_nondet(ite_sp) \
> @@ -482,6 +522,7 @@
> MR_RegionIteProtect *ite_prot; \
> int i; \
> \
> + MR_region_debug_start("use_region_ite_then_nondet"); \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> ite_prot = (MR_RegionIteProtect *) ( (ite_sp) + \
> MR_REGION_ITE_FRAME_FIXED_SIZE); \
> @@ -492,22 +533,27 @@
> ite_prot->MR_ite_prot_region); \
> } \
> } \
> + MR_region_debug_end("use_region_ite_then_nondet"); \
> } while (0)
>
> #define MR_use_region_ite_else_semidet(ite_sp) \
> do { \
> MR_RegionIteFixedFrame *top_ite_frame; \
> \
> + MR_region_debug_start("use_region_ite_else_semidet"); \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> MR_region_process_at_ite_else(top_ite_frame); \
> + MR_region_debug_end("use_region_ite_else_semidet"); \
> } while (0)
>
> #define MR_use_region_ite_else_nondet(ite_sp) \
> do { \
> MR_RegionIteFixedFrame *top_ite_frame; \
> \
> + MR_region_debug_start("use_region_ite_else_nondet"); \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> MR_region_process_at_ite_else(top_ite_frame); \
> + MR_region_debug_end("use_region_ite_else_nondet"); \
> } while (0)
>
> /*
> @@ -519,28 +565,34 @@
> do { \
> MR_RegionIteFixedFrame *top_ite_frame; \
> \
> + MR_region_debug_start("use_region_ite_nondet_cond_fail"); \
> top_ite_frame = (MR_RegionIteFixedFrame *) (ite_sp); \
> MR_region_process_at_ite_else(top_ite_frame) \
> + MR_region_debug_end("use_region_ite_nondet_cond_fail"); \
> } while (0)
>
> #define MR_use_region_disj_later(disj_sp) \
> do { \
> MR_RegionDisjFixedFrame *top_disj_frame; \
> \
> + MR_region_debug_start("use_region_disj_later"); \
> top_disj_frame = (MR_RegionDisjFixedFrame *) (disj_sp); \
> MR_region_disj_restore_from_snapshots(top_disj_frame); \
> MR_region_disj_destroy_new_regions(top_disj_frame); \
> + MR_region_debug_end("use_region_disj_later"); \
> } while (0)
>
> #define MR_use_region_disj_last(disj_sp) \
> do { \
> MR_RegionDisjFixedFrame *top_disj_frame; \
> \
> + MR_region_debug_start("use_region_disj_last"); \
> top_disj_frame = (MR_RegionDisjFixedFrame *) (disj_sp); \
> MR_region_disj_restore_from_snapshots(top_disj_frame); \
> MR_region_disj_destroy_new_regions(top_disj_frame); \
> MR_region_disj_unprotect_regions(top_disj_frame); \
> MR_pop_region_disj_frame(top_disj_frame); \
> + MR_region_debug_end("use_region_disj_last"); \
> } while (0)
>
> #define MR_use_region_commit_success(commit_sp) \
> @@ -548,13 +600,11 @@
> MR_RegionCommitFixedFrame *top_commit_frame; \
> MR_RegionCommitSave *first_commit_save; \
> \
> + MR_region_debug_start("use_region_commit_success"); \
> top_commit_frame = \
> (MR_RegionCommitFixedFrame *) (commit_sp); \
> first_commit_save = (MR_RegionCommitSave *) ( \
> (commit_sp) + MR_REGION_COMMIT_FRAME_FIXED_SIZE); \
> - \
> - MR_region_debug_commit_frame(top_commit_frame); \
> - \
> MR_commit_success_destroy_marked_new_regions( \
> top_commit_frame->MR_rcff_saved_sequence_number); \
> MR_commit_success_destroy_marked_saved_regions( \
> @@ -562,6 +612,7 @@
> first_commit_save); \
> MR_region_disj_sp = top_commit_frame->MR_rcff_saved_disj_sp;\
> MR_pop_region_commit_frame(top_commit_frame); \
> + MR_region_debug_end("use_region_commit_success"); \
> } while (0)
>
> /*
> @@ -580,6 +631,7 @@
> MR_Region *region; \
> int i; \
> \
> + MR_region_debug_start("use_region_commit_failure"); \
> top_commit_frame = \
> (MR_RegionCommitFixedFrame *) (commit_sp); \
> commit_save = (MR_RegionCommitSave *) ( (commit_sp) + \
> @@ -593,6 +645,7 @@
> } \
> } \
> MR_pop_region_commit_frame(top_commit_frame); \
> + MR_region_debug_end("use_region_commit_failure"); \
> } while (0)
>
> extern void MR_commit_success_destroy_marked_saved_regions(
> @@ -649,19 +702,19 @@
> MR_Region *protected_region; \
> int i; \
> \
> - MR_region_debug_ite_frame(top_ite_frame); \
> + MR_region_debug_start("ite_unprotect"); \
> ite_prot = (MR_RegionIteProtect *) ( \
> ( (MR_Word *) (top_ite_frame) ) + \
> MR_REGION_ITE_FRAME_FIXED_SIZE); \
> for (i = 0; i < top_ite_frame->MR_riff_num_prot_regions; \
> i++, ite_prot++) { \
> protected_region = ite_prot->MR_ite_prot_region; \
> + MR_region_debug_ite_unprotect(protected_region); \
> /* Try to protect the region by an outer condition. */ \
> protected_region->MR_region_ite_protected = \
> top_ite_frame->MR_riff_previous_ite_frame; \
> - MR_region_debug_region_struct_removal_info( \
> - protected_region); \
> } \
> + MR_region_debug_end("ite_unprotect"); \
> } while (0)
>
> #define MR_region_ite_restore_from_snapshots(top_ite_frame) \
> @@ -669,6 +722,8 @@
> MR_RegionSnapshot *first_snapshot; \
> MR_Word protection_size; \
> \
> + MR_region_debug_start( \
> + "ite_restore_from_snapshot"); \
> protection_size = top_ite_frame->MR_riff_num_prot_regions * \
> MR_REGION_ITE_PROT_SIZE; \
> first_snapshot = (MR_RegionSnapshot *) ( \
> @@ -676,11 +731,19 @@
> MR_REGION_ITE_FRAME_FIXED_SIZE + protection_size); \
> MR_restore_snapshots(top_ite_frame->MR_riff_num_snapshots, \
> first_snapshot); \
> + MR_region_debug_end( \
> + "ite_restore_from_snapshot"); \
> } while (0)
>
> #define MR_region_ite_destroy_new_regions(top_ite_frame) \
> - MR_region_frame_destroy_new_regions( \
> - top_ite_frame->MR_riff_saved_region_list)
> + do { \
> + MR_region_debug_start( \
> + "ite_destroy_new_regions"); \
> + MR_region_frame_destroy_new_regions( \
> + top_ite_frame->MR_riff_saved_region_list); \
> + MR_region_debug_end( \
> + "ite_destroy_new_regions"); \
> + } while (0)
>
> /*---------------------------------------------------------------------------*/
> /* Helpers for nondet disjunction support. */
> @@ -692,11 +755,15 @@
> do { \
> MR_RegionSnapshot *first_snapshot; \
> \
> + MR_region_debug_start( \
> + "disj_restore_from_snapshots"); \
> first_snapshot = (MR_RegionSnapshot *) ( \
> (MR_Word *) (top_disj_frame) + \
> MR_REGION_DISJ_FRAME_FIXED_SIZE); \
> MR_restore_snapshots(top_disj_frame->MR_rdff_num_snapshots, \
> first_snapshot); \
> + MR_region_debug_end( \
> + "disj_restore_from_snapshots"); \
> } while (0)
>
> /*
> @@ -704,8 +771,14 @@
> ** regions.
> */
> #define MR_region_disj_destroy_new_regions(top_disj_frame) \
> - MR_region_frame_destroy_new_regions( \
> - top_disj_frame->MR_rdff_saved_region_list)
> + do { \
> + MR_region_debug_start( \
> + "disj_destroy_new_regions"); \
> + MR_region_frame_destroy_new_regions( \
> + top_disj_frame->MR_rdff_saved_region_list); \
> + MR_region_debug_end( \
> + "disj_destroy_new_regions"); \
> + } while (0)
>
> /*
> ** At the last disjunct, we do not disj-protect the regions anymore.
> @@ -718,11 +791,8 @@
>
> /*---------------------------------------------------------------------------*/
>
> -#define MR_save_snapshot(region, snapshot_block) \
> +#define MR_save_snapshot(region, snapshot) \
> do { \
> - MR_RegionSnapshot *snapshot; \
> - \
> - snapshot = (MR_RegionSnapshot *) (snapshot_block); \
> snapshot->MR_snapshot_region = (region); \
> snapshot->MR_snapshot_saved_last_page = \
> (region)->MR_region_last_page; \
> @@ -732,11 +802,7 @@
> (region)->MR_region_available_space; \
> } while (0)
>
> -#define MR_next_snapshot_block(snapshot_block) ( \
> - (snapshot_block) = (MR_Word) \
> - (((MR_RegionSnapshot *) (snapshot_block) ) + 1) \
> - )
> -
> +
> /*
> ** XXX For profiling:
> ** One correct way to reset the allocated_size is to save it in the snapshot
> @@ -762,6 +828,7 @@
> first_new_page = saved_last_page->MR_regionpage_next; \
> /* Collect profiling information. */ \
> MR_region_profile_restore_from_snapshot(snapshot); \
> + MR_region_debug_restore_from_snapshot(snapshot); \
> \
> if (first_new_page != NULL) { \
> MR_region_return_page_list(first_new_page, \
> @@ -779,14 +846,13 @@
> #define MR_region_frame_destroy_new_regions(saved_most_recent_region) \
> do { \
> MR_Region *region; \
> - MR_Region *next_region; \
> \
> region = MR_live_region_list; \
> while (region != saved_most_recent_region) { \
> - next_region = region->MR_region_next_region; \
> /* We destroy regions upto before the saved one. */ \
> MR_region_destroy_region(region); \
> - region = next_region; \
> + MR_region_debug_destroy_region(region); \
> + region = region->MR_region_next_region; \
> } \
> MR_live_region_list = saved_most_recent_region; \
> } while (0)
> @@ -814,6 +880,9 @@
> #define MR_region_debug_destroy_region(region) \
> MR_region_destroy_region_msg(region)
>
> + #define MR_region_debug_logically_remove_region(region) \
> + MR_region_logically_remove_region_msg(region)
> +
> /* Debug ite frame messages. */
> #define MR_region_debug_push_ite_frame(ite_sp) \
> MR_region_push_ite_frame_msg(ite_sp)
> @@ -821,10 +890,10 @@
> #define MR_region_debug_ite_frame(ite_sp); \
> MR_region_ite_frame_msg(ite_sp)
>
> - #define MR_region_debug_ite_frame_protected_regions(ite_sp); \
> + #define MR_region_debug_ite_frame_protected_regions(ite_sp) \
> MR_region_ite_frame_protected_regions_msg(ite_sp)
>
> - #define MR_region_debug_ite_frame_snapshots(ite_sp); \
> + #define MR_region_debug_ite_frame_snapshots(ite_sp) \
> MR_region_ite_frame_snapshots_msg(ite_sp)
>
> /* Debug disj frame messages. */
> @@ -834,11 +903,11 @@
> #define MR_region_debug_disj_frame(disj_sp) \
> MR_region_disj_frame_msg(disj_sp)
>
> - #define MR_region_debug_disj_frame_protected_regions(disj_sp); \
> - MR_region_disj_frame_protected_regions_msg(disj_sp);
> + #define MR_region_debug_disj_frame_protected_regions(disj_sp) \
> + MR_region_disj_frame_protected_regions_msg(disj_sp)
>
> - #define MR_region_debug_disj_frame_snapshots(disj_sp); \
> - MR_region_disj_frame_snapshots_msg(disj_sp);
> + #define MR_region_debug_disj_frame_snapshots(disj_sp) \
> + MR_region_disj_frame_snapshots_msg(disj_sp)
>
> /* Debug commit frame messages. */
> #define MR_region_debug_push_commit_frame(frame) \
> @@ -847,9 +916,39 @@
> #define MR_region_debug_commit_frame(frame) \
> MR_region_commit_frame_msg(frame)
>
> - #define MR_region_debug_commit_frame_saved_regions(commit_sp); \
> + #define MR_region_debug_commit_frame_saved_regions(commit_sp) \
> MR_region_commit_frame_saved_regions_msg(commit_sp)
>
> +/* Some other helpers */
> + #define MR_region_debug_start(name) \
> + MR_region_start_msg(name)
> +
> + #define MR_region_debug_end(name) \
> + MR_region_end_msg(name)
> +
> + #define MR_region_debug_fill_ite_protect(ite_prot, region) \
> + MR_region_fill_ite_protect_msg(ite_prot, region)
> +
> + #define MR_region_debug_fill_ite_snapshot_not_removed(snapshot, \
> + region) \
> + MR_region_fill_ite_snapshot_not_removed_msg(snapshot, \
> + region)
> +
> + #define MR_region_debug_fill_ite_snapshot_removed(snapshot, region) \
> + MR_region_fill_ite_snapshot_removed_msg(snapshot, region)
> +
> + #define MR_region_debug_fill_disj_snapshot(snapshot, region) \
> + MR_region_fill_disj_snapshot_msg(snapshot, region)
> +
> + #define MR_region_debug_fill_commit(commit_save, region) \
> + MR_region_fill_commit_msg(commit_save, region)
> +
> + #define MR_region_debug_ite_unprotect(protected_region) \
> + MR_region_ite_unprotect_msg(protected_region)
> +
> + #define MR_region_debug_restore_from_snapshot(snapshot) \
> + MR_region_restore_from_snapshot_msg(snapshot)
> +
> #else /* MR_RBMM_DEBUG */
> #define MR_region_debug_create_region(region) \
> ((void) 0)
> @@ -857,13 +956,15 @@
> #define MR_region_debug_try_remove_region(region) \
> ((void) 0)
>
> -
> #define MR_region_debug_region_struct_removal_info(region) \
> ((void) 0)
>
> #define MR_region_debug_destroy_region(region) \
> ((void) 0)
>
> + #define MR_region_debug_logically_remove_region(region) \
> + ((void) 0)
> +
> #define MR_region_debug_push_ite_frame(frame) \
> ((void) 0)
>
> @@ -894,6 +995,34 @@
> #define MR_region_debug_commit_frame_saved_regions(commit_sp) \
> ((void) 0)
>
> + #define MR_region_debug_start(name) \
> + ((void) 0)
> +
> + #define MR_region_debug_end(name) \
> + ((void) 0)
> +
> + #define MR_region_debug_fill_ite_protect(ite_prot, region); \
> + ((void) 0)
> +
> + #define MR_region_debug_fill_ite_snapshot_not_removed(snapshot, \
> + region) \
> + ((void) 0)
> +
> + #define MR_region_debug_fill_ite_snapshot_removed(snapshot, region) \
> + ((void) 0)
> +
> + #define MR_region_debug_fill_disj_snapshot(snapshot, region) \
> + ((void) 0)
> +
> + #define MR_region_debug_fill_commit(commit_save, region); \
> + ((void) 0)
> +
> + #define MR_region_debug_ite_unprotect(protected_region) \
> + ((void) 0)
> +
> + #define MR_region_debug_restore_from_snapshot(snapshot); \
> + ((void) 0)
> +
> #endif /* MR_RBMM_DEBUG */
>
> extern void MR_region_create_region_msg(MR_Region *region);
> @@ -925,6 +1054,21 @@
> int saved_seq_number, int number_of_saved_regions,
> MR_RegionCommitFixedFrame *commit_frame);
>
> +extern void MR_region_start_msg(const char *);
> +extern void MR_region_end_msg(const char *);
> +
> +extern void MR_region_fill_ite_protect_msg(MR_RegionIteProtect *,
> + MR_Region *);
> +extern void MR_region_fill_ite_snapshot_not_removed_msg(
> + MR_RegionSnapshot *, MR_Region *);
> +extern void MR_region_fill_ite_snapshot_removed_msg(MR_RegionSnapshot *,
> + MR_Region *);
> +extern void MR_region_fill_disj_snapshot_msg(MR_RegionSnapshot *,
> + MR_Region *);
> +extern void MR_region_fill_commit_msg(MR_RegionCommitSave *, MR_Region *);
> +extern void MR_region_ite_unprotect_msg(MR_Region *);
> +extern void MR_region_restore_from_snapshot_msg(MR_RegionSnapshot *);
> +
> /*---------------------------------------------------------------------------*/
> /* Profiling RBMM. */
>
> @@ -957,7 +1101,7 @@
> extern MR_RegionProfUnit MR_rbmmp_pages_used;
> extern unsigned int MR_rbmmp_page_requested;
> extern unsigned int MR_rbmmp_biggest_region_size;
> -extern MR_RegionProfUnit MR_rbmmp_regions_saved_at_commit;
> +extern unsigned int MR_rbmmp_regions_saved_at_commit;
> extern unsigned int MR_rbmmp_regions_protected_at_ite;
> extern unsigned int MR_rbmmp_snapshots_saved_at_ite;
> extern unsigned int MR_rbmmp_regions_protected_at_disj;
> @@ -970,10 +1114,10 @@
> MR_RegionProfUnit *profiling_unit, int quantity);
> extern void MR_region_profile_destroyed_region(MR_Region *);
> extern void MR_region_profile_restore_from_snapshot(MR_RegionSnapshot *);
> +extern void MR_region_profile_increase_counter(unsigned int *);
> extern int MR_region_get_number_of_pages(MR_RegionPage *,
> MR_RegionPage *);
> extern void MR_region_print_profiling_info(void);
> -
> /*---------------------------------------------------------------------------*/
>
> #endif /* MR_USE_REGIONS */
> cvs diff: Diffing runtime/GETOPT
> cvs diff: Diffing runtime/machdeps
> cvs diff: Diffing samples
> cvs diff: Diffing samples/c_interface
> cvs diff: Diffing samples/c_interface/c_calls_mercury
> cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
> cvs diff: Diffing samples/c_interface/mercury_calls_c
> cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
> cvs diff: Diffing samples/c_interface/mercury_calls_fortran
> cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
> cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
> cvs diff: Diffing samples/c_interface/standalone_c
> cvs diff: Diffing samples/diff
> cvs diff: Diffing samples/muz
> cvs diff: Diffing samples/rot13
> cvs diff: Diffing samples/solutions
> cvs diff: Diffing samples/solver_types
> cvs diff: Diffing samples/tests
> cvs diff: Diffing samples/tests/c_interface
> cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
> cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
> cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
> cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
> cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
> cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
> cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
> cvs diff: Diffing samples/tests/diff
> cvs diff: Diffing samples/tests/muz
> cvs diff: Diffing samples/tests/rot13
> cvs diff: Diffing samples/tests/solutions
> cvs diff: Diffing samples/tests/toplevel
> cvs diff: Diffing scripts
> cvs diff: Diffing slice
> cvs diff: Diffing ssdb
> cvs diff: Diffing tools
> cvs diff: Diffing trace
> cvs diff: Diffing trax
> cvs diff: Diffing trial
> cvs diff: Diffing util
> cvs diff: Diffing vim
> cvs diff: Diffing vim/after
> cvs diff: Diffing vim/ftplugin
> cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list