Escape analysis

Escape analysis

In programming language compiler optimization theory, escape analysis is a method for determining the dynamic scope of pointers. It is related to pointer analysis and shape analysis.

When a variable (or an object) is allocated in a subroutine, a pointer to the variable can "escape" to other threads of execution, or to calling subroutines. If a subroutine allocates an object and returns a pointer to it, the object can be accessed from undetermined places in the program — the pointer has "escaped". Pointers can also escape if they are stored in global variables or other data structures that, in turn, escape the current procedure.

Escape analysis determines all the places where a pointer can be stored and whether the lifetime of the pointer can be proven to be restricted only to the current procedure and/or thread.

Optimizations

A compiler can use the results of escape analysis as basis for optimizations:

* "Converting heap allocations to stack allocations". If an object is allocated in a subroutine, and a pointer to the object never escapes, the object may be a candidate for stack allocation instead of heap allocation.

* "Synchronization elision". If an object is found to be accessible from one thread only, operations on the object can be performed without synchronization.

* "Breaking up objects" or "scalar replacement". An object may be found to be accessed in ways that do not require the object to exist as a sequential memory structure. This may allow parts (or all) of the object to be stored in CPU registers instead of in memory.

Practical considerations

In object-oriented programming languages dynamic compilers are particularly good candidates for performing escape analysis. In traditional static compilation method overriding can make escape analysis impossible, as any called method might be overridden by a version that allows a pointer to escape. Dynamic compilers can perform escape analysis using the available information on overloading, and re-do the analysis when relevant methods are overridden by dynamic code loading.

Escape analysis has been a target of interest in particular due to the Java programming language. Java's combination of heap-only object allocation, built-in threading, and the Sun HotSpot dynamic compiler creates a candidate platform for escape analysis related optimizations (see Escape analysis in Java). Escape analysis is implemented in Java Standard Edition 6.

ee also

* Alias analysis
* Pointer analysis
* Shape analysis (software)


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Escape from Reason — is a philosophical work written by American theologian and Christian apologist Francis A. Schaeffer, London: InterVarsity Press, first published in 1968. It is Book Two in Volume One of The Complete Works of Francis A. Schaeffer A Christian… …   Wikipedia

  • Pointer analysis — In computer science pointer analysis, or points to analysis, is a static code analysis technique that establishes which pointers, or heap references, can point to which variables or storage locations. It is often a component of more complex… …   Wikipedia

  • Alias analysis — is a technique in compiler theory, used to determine if a storage location may be accessed in more than one way. Two pointers are said to be aliased if they point to the same location. Alias analysis techniques are usually classified by flow… …   Wikipedia

  • Shape analysis (software) — Shape analysis is a static code analysis technique that discovers and verifies properties of linked, dynamically allocated data structures in (usually imperative) computer programs. It is typically used at compile time to find software bugs or to …   Wikipedia

  • surface analysis — ▪ chemistry Introduction       in analytical chemistry (chemistry), the study of that part of a solid that is in contact with a gas or a vacuum. When two phases of matter are in contact, they form an interface. The term surface is usually… …   Universalium

  • Applied behavior analysis — (ABA) is the science of applying experimentally derived principles of behavior to improve socially significant behavior. ABA takes what we know about behavior and uses it to bring about positive change (Applied). Behaviors are defined in… …   Wikipedia

  • Behavior analysis of child development — Child development in behavior analytic theory has origins in John B. Watson s behaviorism.[1] Watson wrote extensively on child development and conducted research (see Little Albert experiment). Watson was instrumental in the modification of… …   Wikipedia

  • Narrow escape problem — The narrow escape problem is an ubiquitous problem in biology, biophysics and cellular biology. The formulation is the following: a Brownian particle (ion, molecule, or protein) is confined to a bounded domain (a compartment or a cell) by a… …   Wikipedia

  • Intelligence analysis — This article deals with the intellectual process of analysis itself, as opposed to intelligence analysis management, which, in turn, is a subcomponent of intelligence cycle management. For a complete hierarchical list of articles in this series,… …   Wikipedia

  • Professional practice of behavior analysis — The professional practice of behavior analysis is the fourth domain of behavior analysis. The other three are behaviorism, experimental analysis of behavior, and applied behavior analysis. [Cooper, et al. p. 20] The professional practice of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”