[mercury-users] Inlining?

Peter Hawkins peter at hawkins.emu.id.au
Tue Jun 8 13:52:27 AEST 2004


Hi...

I have a function that looks like this:

:- type thing.
:- pragma foreign_type("C",thing,"cthing *").

:- func my_const = thing.
:- pragma inline(my_const/0).
:- pragma foreign_proc("C",
               my_const = (Ret :: out),
               [promise_pure,will_not_call_mercury, thread_safe],
               "Ret = a_const_thing;").

and 'a_const_thing' is a constant cthing * in a C file that is linked into the 
mercury program. This function is called a lot (> 200000 times on a small 
test case). However, it takes up a good 0.40 seconds of execution time 
(according to mprof). I looked at the generated C code and my_const doesn't 
seem to be inlined. (It looks like MR_np_call_localret_ent(...) in code built 
without profiling).

The grade flags I am using are --use-trail --profiling (the same thing seems 
to happen if I just have --use-trail).

Any suggestions as to why the mercury compiler won't inline that function?

=)
Peter
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list