Chapter 10 Storage Management Implementation details beyond programmer’s control Storage/CPU time trade-off Binding times to storage.

Slides:



Advertisements
Similar presentations
Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Advertisements

Part IV: Memory Management
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
1 Programming Languages Storage Management Cao Hoaøng Truï Khoa Coâng Ngheä Thoâng Tin Ñaïi Hoïc Baùch Khoa TP. HCM.
Chapter 10 Implementing Subprograms. Copyright © 2012 Addison- Wesley. All rights reserved. 1-2 Chapter 10 Topics The General Semantics of Calls and Returns.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Chapter 9 Subprogram Control Consider program as a tree- –Each parent calls (transfers control to) child –Parent resumes when child completes –Copy rule.
Variables Names Bindings Type Scope. L-Value versus R-Value Not complicated Associated with assignment statements Left hand side represents an address.
Code Shape IV Procedure Calls & Dispatch Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412.
Chapter 10 Storage management
ISBN Chapter 10 Implementing Subprograms.
G. Levine Chapter 6 Chapter 6 Encapsulation –Why do we want encapsulation? Programmer friendliness- programmer need not know about these details –Easier.
Run-Time Storage Organization
Run time vs. Compile time
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Chapter 9: Subprogram Control
ISBN Chapter 10 Implementing Subprograms –Semantics of Calls and Returns –Implementing “Simple” Subprograms –Implementing Subprograms with.
1 CSCI 360 Survey Of Programming Languages 9 – Implementing Subprograms Spring, 2008 Doug L Hoffman, PhD.
1 Contents. 2 Run-Time Storage Organization 3 Static Allocation In many early languages, notably assembly and FORTRAN, all storage allocation is static.
COP4020 Programming Languages
Chapter 7: Runtime Environment –Run time memory organization. We need to use memory to store: –code –static data (global variables) –dynamic data objects.
Storage Management Lecture 12: Dolores Zage.
Name Binding and Object Lifetimes Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture.
ISBN Chapter 10 Implementing Subprograms.
CS3012: Formal Languages and Compilers The Runtime Environment After the analysis phases are complete, the compiler must generate executable code. The.
CS 403: Programming Languages Lecture 2 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
1 Binding Time and Storage Allocation (Section ) CSCI 431 Programming Languages Fall 2003 A modification of slides developed by Felix Hernandez-Campos.
Runtime Environments Compiler Construction Chapter 7.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
1 Names, Scopes and Bindings Aaron Bloomfield CS 415 Fall
Chapter 10 Implementing Subprograms. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 10 Topics The General Semantics of Calls and Returns.
Chapter 5: Programming Languages and Constructs by Ravi Sethi Activation Records Dolores Zage.
Chapter 7 Runtime Environments. Relationships between names and data objects As execution proceeds, the same name can denote different data objects Procedures,
Basic Semantics Associating meaning with language entities.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 9.
ISBN Chapter 10 Implementing Subprograms.
COMP3190: Principle of Programming Languages
Programming Languages and Design Lecture 6 Names, Scopes and Binding Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
RUNTIME ENVIRONMENT AND VARIABLE BINDINGS How to manage local variables.
Chapter 10 Implementing Subprograms. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 10 Topics The General Semantics of Calls and Returns.
10-1 Chapter 10: Implementing Subprograms The General Semantics of Calls and Returns Implementing “Simple” Subprograms Implementing Subprograms with Stack-Dynamic.
Implementing Subprograms
LECTURE 13 Names, Scopes, and Bindings: Memory Management Schemes.
Subprograms - implementation. Calling a subprogram  transferring control to a subprogram: save conditions in calling program pass parameters allocate.
ISBN Chapter 10 Implementing Subprograms.
CHAPTER 8. MEMORY MANAGEMENT SUNG-DONG KIM DEPT. OF COMPUTER ENGINEERING, HANSUNG UNIVERSITY.
CHAPTER 4 VARIABLES & BINDING SUNG-DONG KIM DEPT. OF COMPUTER ENGINEERING, HANSUNG UNIVERSITY.
Runtime Environments Chapter 7. Support of Execution  Activation Tree  Control Stack  Scope  Binding of Names –Data object (values in storage) –Environment.
Code Generation Instruction Selection Higher level instruction -> Low level instruction Register Allocation Which register to assign to hold which items?
Implementing Subprograms
Storage Allocation Mechanisms
Data Types In Text: Chapter 6.
Chapter 8. Memory Management
Implementing Subprograms
CS 326 Programming Languages, Concepts and Implementation
CS 326 Programming Languages, Concepts and Implementation
Implementing Subprograms
Implementing Subprograms
Code Shape IV Procedure Calls & Dispatch
Binding Times Binding is an association between two things Examples:
Programming Languages
Name Binding and Object Lifetimes
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Garbage collection Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Run-time environments
Implementing Subprograms
Presentation transcript:

Chapter 10 Storage Management Implementation details beyond programmer’s control Storage/CPU time trade-off Binding times to storage

Storage needed for code Code –User programs –Library routines –Storage mgt routines Static/automatic/heap allocation Garbage collection, storage compaction –Loaders, interpreters, etc.

Storage needed for data objects programmer variables, constants Temps for expression evaluation, functions return, parameters Other activation record objects –Static and/or dynamic reference environment –Return point from subprogram call Input/output buffers Garbage collection bits, ptrs Tables for named heap objects (Snobol4’s Central String’s Table)

Routines that call for storage mgt Subroutine entry, return –Prolog, epilog Heap object/ class object creation, destruction Expression evaluation Parameter passing (specifically if expression is a parameter)

Programmer control issues Free facility (danger of dangling references) versus garbage collection overhead + delay in knowing when object has lost external path –Compare to virtual memory Efficient allocation of storage in blocks (C) rather than according to logical need –Reuse of freed storage an issue – compaction problems

Static storage management No run-time storage mgt Efficiency of compiler generating location for data object as offset from code section –No table or lists needed No overlays of storage Problem – we have a large tax table that we want to hide within a routine that computes taxes –Where is it defined? No recursion

Stack (automatic) storage management Efficient storage mgt – stack ptr Recursion is possible Overlays are system controlled Compiler generates location (l-value) as offset from start of activation record Scope rules (Text left this out by error)

Heap storage mgt Allocation from free list typically organized as linked list –Programmer call or creation of object Deallocation –Programmer call or garbage collection –Is freed object placed at top of list or ordered by size? Compaction for freed objects of different sizes –LISP list components are all the same size Reuse –For fixed size elements, free storage is fungible –For variable size elements, do we allocate from best fit, first (random) fit