Run-Time Storage Organization.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Run-Time Storage Organization.ppt

Run-Time Storage Organization 66.648 Compiler Design Lecture (03/23/98) Computer Science Rensselaer Polytechnic Lecture Outline Run-Time Storage Organization Examples Administration Run-Time Storage Organization A program obtains a single contiguous block of storage (virtual memory) from the operating system at the start of program execution. The generated code assumes a subdivision of the storage into different areas/ Code -- this area contains the generated target code for all procedures in the program. The size of this can be determined statically by the compiler/linker. Static Data Static Data-- this area contains global data objects whose size can be determined statically at compile time. Static variables are mapped to offsets in the static data area. Stack Stack--runtime stack of activation records reflecting the stack structure of dynamic procedure calls and returns. An activation record contains the information needed by a single procedure call. Local variables are mapped to offsets in the activation record. Heap Heap -- used to store all other program data (data that is dynamically sized or data with lifetime pattern that cannot be represented in the run-time stack). Heap data allocation incurs more overhead than static or stack data allocation. Languages and Storage Organization Fortran - Static Pascal - Stack/heap C Stack/Heap Activation Record Public class X { public static void main(String argsv[]) { int n; n =10; System.out.println(fib(n)); } int fib(int n) { if (n==0) return 1 else if (n==1) return 1 else return(fib(n-1)+fib(n-2)); }} Compile Time Layout of Local Data Local variables offsets are calculated depending on its size. These offsets can be computed relative to the start of the stack frame, and can be used to specify the layout of local data in the stack frame. Local variables accesses get translated to negative-valued offsets on the stack pointer. Non-Local Variable An access to a lexically scoped nonlocal variable gets translated to le

文档评论(0)

gshshxx + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档