Article View: comp.lang.modula2
Article #1550Re: Structure parameter passing
From: Ian W Moor
Date: Mon, 12 Oct 1992 17:48
Date: Mon, 12 Oct 1992 17:48
25 lines
1896 bytes
1896 bytes
In article <5430@balrog.ctron.com>, smith@ctron.com (Larry Smith) writes: |> The correct way |> to implement this semantic is to always pass aggregate types as pointers and |> to emit code at the begining of each routine to branch to the end, where |> the compiler will be after noticing what parameters that were modified during |> the compilation. These parameters can be copied onto the stack and the |> argument pointer adjusted, and the routine started with a backwards jump to |> the real begining of the routine. This allows one-pass compilation, removes |> the necessity for aggregate copies where such copies are not needed to enforce |> standard semantics. |> Please don't do this! If you really object to keeping a representation of the current procedure in memory so the code generator can generate the proper code, do some back-patching, put the code in to copy the parameter and have the compiler write NOPs over if is the parameter is unchanged. I'd rather the compiler was slightly slower than have my cache/pipeline emptied by jumping about whenever I call a procedure. -- Ian W. Moor +71 589 5111 x 5039 iwm@doc.ic.ac.uk Department of Computing, Imperial College. "Experts from BNFL have advised the Russians to rename Chernobyl as Sellograd and open a tourist centre"
Technical Details
Message-ID:
<1bcdpiINNnf4@swan.doc.ic.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!think.com!ames!agate!doc.ic.ac.uk!iwmReferences:
<1992Oct01.203420.3612@bnr.ca> <1992Oct5.084755.8205@lhn.gns.cri.nz> <5430@balrog.ctron.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!think.com!ames!agate!doc.ic.ac.uk!iwm From: iwm@doc.ic.ac.uk (Ian W Moor) Newsgroups: comp.lang.modula2 Subject: Re: Structure parameter passing Followup-To: comp.compilers Date: 12 Oct 1992 18:48:34 +0100 Organization: Department of Computing, Imperial College, University of London, UK. Lines: 25 Distribution: world Message-ID: <1bcdpiINNnf4@swan.doc.ic.ac.uk> References: <1992Oct01.203420.3612@bnr.ca> <1992Oct5.084755.8205@lhn.gns.cri.nz> <5430@balrog.ctron.com> NNTP-Posting-Host: swan.doc.ic.ac.uk