[m-rev.] Saving MR_region_disj_sp when pushing a commit frame

Quan Phan quan.phan at cs.kuleuven.be
Wed Oct 10 20:28:10 AEST 2007


Hi,

Estimated hours taken: 0.5

This diff updates the runtime support for region-based memore management
as follows.
- Save the disj stack pointer (MR_region_disj_sp) at commit frame (just
  like saving the maxfr).
- At commit success, disj-unprotect the disj-protected regions at the
  will-be-cut-off disj frames, and restore the MR_region_disj_sp.

compiler/options.m:
        Change size_region_commit_fixed from 3 to 4 to have one more slot for
        saving the disj stack pointer.

runtime/mercury_region.c:
        Delete and add some rbmm debug messages.

runtime/mercury_region.h:
        Change the related #defines as per the size increase.
        Implement the above 2-point change.

        Delete one unused debug message.
        Fix a bug in commit_failure.

Regards,
Quan.

-------------- next part --------------
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
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.588
diff -u -r1.588 options.m
--- compiler/options.m	9 Oct 2007 07:59:46 -0000	1.588
+++ compiler/options.m	10 Oct 2007 10:12:01 -0000
@@ -1201,7 +1201,7 @@
     % The values here must be consistent with those in mercury_region.h.
     size_region_ite_fixed               -   int(4),
     size_region_disj_fixed              -   int(4),
-    size_region_commit_fixed            -   int(3),
+    size_region_commit_fixed            -   int(4),
     size_region_ite_protect             -   int(1),
     size_region_ite_snapshot            -   int(4),
     size_region_disj_protect            -   int(1),
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.1
diff -u -r1.1 mercury_region.c
--- runtime/mercury_region.c	9 Oct 2007 07:59:54 -0000	1.1
+++ runtime/mercury_region.c	10 Oct 2007 10:12:02 -0000
@@ -528,9 +528,6 @@
 {
     printf("Destroy region ");
     MR_region_region_struct_removal_info_msg(region);
-    printf("ite frame: %d\n", MR_region_ite_sp);
-    printf("disj frame: %d\n", MR_region_disj_sp);
-    printf("commit frame: %d\n", MR_region_commit_sp);
 }
 
 void
@@ -735,6 +732,14 @@
     int     i;
     int     num_saved_regions;
 
+    printf("Commit frame #%d: %d\n",
+        MR_region_get_frame_number(commit_frame), commit_frame);
+    printf("\tPrevious frame #%d: %d\n",
+        MR_region_get_frame_number((MR_Word *) (*commit_frame)),
+        *commit_frame);
+    printf("\tSequence number at push: %d\n",
+        *(commit_frame + MR_REGION_COMMIT_FRAME_SEQUENCE_NUMBER));
+
     num_saved_regions =
         *(commit_frame + MR_REGION_COMMIT_FRAME_NUMBER_SAVED_REGIONS);
     first_saved_region = commit_frame +
Index: runtime/mercury_region.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_region.h,v
retrieving revision 1.1
diff -u -r1.1 mercury_region.h
--- runtime/mercury_region.h	9 Oct 2007 07:59:54 -0000	1.1
+++ runtime/mercury_region.h	10 Oct 2007 10:12:03 -0000
@@ -50,11 +50,12 @@
 #define     MR_REGION_FRAME_NUMBER_PROTECTED_REGIONS        2
 #define     MR_REGION_FRAME_NUMBER_SNAPSHOTS                3
 
-#define     MR_REGION_COMMIT_FRAME_FIXED_SIZE               3
+#define     MR_REGION_COMMIT_FRAME_FIXED_SIZE               4
 #define     MR_REGION_COMMIT_FRAME_PREVIOUS_FRAME           0
 #define     MR_REGION_COMMIT_FRAME_SEQUENCE_NUMBER          1
-#define     MR_REGION_COMMIT_FRAME_NUMBER_SAVED_REGIONS     2
-#define     MR_REGION_COMMIT_FRAME_FIRST_SAVED_REGION       3
+#define     MR_REGION_COMMIT_FRAME_DISJ_FRAME               2
+#define     MR_REGION_COMMIT_FRAME_NUMBER_SAVED_REGIONS     3
+#define     MR_REGION_COMMIT_FRAME_FIRST_SAVED_REGION       4
 
 #define     MR_REGION_SNAPSHOT_SIZE                         4
 #define     MR_REGION_SNAPSHOT_REGION                       0
@@ -245,17 +246,15 @@
                     *((new_disj_sp) + MR_REGION_FRAME_REGION_LIST));        \
                 MR_region_disj_sp = (new_disj_sp);                          \
                 MR_region_debug_push_disj_frame(new_disj_sp);               \
-                if (MR_live_region_list != NULL) {                          \
-                    MR_region_debug_region_struct_removal_info(             \
-                        MR_live_region_list);                               \
-                }                                                           \
             } while (0)
 
 #define     MR_push_region_commit_frame(new_commit_sp)                      \
             do {                                                            \
                 *(new_commit_sp) = (MR_Word) MR_region_commit_sp;           \
                 *(new_commit_sp + MR_REGION_COMMIT_FRAME_SEQUENCE_NUMBER) = \
-                     MR_region_sequence_number;                             \
+                    MR_region_sequence_number;                              \
+                *(new_commit_sp + MR_REGION_COMMIT_FRAME_DISJ_FRAME) =      \
+                    (MR_Word) MR_region_disj_sp;                            \
                 MR_region_commit_sp = (new_commit_sp);                      \
                 MR_region_debug_push_commit_frame(new_commit_sp);           \
             } while (0)
@@ -528,9 +527,25 @@
                     saved_region_seq_number);                               \
                 MR_destroy_marked_old_regions_at_commit(                    \
                     number_of_saved_regions, first_saved_region_slot);      \
+                MR_commit_success_undisjprotect_regions(commit_sp);         \
+                MR_region_disj_sp = ( (MR_Word *)                           \
+                    *((commit_sp) + MR_REGION_COMMIT_FRAME_DISJ_FRAME));    \
                 MR_pop_region_commit_frame(commit_sp);                      \
             } while (0)
 
+#define     MR_commit_success_undisjprotect_regions(commit_sp)              \
+            do {                                                            \
+                MR_Word *saved_disj_frame;                                  \
+                MR_Word *disj_frame;                                        \
+                                                                            \
+                saved_disj_frame = ( (MR_Word *)                            \
+                    *((commit_sp) + MR_REGION_COMMIT_FRAME_DISJ_FRAME));    \
+                disj_frame = MR_region_disj_sp;                             \
+                while (disj_frame != saved_disj_frame) {                    \
+                    MR_region_disj_unprotect_regions(disj_frame);           \
+                    disj_frame = (MR_Word *) *disj_frame;                   \
+                }                                                           \
+            } while (0)
 /*
 ** Commit failure means that the goal in the commit operation has failed.
 ** We reset any changes to the commit-related state of saved regions
@@ -551,7 +566,7 @@
                     (commit_sp) + MR_REGION_COMMIT_FRAME_FIRST_SAVED_REGION;\
                 for (i = 0; i < number_of_saved_regions; i++) {             \
                     region = (MR_Region *)                                  \
-                        (first_saved_region_slot +                          \
+                        *(first_saved_region_slot +                         \
                         i * MR_REGION_COMMIT_ENTRY_SIZE);                   \
                     if (region != NULL) {                                   \
                         region->MR_region_commit_frame = NULL;              \
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


More information about the reviews mailing list