[m-rev.] diff: trail usage analysis of compiler generated special preds
Julien Fischer
juliensf at cs.mu.OZ.AU
Fri Dec 23 15:02:10 AEDT 2005
Estimated hours taken: 1
Branches: main
Make the trail usage analysis less conservative with respect to compiler
generated special predicates. This increases the speed of a compiler built in
hlc.gc.tr with --intermodule-optimzation and trail usage analysis by about
3.5% and decreases the executable size by 5.2%.
compiler/trailing_analysis.m:
Do not assume that type-specific compiler generated unification and
comparison predicates always modify the trail; some of them, e.g.
those for enumerations, do not.
Delete this item from the TODO list.
compiler/mode_info.m:
Unrelated change: fix indentation in a spot.
compiler/ml_code_gen.m:
Unrelated change: s/Word/MR_Word/.
Julien.
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.166
diff -u -r1.166 ml_code_gen.m
--- compiler/ml_code_gen.m 8 Dec 2005 06:14:35 -0000 1.166
+++ compiler/ml_code_gen.m 21 Dec 2005 02:34:48 -0000
@@ -3125,7 +3125,7 @@
;
HighLevelData = no,
% For --no-high-level-data, we only need to use a cast is for
- % polymorphic types, which are `Word' in the C interface but
+ % polymorphic types, which are `MR_Word' in the C interface but
% `MR_Box' in the MLDS back-end.
(
( OrigType = variable(_, _)
Index: compiler/mode_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_info.m,v
retrieving revision 1.80
diff -u -r1.80 mode_info.m
--- compiler/mode_info.m 14 Dec 2005 05:14:14 -0000 1.80
+++ compiler/mode_info.m 21 Dec 2005 06:24:51 -0000
@@ -409,7 +409,7 @@
module_info_get_globals(ModuleInfo, Globals),
globals__lookup_bool_option(Globals, debug_modes, DebugModes),
globals__lookup_int_option(Globals, debug_modes_pred_id,
- DebugModesPredId),
+ DebugModesPredId),
pred_id_to_int(PredId, PredIdInt),
(
DebugModes = yes,
Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.3
diff -u -r1.3 trailing_analysis.m
--- compiler/trailing_analysis.m 6 Dec 2005 06:26:07 -0000 1.3
+++ compiler/trailing_analysis.m 23 Dec 2005 03:16:17 -0000
@@ -45,8 +45,6 @@
% - Use the results of closure analysis to determine the trailing
% status of higher-order calls.
% - Improve the analysis in the presence of solver types.
-% - Lift some of the restrictions on compiler-generated unification and
-% comparison preds.
% - Create specialised versions of higher-order procedures based on
% whether or not their arguments modify the trail.
@@ -287,27 +285,20 @@
% There are no builtins that will modify the trail.
Result = will_not_modify_trail
;
- % Handle unify and compare.
- (
- ModuleName = pred_info_module(CallPredInfo),
- any_mercury_builtin_module(ModuleName),
- Name = pred_info_name(CallPredInfo),
- Arity = pred_info_orig_arity(CallPredInfo),
- ( SpecialPredId = spec_pred_compare
- ; SpecialPredId = spec_pred_unify
- ),
- special_pred_name_arity(SpecialPredId, Name, _, Arity)
- ;
- % XXX This is too conservative.
- pred_info_get_origin(CallPredInfo, Origin),
- Origin = special_pred(SpecialPredId - _),
- ( SpecialPredId = spec_pred_compare
- ; SpecialPredId = spec_pred_unify
- )
- )
+ % Handle builtin unify and compare.
+ % NOTE: the type specific unify and compare predicates are just
+ % treated as though they were normal predicates.
+ ModuleName = pred_info_module(CallPredInfo),
+ any_mercury_builtin_module(ModuleName),
+ Name = pred_info_name(CallPredInfo),
+ Arity = pred_info_orig_arity(CallPredInfo),
+ ( SpecialPredId = spec_pred_compare
+ ; SpecialPredId = spec_pred_unify
+ ),
+ special_pred_name_arity(SpecialPredId, Name, _, Arity)
->
- % At the moment we assume that calls to out-of-line
- % unification/comparisons are going to modify the trail.
+ % XXX We should examine the argument types of calls to builtin.unify/2
+ % and builtin.compare/3 and then make a decision based on those.
Result = may_modify_trail
;
% Handle library predicates whose trailing status
@@ -712,23 +703,15 @@
->
Status = will_not_modify_trail
;
- % Handle unify and compare.
- (
- ModuleName = pred_info_module(CallPredInfo),
- any_mercury_builtin_module(ModuleName),
- Name = pred_info_name(CallPredInfo),
- Arity = pred_info_orig_arity(CallPredInfo),
- ( SpecialPredId = spec_pred_compare
- ; SpecialPredId = spec_pred_unify
- ),
- special_pred_name_arity(SpecialPredId, Name, _, Arity)
- ;
- pred_info_get_origin(CallPredInfo, Origin),
- Origin = special_pred(SpecialPredId - _),
- ( SpecialPredId = spec_pred_compare
- ; SpecialPredId = spec_pred_unify
- )
- )
+ % Handle builtin unify and compare.
+ ModuleName = pred_info_module(CallPredInfo),
+ any_mercury_builtin_module(ModuleName),
+ Name = pred_info_name(CallPredInfo),
+ Arity = pred_info_orig_arity(CallPredInfo),
+ ( SpecialPredId = spec_pred_compare
+ ; SpecialPredId = spec_pred_unify
+ ),
+ special_pred_name_arity(SpecialPredId, Name, _, Arity)
->
Status = may_modify_trail
;
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list