From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,f6dda81e7269c676 X-Google-Attributes: gid111c93,public From: Chris Subject: Re: why only 6 params passed in registers? Date: 2000/01/15 Message-ID: <38805845.8DBF5D26@dtn.ntl.com>#1/1 X-Deja-AN: 572929308 Content-Transfer-Encoding: 7bit References: <387EEFA6.3CD3F398@dtn.ntl.com> <85oguv02ivj@news1.newsguy.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@net.ntl.com X-Trace: nclient3-gui.server.dtn.ntl.com 947935434 5784 212.250.68.2 (15 Jan 2000 11:23:54 GMT) Organization: Man Mime-Version: 1.0 NNTP-Posting-Date: 15 Jan 2000 11:23:54 GMT Newsgroups: comp.os.linux.alpha Greg Lindahl wrote: > > Chris writes: > > > You would make the code much more efficient and faster by writing the > > code to put all the args in a structure, then passing a pointer to it. > > Voila, only a single register needed and you only have to add an element > > to the structure, not change the function declaration, if you need to > > add more args later. > > Spoken like a person who doesn't write Fortran. > Correct, thankfully. > > Hint: if that was more efficient, all compilers would use it as their > argument passing convention. > I wouldn't thing so, it's too high level. For example, All the Dec compilers on Vax in the old days used a common calling convention, with the same register usage and stack frame layout. This meant that you could do strange stuff like link object modules using several different source languages (basic, assembler, fortran, C, whatever) and it would all run. Obviously this couldn't work if the calling convention used language specific stuff like structures in C. Vax VMS provided three calling conventions, call by value, call by reference and call by descriptor. The latter was well suited to variable length argument lists (Fortran ?) since at call level, the arguement list has one entry, a pointer to a descriptor which itself contains the length and address of the data. In fact, just another level of indirection. As an analogy, you could think of that descriptor as a structure in C. It's been years since I did any VMS programming and haven't done any Alpha systems programming under VMS, but would suspect that the same techniques are still used on the latest Decpaq compilers under Vax VMS and Tru64 unix. Chris