清华大学:《编译原理》课程教学资源_(英文译文)Chapter 7.1 Memory Organization During Program Execution

COMPILER CONSTRUCTION Principles and practice Kenneth C. louden
COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden

7. Runtime environments PART ONE
7. Runtime Environments PART ONE

Contents Part One 7.1 Memory Organization during Program Execution 7.2 Fully Static Runtime Environments 7.3 Stack-Based runtime environments Part Two 7.4 Dynamic Memor 7.5 Parameter Passing Mechanisms 7.6 A Runtime Environment for the TINY Language
Contents Part One 7.1 Memory Organization During Program Execution 7.2 Fully Static Runtime Environments 7.3 Stack-Based Runtime Environments Part Two 7.4 Dynamic Memory 7.5 Parameter Passing Mechanisms 7.6 A Runtime Environment for the TINY Language

The precious chapters studied the phases of a compiler that perform static analysis of the source language Scanning, parsing, and static semantic analysis Depends only on the properties of the source language This chapter and the next turn to the task of studying how a compiler generates executable code Additional analysis such as that performed by an optimizer Some of this can be machine independent, but much of the task of code generation is dependent on the details of the target machine
• The precious chapters studied the phases of a compiler that perform static analysis of the source language – Scanning, parsing, and static semantic analysis – Depends only on the properties of the source language • This chapter and the next turn to the task of studying how a compiler generates executable code – Additional analysis, such as that performed by an optimizer – Some of this can be machine independent, but much of the task of code generation is dependent on the details of the target machine

Runtime environment The structure of the target computer's registers and memory that serves to manage memory and maintain the information needed to guide the execution process TThree kinds of runtime environments (1) Fully static environment; FORTRAN77 (2) Stack-Based environment; CC++ (3)Fully dynamic environment; LISP
• Runtime Environment The structure of the target computer’ s registers and memory that serves to manage memory and maintain the information needed to guide the execution process • Three kinds of runtime environments (1) Fully static environment; FORTRAN77 (2) Stack-Based environment; C C++ (3) Fully dynamic environment; LISP

Main issues will be discussed in more detail in the chapter For each environment, the language features and their properties Scoping and allocation issues; 2) Nature of procedure calls, B)Parameter passing mechanisms Focus on the general structure of the environment Note The compiler can only maintain an environment only indirectly It must generate code to perform the necessary maintenance operations during program execution
• Main issues will be discussed in more detail in the chapter: – For each environment, the language features and their properties (1) Scoping and allocation issues; (2) Nature of procedure calls; (3) Parameter passing mechanisms • Focus on the general structure of the environment • Note: – The compiler can only maintain an environment only indirectly – It must generate code to perform the necessary maintenance operations during program execution

7.1 Memory Organization During Program Execution
7.1 Memory Organization During Program Execution

The memory of a typical computer A register area Addressable Random access memory(ram) A code area a data area The code area is fixed prior to execution, and can be visualized as olle LOWS Entry pointer to procedure Code for procedure Entry pointer to procedure2 Code for procedure 2 Entry pointer to procedure n Code for procedure n In particular, the entry point for each procedure and function is known at compile time
The memory of a typical computer: A register area; Addressable Random access memory (RAM): A code area; A data area. The code area is fixed prior to execution, and can be visualized as follows: Entry pointer to procedure1→ Code for procedure 1 Entry pointer to procedure2→ Code for procedure 2 … Entry pointer to procedure n→ Code for procedure n In particular, the entry point for each procedure and function is known at compile time

The global and/or static data of a program can be fixed in memory prior to execution Data are allocated separately in a fixed area in a similar fashion to the code In Fortran 77.all data are in this class In Pascal, global variables are in this class In c. the external and static variables are in this class The constants are usually allocated memory in the global/static area Const declarations of c and pascal Literal values used in the code such as"Hello%Dn"and Integer value 12345 Printf(“Hllo%dn”,12345)
• The global and/or static data of a program can be fixed in memory prior to execution – Data are allocated separately in a fixed area in a similar fashion to the code • In Fortran77, all data are in this class; • In Pascal, global variables are in this class; • In C, the external and static variables are in this class • The constants are usually allocated memory in the global/static area – Const declarations of C and Pascal; – Literal values used in the code, • such as “Hello%D\n ” and Integer value 12345: • Printf(“Hello %d\n ”,12345);

The memory area used for dynamic data can be organized in many different ways Typically, this memory can be divided into a stack area and a heap area a stack area used for data whose allocation occurs in fifo fashion a heap area used for dynamic allocation occurs not in Fifo fashion Generally, the architecture of the target machine includes a processor stack for procedure calls and returns Sometimes, a compiler will have to arrange for the explicit allocation of the processor stack in an appropriate place in memory
• The memory area used for dynamic data can be organized in many different ways – Typically, this memory can be divided into a stack area and a heap area; • A stack area used for data whose allocation occurs in FIFO fashion; • A heap area used for dynamic allocation occurs not in FIFO fashion. • Generally, the architecture of the target machine includes a processor stack for procedure calls and returns. – Sometimes, a compiler will have to arrange for the explicit allocation of the processor stack in an appropriate place in memory
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 1.1 Why? A Brief History.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 4.1 Top-Down Parsing byRecursive-Descent.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 4.1 Top-Down Parsing by Recursive-Descent.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 5.3 SLR(1)Parsing.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 5.1 Overview of Bottom-UpParsing.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8.6 Code Generation in Commercial Compilers:Two Case Studies.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8.1 Intermediate Code and Data.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8 Code Generation.ppt
- 《NFS报文分析》讲义.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)What makes a good manager.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)Ten attributes of a good employee.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:9 Project Procurement Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:8 Project Risk Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:7 Project Communication Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:6 Project HR Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:5 Project Cost Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:4 Project Time Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:3 Project Scope Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:2 Project The Project Management Context and Processes.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:1 Introduction to Project Management.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 7.4 Dynamic Memory.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 6.1 Attributes and AttributeGrammars.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 6.3 The Symbol Table.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 3.1 The Parsing Process.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 2.1 The Scanning Process.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 2.4 From Regular Expression To DFAs.ppt
- 《多媒体技术》课程教学资源(PPT课件讲稿).ppt
- 《JAVA基础实例200题》Java例题(一).pdf
- 《JAVA基础实例200题》Java例题(二).pdf
- 《JAVA基础实例200题》Java例题(三).pdf
- 《JAVA基础实例200题》Java例题(四).pdf
- 《JAVA基础实例200题》Java例题(五).pdf
- 《JAVA基础实例200题》练习题.pdf
- 长江大学:《微型计算机技术及应用课件》第一章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第七章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第三章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第九章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第二章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第五章习题答案(李华贵).doc
- 长江大学:《微型计算机技术及应用课件》第八章习题答案(李华贵).doc