--- John Temples wrote: > On Thu, 6 Sep 2007, Xiaofan Chen wrote: > > > On 9/6/07, Morgan Olsson > wrote: > > > >> Due to spending most of the time in context > save/restore the program fail to handle timer > interrupts and external events. > >> > >> http://forum.microchip.com/tm.aspx?m=279936 > >> > >> Accordign to an answer in that thread it is > impossible to make C18 > >> create time-efficient (non-looping) context > save/restore. > > Yes, that's true, but that wasn't quite the point. > A sufficiently > small ISR will have little or no context saving in > the first place. > If you have a context save that's so large that the > compiler needs to > generate looping code, the problem isn't really with > the compiler. > > > Switching compiler won't help in this case. > > Hi-Tech's compilers aren't as limited as C18 in > dealing with this kind > of code. Even the standard compiler will "look > into" functions called > by the ISR to determine which managed resources they > use in order to > minimize the context save. Note that this works > only if the functions > called by the ISR appear before the ISR in the same > translation unit. > I don't know how the PRO compiler handles this > situation. > > -- > John W. Temples, III > -- If I understand your requirement. You want a compiler to inject context saving code into your ISR? It is possible that it could be done but the context that this code injection would work is within a narrow situation. Some thought. If there is a function pointer in the ISR *how* would the compiler know what to save? John PS: If you want to use a compiler that starts injecting code do consider the possibility of injection code or modifying code at locations you don't want...... ____________________________________________________________________________________ Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist