home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / msdos / programm / 11383 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.3 KB  |  32 lines

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