From: Mike McCarty (jmccarty_at_ssd.usa.alcatel.com)
Date: 2001-03-19 21:26:24
On Mon, 19 Mar 2001, Ullrich von Bassewitz wrote: > > On Mon, Mar 19, 2001 at 01:25:43PM -0600, Mike McCarty wrote: > > > But that's another 4 cycles for each and every stack operation. C is > > > quite stack intensive. > > > > Depends on how it is implemented. > > I remember having discussed this some time ago. Anyway... Yes, I was on vacation last week. > 4 cycles is the time needed to execute a cli/sei pair. So it would be really > interesting to see an implementation needing less than this. And a "perfect" Well, some implementations don't use a stack unless necessary, but rather implement arguments to routines which do not *need* to be re-entrant (most of them, in my experience) as statically allocated locations. In this case, there is no stack manipulation, hence no need to disable interrupts. > implementation would not assume that interrupts are enabled on entry, so the > flags register has to be saved and restored later, which makes it 9 cycles > instead of just 4. Yes, I thought as much. > > Also, one could use a pragma to turn on/off the extra code. > > Since the code is buried in the library, a #pragma would not work. One would I don't see why not. The compiler could emit code to jump/call different library entry points. > have to generate and maintain two different libraries to link against. Each > platform would need an additional library file. Err? Two different libraries? If the linker is capable of linking in only routines actually used, then separate entry points with different names are all that is necessary. And both of the entry points could be built by conditional assembly/compilation from a single source. > Maybe I would give it a second thought if there weren't a better solution. > I've already suggested to use a wrapper function, and there's already an > implementation of it. Ok, it's for the BRK stuff instead of IRQ, but this is > really similar. The wrapper solution has none of the disadvantages mentioned, > and it is easy to use and to maintain. So why not use it? Well, that enters into a whole other realm of questioning. I saw questions about feasibility and run time cycles, not preferences. Mike ---- char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);} This message made from 100% recycled bits. I can explain it for you, but I can't understand it for you. I don't speak for Alcatel <- They make me say that. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:39 CET