[net.micro.68k] nargs not possible with optimized code

gnu@sun.uucp (John Gilmore) (12/28/83)

We used to run Unisoft Unix and even a year ago their C optimizer would
optimize out the stack-adjusting instructions where possible.  For example,
it would turn:

	movl	arg,sp@-
	jsr	subr
	addql	#4,sp		<-- the instruction nargs() looks for
	movl	arg2,sp@-
	jsr	subr2
	addql	#4,sp		<-- the instruction nargs() looks for

into:

	movl	arg,sp@-
	jsr	subr
	movl	arg2,sp@	<-- the instruction is gone...
	jsr	subr2
	addql	#4,sp

Unless your calling sequence is specifically designed to support
"nargs", it can't be relied on.  The "standard" 68000 C calling
sequence (designed by Jack Test at MIT?) doesn't support it -- rightly,
I think.  Part of the reason subroutine calls were so expensive on the
Vax was this kind of unused generality.