[m-rev.] For review: Implement the saving of protected regions for semidet disjunctions
Quan Phan
quan.phan at cs.kuleuven.be
Thu Jan 10 22:31:07 AEDT 2008
Hi,
For review by Zoltan.
Estimated hours taken: 4
Branch: main
Implement the saving of protected regions at disj frames ONLY for
semidet disjunctions. We need this information so as to be able to
commit the regions' removals when a nonlast disjunct of a semidet
disjunction succeeds.
Now the fixed part of a disj frame will have 4 slots instead of 3. The
extra slot is to store the number of protected regions. It will be zero
for nondet disjunctions.
For semidet disjunctions we can use the information in their
rbmm_goal_info for protected regions and allocated-into regions.
Also implement the profiling and debugging messages for the saving.
compiler/disj_gen.m:
Implement the saving of protected regions for semidet
disjunctions.
Remove the old code that do the saving for nondet disjunctions.
compiler/llds.m
compiler/llds_out.m
Regards,
Quan.
compiler/opt_debug.m
Make them conform to the main change.
compiler/options.m
Make sure the size of the fixed part of disj frames is 4
(slots).
Change to conform to the main change.
runtime/mercury_region.h
runtime/mercury_region.c
Implement the saving and its profiling and debugging messages.
-------------- next part --------------
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/disj_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/disj_gen.m,v
retrieving revision 1.108
diff -u -r1.108 disj_gen.m
--- compiler/disj_gen.m 30 Dec 2007 04:09:20 -0000 1.108
+++ compiler/disj_gen.m 10 Jan 2008 11:02:17 -0000
@@ -361,14 +361,13 @@
ReclaimHeap),
maybe_save_hp(ReclaimHeap, SaveHpCode, MaybeHpSlot, !CI),
- maybe_create_disj_region_frame(AddRegionOps, DisjGoalInfo,
- do_not_commit_at_end_of_disjunct,
- BeforeEnterRegionCode, LaterRegionCode, LastRegionCode,
- _RegionStackVars, RegionCommitDisjCleanup, !CI),
+ maybe_create_disj_region_frame_nondet(AddRegionOps, DisjGoalInfo,
+ BeforeEnterRegionCode, LaterRegionCode, LastRegionCode, !CI),
% We can't release any of the stack slots holding the embedded stack
% frame, since we can't let code to the right of the disjunction reuse
% any of those slots.
- RegionStackVarsToRelease = []
+ RegionStackVarsToRelease = [],
+ RegionCommitDisjCleanup = no_commit_disj_region_cleanup
;
( CodeModel = model_det
; CodeModel = model_semi
@@ -409,8 +408,8 @@
;
% We only need region support for backtracking if some disjunct
% performs some region operations (allocation or removal).
- maybe_create_disj_region_frame(AddRegionOps, DisjGoalInfo,
- commit_at_end_of_disjunct,
+ maybe_create_disj_region_frame_semi(AddRegionOps,
+ DisjRemovedRegionVars, DisjAllocRegionVars,
BeforeEnterRegionCode, LaterRegionCode, LastRegionCode,
RegionStackVars, RegionCommitDisjCleanup, !CI),
RegionStackVarsToRelease = RegionStackVars
@@ -678,10 +677,6 @@
%-----------------------------------------------------------------------------%
-:- type commit_at_end_of_disjunct
- ---> commit_at_end_of_disjunct
- ; do_not_commit_at_end_of_disjunct.
-
:- type commit_disj_region_cleanup
---> no_commit_disj_region_cleanup
; commit_disj_region_cleanup(
@@ -689,38 +684,125 @@
cleanup_code :: code_tree
).
-:- pred maybe_create_disj_region_frame(add_region_ops::in, hlds_goal_info::in,
- commit_at_end_of_disjunct::in,
- code_tree::out, code_tree::out, code_tree::out, list(lval)::out,
- commit_disj_region_cleanup::out, code_info::in, code_info::out) is det.
-
-maybe_create_disj_region_frame(DisjRegionOps, _DisjGoalInfo,
- CommitAtEndOfDisjunct, BeforeEnterCode, LaterCode, LastCode,
- StackVars, RegionCommitDisjCleanup, !CI) :-
+:- pred maybe_create_disj_region_frame_nondet(add_region_ops::in,
+ hlds_goal_info::in, code_tree::out, code_tree::out, code_tree::out,
+ code_info::in, code_info::out) is det.
+
+maybe_create_disj_region_frame_nondet(DisjRegionOps, _DisjGoalInfo,
+ BeforeEnterCode, LaterCode, LastCode, !CI) :-
(
DisjRegionOps = do_not_add_region_ops,
BeforeEnterCode = empty,
LaterCode = empty,
- LastCode = empty,
- StackVars = [],
- RegionCommitDisjCleanup = no_commit_disj_region_cleanup
+ LastCode = empty
;
DisjRegionOps = add_region_ops,
get_forward_live_vars(!.CI, ForwardLiveVars),
LiveRegionVars = filter_region_vars(!.CI, ForwardLiveVars),
- % XXX In computing both ProtectRegionVars and SnapshotRegionVars,
+ % Protection of backward live regions for nondet disjunction is by
+ % saving the sequence number to the disj frame, therefore we do not
+ % need to save any protected regions.
+
+ % XXX In computing SnapshotRegionVars,
% we should intersect LiveRegionVars with the set of region variables
% whose regions (the regions themselves, not their variables) are live
% at the starts of some later disjuncts (i.e. aren't used only in the
% first disjunct). We don't yet gather this information.
- %
- % XXX In computing ProtectRegionVars, we should also delete any
- % variables that are statically known to be already protected by
- % an outer disjunction, but we don't yet have the program analysis
- % required to gather such information.
- ProtectRegionVars = LiveRegionVars,
SnapshotRegionVars = LiveRegionVars,
+ SnapshotRegionVarList = set.to_sorted_list(SnapshotRegionVars),
+ list.length(SnapshotRegionVarList, NumSnapshotRegionVars),
+
+ get_globals(!.CI, Globals),
+ globals.lookup_int_option(Globals, size_region_disj_fixed,
+ FixedSize),
+ globals.lookup_int_option(Globals, size_region_disj_snapshot,
+ SnapshotSize),
+ FrameSize = FixedSize + SnapshotSize * NumSnapshotRegionVars,
+
+ Items = list.duplicate(FrameSize, slot_region_disj),
+ acquire_several_temp_slots(Items, non_persistent_temp_slot,
+ _StackVars, MainStackId, FirstSlotNum, LastSlotNum, !CI),
+ EmbeddedStackFrame = embedded_stack_frame_id(MainStackId,
+ FirstSlotNum, LastSlotNum),
+ FirstNonFixedAddr =
+ first_nonfixed_embedded_slot_addr(EmbeddedStackFrame, FixedSize),
+ acquire_reg(reg_r, SnapshotNumRegLval, !CI),
+ acquire_reg(reg_r, AddrRegLval, !CI),
+ PushInitCode = node([
+ llds_instr(
+ push_region_frame(region_stack_disj, EmbeddedStackFrame),
+ "Save stack pointer of embedded region nondet stack"),
+ llds_instr(
+ assign(SnapshotNumRegLval, const(llconst_int(0))),
+ "Initialize number of snapshot_infos"),
+ llds_instr(
+ assign(AddrRegLval, FirstNonFixedAddr),
+ "Initialize pointer to nonfixed part of embedded frame")
+ ]),
+ disj_alloc_snapshot_regions(SnapshotNumRegLval, AddrRegLval,
+ EmbeddedStackFrame, SnapshotRegionVarList, SnapshotRegionCode,
+ !CI),
+ SetCode = node([
+ llds_instr(
+ region_set_fixed_slot(region_set_disj_num_snapshots,
+ EmbeddedStackFrame, lval(SnapshotNumRegLval)),
+ "Store the number of snapshot_infos")
+ ]),
+ release_reg(SnapshotNumRegLval, !CI),
+ release_reg(AddrRegLval, !CI),
+
+ BeforeEnterCode = tree_list([
+ PushInitCode,
+ SnapshotRegionCode,
+ SetCode
+ ]),
+ LaterCode = node([
+ llds_instr(
+ use_and_maybe_pop_region_frame(region_disj_later,
+ EmbeddedStackFrame),
+ "region enter later disjunct")
+ ]),
+ LastCode = node([
+ llds_instr(
+ use_and_maybe_pop_region_frame(region_disj_last,
+ EmbeddedStackFrame),
+ "region enter last disjunct")
+ ])
+ ).
+
+:- pred maybe_create_disj_region_frame_semi(add_region_ops::in,
+ set(prog_var)::in, set(prog_var)::in, code_tree::out, code_tree::out,
+ code_tree::out, list(lval)::out, commit_disj_region_cleanup::out,
+ code_info::in, code_info::out) is det.
+
+maybe_create_disj_region_frame_semi(DisjRegionOps, DisjRemovedRegionVars,
+ DisjAllocRegionVars, BeforeEnterCode, LaterCode, LastCode, StackVars,
+ RegionCommitDisjCleanup, !CI) :-
+ (
+ DisjRegionOps = do_not_add_region_ops,
+ BeforeEnterCode = empty,
+ LaterCode = empty,
+ LastCode = empty,
+ StackVars = [],
+ RegionCommitDisjCleanup = no_commit_disj_region_cleanup
+ ;
+ DisjRegionOps = add_region_ops,
+
+ % For a semidet disjunction, we need to save the protected regions,
+ % i.e., those removed in the scope of the semidet disjunction,
+ % into the disj frame so that if a non-last disjunct succeeds,
+ % we can reclaim such regions. We will only save ones which
+ % are currently not protected (this is checked at runtime).
+ ProtectRegionVars = DisjRemovedRegionVars,
+
+ % XXX In computing SnapshotRegionVars,
+ % we should intersect DisjAllocRegionVars with the set of region
+ % variables whose regions (the regions themselves, not their variables)
+ % are live at the starts of some later disjuncts (i.e. aren't used only
+ % in the first disjunct). We don't yet gather this information.
+ %
+ SnapshotRegionVars = DisjAllocRegionVars,
ProtectRegionVarList = set.to_sorted_list(ProtectRegionVars),
SnapshotRegionVarList = set.to_sorted_list(SnapshotRegionVars),
@@ -731,7 +813,7 @@
get_globals(!.CI, Globals),
globals.lookup_int_option(Globals, size_region_disj_fixed,
FixedSize),
- globals.lookup_int_option(Globals, size_region_disj_protect,
+ globals.lookup_int_option(Globals, size_region_semi_disj_protect,
ProtectSize),
globals.lookup_int_option(Globals, size_region_disj_snapshot,
SnapshotSize),
@@ -802,21 +884,15 @@
"region enter last disjunct")
]),
- (
- CommitAtEndOfDisjunct = do_not_commit_at_end_of_disjunct,
- RegionCommitDisjCleanup = no_commit_disj_region_cleanup
- ;
- CommitAtEndOfDisjunct = commit_at_end_of_disjunct,
- get_next_label(CleanupLabel, !CI),
- CleanupCode = node([
- llds_instr(
- use_and_maybe_pop_region_frame(
- region_disj_nonlast_semi_commit, EmbeddedStackFrame),
- "region cleanup commit for nonlast disjunct")
- ]),
- RegionCommitDisjCleanup = commit_disj_region_cleanup(CleanupLabel,
- CleanupCode)
- )
+ get_next_label(CleanupLabel, !CI),
+ CleanupCode = node([
+ llds_instr(
+ use_and_maybe_pop_region_frame(
+ region_disj_nonlast_semi_commit, EmbeddedStackFrame),
+ "region cleanup commit for nonlast disjunct")
+ ]),
+ RegionCommitDisjCleanup = commit_disj_region_cleanup(CleanupLabel,
+ CleanupCode)
).
:- pred disj_protect_regions(lval::in, lval::in, embedded_stack_frame_id::in,
@@ -828,7 +904,7 @@
produce_variable(RegionVar, ProduceVarCode, RegionVarRval, !CI),
SaveCode = node([
llds_instr(
- region_fill_frame(region_fill_disj_protect,
+ region_fill_frame(region_fill_semi_disj_protect,
EmbeddedStackFrame, RegionVarRval, NumLval, AddrLval),
"disj protect the region if needed")
]),
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.356
diff -u -r1.356 llds.m
--- compiler/llds.m 30 Dec 2007 08:23:46 -0000 1.356
+++ compiler/llds.m 10 Jan 2008 11:02:18 -0000
@@ -768,7 +768,7 @@
:- type region_fill_frame_op
---> region_fill_ite_protect
; region_fill_ite_snapshot(removed_at_start_of_else)
- ; region_fill_disj_protect
+ ; region_fill_semi_disj_protect
; region_fill_disj_snapshot
; region_fill_commit.
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.321
diff -u -r1.321 llds_out.m
--- compiler/llds_out.m 30 Dec 2007 08:23:47 -0000 1.321
+++ compiler/llds_out.m 10 Jan 2008 11:02:21 -0000
@@ -2601,8 +2601,8 @@
FillOp = region_fill_ite_snapshot(not_removed_at_start_of_else),
io.write_string("\tMR_region_fill_ite_snapshot_not_removed", !IO)
;
- FillOp = region_fill_disj_protect,
- io.write_string("\tMR_region_fill_disj_protect", !IO)
+ FillOp = region_fill_semi_disj_protect,
+ io.write_string("\tMR_region_fill_semi_disj_protect", !IO)
;
FillOp = region_fill_disj_snapshot,
io.write_string("\tMR_region_fill_disj_snapshot", !IO)
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.203
diff -u -r1.203 opt_debug.m
--- compiler/opt_debug.m 30 Dec 2007 08:23:51 -0000 1.203
+++ compiler/opt_debug.m 10 Jan 2008 11:02:22 -0000
@@ -846,8 +846,8 @@
FillOp = region_fill_ite_snapshot(not_removed_at_start_of_else),
FillOpStr = "ite_snapshot(not_removed_at_start_of_else)"
;
- FillOp = region_fill_disj_protect,
- FillOpStr = "disj_protect"
+ FillOp = region_fill_semi_disj_protect,
+ FillOpStr = "semi_disj_protect"
;
FillOp = region_fill_disj_snapshot,
FillOpStr = "disj_snapshot"
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.608
diff -u -r1.608 options.m
--- compiler/options.m 30 Dec 2007 08:23:52 -0000 1.608
+++ compiler/options.m 10 Jan 2008 11:02:25 -0000
@@ -471,11 +471,12 @@
; size_region_ite_fixed
; size_region_disj_fixed
+ ; size_region_semi_disj_fixed
; size_region_commit_fixed
; size_region_ite_protect
; size_region_ite_snapshot
- ; size_region_disj_protect
+ ; size_region_semi_disj_protect
; size_region_disj_snapshot
; size_region_commit_entry
@@ -1221,15 +1222,11 @@
% The size_* values below *must* be consistent with the corresponding
% values or data structures in mercury_region.h.
size_region_ite_fixed - int(4),
- size_region_disj_fixed - int(3),
+ size_region_disj_fixed - int(4),
size_region_commit_fixed - int(4),
size_region_ite_protect - int(1),
size_region_ite_snapshot - int(3),
- size_region_disj_protect - int(0),
- % size_region_disj_protect is no longer
- % used. It should be removed when the
- % runtime support for RBMM is more
- % stable.
+ size_region_semi_disj_protect - int(1),
size_region_disj_snapshot - int(3),
size_region_commit_entry - int(1),
solver_type_auto_init - bool(no),
@@ -2017,14 +2014,14 @@
long_option("disable-mm-pneg", disable_minimal_model_stack_copy_pneg).
long_option("disable-mm-cut", disable_minimal_model_stack_copy_cut).
long_option("disable-trail-ops", disable_trail_ops).
-long_option("size-region-ite-fixed", size_region_ite_fixed).
-long_option("size-region-disj-fixed", size_region_disj_fixed).
-long_option("size-region-commit-fixed", size_region_commit_fixed).
-long_option("size-region-ite-protect", size_region_ite_protect).
-long_option("size-region-ite-snapshot", size_region_ite_snapshot).
-long_option("size-region-disj-protect", size_region_disj_protect).
-long_option("size-region-disj-snapshot", size_region_disj_snapshot).
-long_option("size-region-commit-entry", size_region_commit_entry).
+long_option("size-region-ite-fixed", size_region_ite_fixed).
+long_option("size-region-disj-fixed", size_region_disj_fixed).
+long_option("size-region-commit-fixed", size_region_commit_fixed).
+long_option("size-region-ite-protect", size_region_ite_protect).
+long_option("size-region-ite-snapshot", size_region_ite_snapshot).
+long_option("size-region-semi-disj-protect", size_region_semi_disj_protect).
+long_option("size-region-disj-snapshot", size_region_disj_snapshot).
+long_option("size-region-commit-entry", size_region_commit_entry).
long_option("solver-type-auto-init", solver_type_auto_init).
long_option("allow-multi-arm-switches", allow_multi_arm_switches).
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.8
diff -u -r1.8 mercury_region.c
--- runtime/mercury_region.c 21 Dec 2007 14:18:59 -0000 1.8
+++ runtime/mercury_region.c 10 Jan 2008 11:02:26 -0000
@@ -38,7 +38,7 @@
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_regions_protected_at_semi_disj = 0;
unsigned int MR_rbmmp_snapshots_saved_at_disj = 0;
double MR_rbmmp_page_utilized;
unsigned int MR_rbmmp_words_snapshot_instant_reclaimed = 0;
@@ -761,6 +761,19 @@
}
void
+MR_region_fill_semi_disj_protect_msg(MR_RegionSemiDisjProtect *semi_disj_prot,
+ MR_RegionHeader *region)
+{
+ if (semi_disj_prot == NULL) {
+ printf("\tNot protect region #%d.\n",
+ region->MR_region_sequence_number);
+ } else {
+ printf("\tAt slot: %d, protect region #%d.\n", semi_disj_prot,
+ region->MR_region_sequence_number);
+ }
+}
+
+void
MR_region_fill_disj_snapshot_msg(MR_RegionSnapshot *snapshot,
MR_RegionHeader *region)
{
@@ -944,6 +957,8 @@
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 protected at (semi) disj frames: %d.\n",
+ MR_rbmmp_regions_protected_at_semi_disj);
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);
Index: runtime/mercury_region.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_region.h,v
retrieving revision 1.10
diff -u -r1.10 mercury_region.h
--- runtime/mercury_region.h 30 Dec 2007 04:09:25 -0000 1.10
+++ runtime/mercury_region.h 10 Jan 2008 11:02:27 -0000
@@ -45,16 +45,11 @@
** runtime errors likely happen.
*/
#define MR_REGION_ITE_FRAME_FIXED_SIZE 4
-#define MR_REGION_DISJ_FRAME_FIXED_SIZE 3
+#define MR_REGION_DISJ_FRAME_FIXED_SIZE 4
#define MR_REGION_COMMIT_FRAME_FIXED_SIZE 4
#define MR_REGION_ITE_PROT_SIZE 1
#define MR_REGION_ITE_SNAPSHOT_SIZE 3
-/*
-** XXX The MR_REGION_DISJ_PROT_SIZE is no longer used. It should be removed
-** when the runtime support for RBMM becomes more stable. When removing it,
-** remember to make the compiler/options.m consistent with the removal here.
-*/
-#define MR_REGION_DISJ_PROT_SIZE 0
+#define MR_REGION_SEMI_DISJ_PROT_SIZE 1
#define MR_REGION_DISJ_SNAPSHOT_SIZE 3
#define MR_REGION_COMMIT_SAVE_SIZE 1
@@ -158,6 +153,7 @@
MR_RegionDisjFixedFrame *MR_rdff_previous_disj_frame;
MR_Word MR_rdff_saved_sequence_number;
MR_Word MR_rdff_num_snapshots;
+ MR_Word MR_rdff_num_prot_regions;
};
struct MR_RegionCommitFixedFrame_Struct {
@@ -183,8 +179,8 @@
};
/* Protection information in a disj frame. */
-struct MR_RegionDisjProtect_Struct {
- MR_RegionHeader *MR_disj_prot_region;
+struct MR_RegionSemiDisjProtect_Struct {
+ MR_RegionHeader *MR_semi_disj_prot_region;
};
/* Save information in a commit frame */
@@ -285,6 +281,7 @@
MR_region_disj_sp; \
new_disj_frame->MR_rdff_saved_sequence_number = \
MR_region_sequence_number; \
+ new_disj_frame->MR_rdff_num_prot_regions = 0; \
MR_region_disj_sp = new_disj_frame; \
MR_region_profile_push_disj_frame; \
MR_region_debug_push_disj_frame(new_disj_frame); \
@@ -404,9 +401,29 @@
"fill_ite_snapshot_not_removed"); \
} while (0)
-#define MR_region_fill_disj_protect(disj_sp, region_ptr, \
+#define MR_region_fill_semi_disj_protect(disj_sp, region_ptr, \
num_protected_regions, protection_block) \
do { \
+ MR_RegionHeader *region; \
+ MR_RegionSemiDisjProtect *semi_disj_prot; \
+ \
+ MR_region_debug_start("fill_semi_disj_protect"); \
+ region = (MR_RegionHeader *) (region_ptr); \
+ if (!MR_region_is_disj_protected(region) && \
+ region->MR_region_ite_protected == NULL) \
+ { \
+ semi_disj_prot = \
+ (MR_RegionSemiDisjProtect *) (protection_block); \
+ semi_disj_prot->MR_semi_disj_prot_region = region; \
+ (num_protected_regions)++; \
+ (protection_block) = (MR_Word)(semi_disj_prot + 1); \
+ MR_region_profile_fill_semi_disj_protect; \
+ MR_region_debug_fill_semi_disj_protect(semi_disj_prot, \
+ region); \
+ } else { \
+ MR_region_debug_fill_semi_disj_protect(NULL, region); \
+ } \
+ MR_region_debug_end("fill_ite_protect"); \
} while (0)
#define MR_region_fill_disj_snapshot(disj_sp, region_ptr, \
@@ -478,6 +495,10 @@
#define MR_region_set_disj_num_protects(disj_sp, num) \
do { \
+ MR_RegionDisjFixedFrame *top_disj_frame; \
+ \
+ top_disj_frame = (MR_RegionDisjFixedFrame *) (disj_sp); \
+ top_disj_frame->MR_rdff_num_prot_regions = (num); \
} while (0)
#define MR_region_set_disj_num_snapshots(disj_sp, num) \
@@ -616,10 +637,20 @@
#define MR_use_region_disj_nonlast_semi_commit(disj_sp) \
do { \
MR_RegionDisjFixedFrame *top_disj_frame; \
+ MR_RegionSemiDisjProtect *semi_disj_prot; \
+ int i; \
\
- MR_region_debug_start("use_region_disj_nonlast_semi_commit"); \
+ MR_region_debug_start( \
+ "use_region_disj_nonlast_semi_commit"); \
top_disj_frame = (MR_RegionDisjFixedFrame *) (disj_sp); \
/* XXX destroy any regions protected by the disj frame */ \
+ semi_disj_prot = (MR_RegionSemiDisjProtect *) ( (disj_sp) + \
+ MR_REGION_DISJ_FRAME_FIXED_SIZE); \
+ for (i = 0; i < top_disj_frame->MR_rdff_num_prot_regions; \
+ i++, semi_disj_prot++) { \
+ MR_region_destroy_region( \
+ semi_disj_prot->MR_semi_disj_prot_region); \
+ } \
MR_pop_region_disj_frame(top_disj_frame); \
MR_region_debug_end("use_region_disj_nonlast_semi_commit"); \
} while (0)
@@ -800,7 +831,9 @@
"disj_restore_from_snapshots"); \
first_snapshot = (MR_RegionSnapshot *) ( \
(MR_Word *) (top_disj_frame) + \
- MR_REGION_DISJ_FRAME_FIXED_SIZE); \
+ MR_REGION_DISJ_FRAME_FIXED_SIZE + \
+ MR_REGION_SEMI_DISJ_PROT_SIZE * \
+ top_disj_frame->MR_rdff_num_prot_regions); \
MR_restore_snapshots(top_disj_frame->MR_rdff_num_snapshots, \
first_snapshot); \
MR_region_debug_end( \
@@ -967,6 +1000,10 @@
#define MR_region_debug_fill_ite_snapshot_removed(snapshot, region) \
MR_region_fill_ite_snapshot_removed_msg(snapshot, region)
+ #define MR_region_debug_fill_semi_disj_protect(semi_disj_prot, \
+ region) \
+ MR_region_fill_semi_disj_protect_msg(semi_disj_prot, region)
+
#define MR_region_debug_fill_disj_snapshot(snapshot, region) \
MR_region_fill_disj_snapshot_msg(snapshot, region)
@@ -1041,6 +1078,10 @@
#define MR_region_debug_fill_ite_snapshot_removed(snapshot, region) \
((void) 0)
+ #define MR_region_debug_fill_semi_disj_protect(semi_disj_prot, \
+ region) \
+ ((void) 0)
+
#define MR_region_debug_fill_disj_snapshot(snapshot, region) \
((void) 0)
@@ -1135,6 +1176,7 @@
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_semi_disj;
extern unsigned int MR_rbmmp_snapshots_saved_at_disj;
extern double MR_rbmmp_page_utilized;
extern unsigned int MR_rbmmp_words_snapshot_instant_reclaimed;
@@ -1242,6 +1284,15 @@
&MR_rbmmp_snapshots_saved_at_ite); \
} while (0)
+#define MR_region_profile_fill_semi_disj_protect \
+ do { \
+ MR_region_update_profiling_unit( \
+ &MR_rbmmp_words_used_by_disj_frames, \
+ MR_REGION_SEMI_DISJ_PROT_SIZE); \
+ MR_region_profile_increase_counter( \
+ &MR_rbmmp_regions_protected_at_semi_disj); \
+ } while (0)
+
#define MR_region_profile_fill_disj_snapshot \
do { \
MR_region_update_profiling_unit( \
@@ -1275,6 +1326,9 @@
#define MR_region_profile_fill_ite_protect \
((void) 0)
+#define MR_region_profile_fill_semi_disj_protect \
+ ((void) 0)
+
#define MR_region_profile_fill_commit \
((void) 0)
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.54
diff -u -r1.54 mercury_types.h
--- runtime/mercury_types.h 20 Dec 2007 07:43:17 -0000 1.54
+++ runtime/mercury_types.h 10 Jan 2008 11:02:27 -0000
@@ -302,7 +302,7 @@
typedef struct MR_RegionDisjFixedFrame_Struct MR_RegionDisjFixedFrame;
typedef struct MR_RegionCommitFixedFrame_Struct MR_RegionCommitFixedFrame;
typedef struct MR_RegionIteProtect_Struct MR_RegionIteProtect;
-typedef struct MR_RegionDisjProtect_Struct MR_RegionDisjProtect;
+typedef struct MR_RegionSemiDisjProtect_Struct MR_RegionSemiDisjProtect;
typedef struct MR_RegionCommitSave_Struct MR_RegionCommitSave;
typedef struct MR_RegionProfUnit_Struct MR_RegionProfUnit;
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