next up previous
Next: About this document Up: Procedures Previous: Stack Frame

Summary

The use of procedures in MAL is summarized below:

In assembly language, procedures have both advantages and disadvantages. The advantages of procedures are:

  1. Procedures facilitate modular code and make code easier to develop and understand in high-level languages.
  2. The high-level language compiler writes the assembly language code to implement procedures.
  3. Procedures allow code to be reused, resulting in shorter programs.

The main disadvantage of procedures is that code written using procedures will run more slowly than code without procedures because:

  1. Additional instructions and memory accesses are required to:
    • call the procedures,
    • pass parameters,
    • save and restore registers.
  2. Jump instructions disrupt the flow of instructions through the CPU, forcing the CPU to wait until new instructions beginning at the jump address can be fetched (see Pipelining).


next up previous
Next: About this document Up: Procedures Previous: Stack Frame

CS301 Class Account
Mon Nov 25 11:40:41 AST 1996