home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!destroyer!cs.ubc.ca!newsserver.sfu.ca!sfu.ca!gay
- From: gay@selkirk.sfu.ca (Ian D. Gay)
- Subject: Re: Calling convention: C vs PASCAL
- Message-ID: <gay.724356941@sfu.ca>
- Sender: news@sfu.ca
- Organization: Simon Fraser University, Burnaby, B.C., Canada
- References: <1992Dec11.225015.26304@eng.ufl.edu> <dmurdoch.225.724125846@mast.queensu.ca> <1992Dec14.124529@cs.utwente.nl> <dmurdoch.231.724340705@mast.queensu.ca>
- Date: Mon, 14 Dec 1992 18:15:41 GMT
- Lines: 20
-
- dmurdoch@mast.queensu.ca (Duncan Murdoch) writes:
-
- >>Waht difference does this make for execution time? The cleanup code has to be
- >>executed for every invocation, whether it is included with the callers or the
- >>called code. Of course it does make difference for the code size.
-
- >A Pascal routine with 20 bytes of parameters can return and clean up with
- >the single instruction:
-
- > retf 20
-
- >On all 80x86 cpus, this takes the same time (plus or minus a cycle) as the
- >plain retf. The advantage comes because that's all that's needed; a return
- >from a C convention routine must be followed by manual adjustment of
- >the stack pointer.
-
- e.g. sub sp, 20 ... which takes 2 cycles on a 386. You will have
- to have a very short called routine before you can see any difference.
-
- >Duncan Murdoch
-