setjmp/longjmp, 68000 moveml instruction

John Gilmore gnu at sun.uucp
Thu Nov 22 17:32:12 AEST 1984


> Here is the 68000 entry/exit sequence used by the MIT pcc:
> 
> 	link	a6,#<localsize>
> 	tstb	sp@(132.)
> 	moveml	#mask,a6@(offset)
> 	...
> 	moveml	a6@(offset),#mask
> 	unlk	a6
> 	rts

There is an awful lot of fat in the MIT pcc code.  Above is some of it.
For example, it generates the moveml's even when the mask is zero (no
registers need to be saved).  Also, the offset used is ALWAYS the same
as the <localsize>, thus they could have done:
	moveml	#mask,sp@
saving another word of instructions & slowness.

Now, we could add back in some fat by inserting
	movw	#mask,sp@(someoffset)
to make longjmp work, but if the average subroutine is 30 instructions long,
that's a large price to pay.  I don't want to dedicate 3% of my system
to housekeeping for longjmp.  Even if the average is 100, 1% for longjmp
is still too much!



More information about the Comp.lang.c mailing list