From mboxrd@z Thu Jan 1 00:00:00 1970 From: dot@dotat.at (Tony Finch) Date: Mon, 4 Jan 2016 11:35:44 +0000 Subject: [TUHS] Early Unix function calls: expensive? In-Reply-To: References: <20160103233543.GA10102@minnie.tuhs.org> Message-ID: scj at yaccman.com wrote: > > As part of the PCC work, I wrote a technical report on how to design a C > calling sequence, but that was before the VAX. Early calling sequences > had both a stack pointer and a frame pointer, but for most machines it > was possible to get by with just one, so calling sequences got better as > time went on. Also, RISC machines with many more registers than the > PDP-11 also led to more efficient calls by putting some arguments in > registers. Later standardizations like varargs were painful on some > architectures (especially those which had different registers for pointers > and integers). I had a look for your technical report online but my searches failed me. Do you have a link to a copy? Doesn't alloca() get interesting if you have a stack pointer but no frame pointer? :-) http://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/libc/sys/alloca.s Nowadays it's usually implemented as a builtin, and given that the compiler ought to be able to cope in most cases, but if you alloca() a variable amount things soon get too difficult... Tony. -- f.anthony.n.finch http://dotat.at/ Northeast Viking, North Utsire: Southeasterly 5 to 7, occasionally gale 8 in south. Rough or very rough, occasionally moderate later. Fair. Good.