??? 02/21/07 23:13 Read: times |
#133474 - Huge code != huge time Responding to: ???'s previous message |
Erik Malund said:
Shated() is huge and the latency variation will kill you A huge function (code size wise) does not have to take a long time to execute. Shared() could be a state machine that handles 50 different states, but each time throught it might only execute a small subsection of the total code. Erik Malund said:
BTW NOAREGS will no be sufficient, REENTRANT would be required as well unless the even more dangerous "avoiding it being called from the ISR when main is using it" is implemented. How can ensuring proper synchronisation be "dangerous"? If you don't properly plan which sections of code can be interrupted and which can't then even REENTRANT on everything will not save you, because these functions are likely manipulating internal state or external hardware which will then get corrupted with REENTRANT or not. Erik Malund said:
Stating a point in an exaggerated fashion: "if making two routines instead of one allow me to skip an if, I will make two routines" I say: "if a compiler optimisation can cause buggy code to be created, and the only way to prevent this is a detailed manual analysis of the global call tree, then I turn that optimisation off". If I decided that I wanted to use absolute register addressing, I think I would have to "decorate" every single one of my function names (eg Shared_RB0), and have an automated tool that scans the MAP file to make sure that I didn't call across register banks. Currently this is too much of a PITA for the gain that would be achieved. Also interestingly I don't believe that Keil library functions (although I rarely use them) can make use of absolute register addressing either, because they don't know which bank is active when they are called. Erik Malund said:
but why single out Keil for what is the fact for ALL compilers I don't mean to "single out" Keil, but I have no experience with the other compilers so I can't comment on them. And Keil costs big $$$, so I expect a good result. Keil have (for example) a "global register coloring" optimisation, but yet it can't optimise the simple sequence we are discussing? What's with that? |