Updates:
        Status: Accepted
        Owner: robhamerling

Comment #2 on issue 190 by robhamerling: The use of "pragma inline"s in the LCD_HD44780 libraries.
http://code.google.com/p/jallib/issues/detail?id=190

The 'pragma inline' directive in a procedure eliminates call/return instructions and thus the number of used stack levels. Generally it will also improve execution speed.
However an inline expanded procedure will generally use more code memory.
When shortage on stack levels is an issue (with deeply nested procedures or PIC with few stack levels) the use of pragma inline can become a must, even though the compiler will reduce the use of stack levels when possible. With small procedures the use of pragma inline will be more attractive to reduce code memory and improve speed than for large procedures, but when these procedures are called frequently the effect may be adverse.

For a specific program one could experiment to find an optimum, but to find a balance for libraries used by different programs and different types of PICS is not so obvious.

Analysis of some sample programs shows that the lcd_hd44780 libraries use relatively much code because some seemingly small procedures have a large expansion, among others because the use of port shadowing by the device files of the midrange PICs.

One possibility is to use 'pragma inline' more selectively. For example use it only for PICs with much code memory and many stack levels, like 18F and enhanced midrange. Need some experiments....


--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to