Concepts of Programming Languages

(Sean Pound) #1
Programming Exercises 471


  1. If a compiler uses the static chain approach to implementing blocks,
    which of the entries in the activation records for subprograms are needed
    in the activation records for blocks?

  2. Examine the subprogram call instructions of three different architec-
    tures, including at least one CISC machine and one RISC machine,
    and write a short comparison of their capabilities. (The design of these
    instructions usually determines at least part of the compiler writer’s
    design of subprogram linkage.)


PROGRAMMING EXERCISES



  1. Write a program that includes two subprograms, one that takes a single
    parameter and performs some simple operation on that parameter and
    one that takes 20 parameters and uses all of the parameters, but only for
    one simple operation. The main program must call these two subpro-
    grams a large number of times. Include in the program timing code to
    output the run time of the calls to each of the two subprograms. Run
    the program on a RISC machine and on a CISC machine and compare
    the ratios of the time required by the two subprograms. Based on the
    results, what can you say about the speed of parameter passing on the
    two machines?

Free download pdf