Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!ittvax!sii!mem From: mem@sii.UUCP (Mark Mallett) Newsgroups: net.micro.68k Subject: Re: nargs Message-ID: <363@sii.UUCP> Date: Mon, 26-Dec-83 23:40:44 EST Article-I.D.: sii.363 Posted: Mon Dec 26 23:40:44 1983 Date-Received: Tue, 27-Dec-83 04:16:39 EST Lines: 31 b To the nargs() routine submitted by fortune!shah, I'd suggest recognizing an LEA stack adjustment instruction, i.e., LEA n*4(SP),SP While I know of no 68000 C compilers that generate this sort of fixup, it is the sort of thing that assembler language programmers would think of first (me, anyway); and it seems worth anticipating of future compilers. I'd also like to opine that looking at the instruction after the call instruction to determine the number of arguments is not a 100% accurate way to get the number of arguments passed, for these reasons: - It doesn't take into account different argument types (e.g. doubles). - I can imagine compilers generating stack-fixup instructions in dealing with variables bound to local scopes. Can't you? - The Whitesmith's compiler seems to keep a free location on the top of the stack to deal with calls to routines where only one value is passed. At least this is what it appears to do; I'm easily fooled. This is something that can't be detected by the subroutine, and is an optimization I'd easily expect of compiler writers. But I can't think of any other way to do it. Mark E. Mallett decvax!sii!mem