[m-rev.] for review: speed up trailing in high-level C grades

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Dec 16 15:07:42 AEDT 2005

On Thu, 15 Dec 2005, Julien Fischer wrote:

> Estimated hours taken: 6
> Branches: main
> Speed up trailing in high-level C grades.  The code for adding trailing
> operations to the HLDS (in add_trail_ops.m) worked by inserting calls to the
> trailing predicates defined in private_builtin.m.  These predicates in turn
> call the macros defined in runtime/mercury_trailing.h.  The compiler was not
> inlining the trailing predicates which was imposing a significant penalty on
> the performance of trailing in the high-level C grades.
> This diff modifies add_trail_ops.m so that it optionally generates inline
> foreign_procs that call the trailing macros rather than generating calls to
> library predicates.  For the compiler in grade hlc.gc.tr this results in a
> 23.4% speed increase at the cost of a 4% increase in executable size.  (Since
> the two methods are compatible with each other there is scope for further
> exploring this space/time tradeoff.)
> XXX This needs to be documented properly.  Subject to further testing
>     I intend to make the inlined foreign_proc method the default one, so
>     I'll document it all properly then.
> XXX The non-C backends will need to use the library call method at the
>     moment but since trailing isn't really implemented for them that
>     won't be too much of a problem ;-)
> compiler/options.m:
> 	Add a new option `--generate-trail-ops-inline' that causes
> 	add_trail_ops.m to insert trail ops as inlined foreign_procs rather
> 	than calls to library predicates.
> 	XXX This still needs to be documented.
> compiler/add_trail_ops.m:
> 	Support adding trailing operations directly to the HLDS as inlined
> 	foreign_procs rather than library calls.
> 	Give some predicates distinct names.
> 	Add myself to the list of authors for this module.
> compiler/mercury_compile.m:
> 	Minor changes to conform to the above.

I'm committing this since it's easier to do further testing that
way.  Review comments are still welcome.

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