Memory management for closures

Inactive Publication Date: 2009-12-10
APPLE INC
View PDF7 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Benefits of technology

[0009]Another aspect of this description relates to defenses against viruses and other malicious code. In order to prevent viruses and other malicious code from harming a computation it is necessary to not allow writeable data to be used as executable instructions. There is a common need and use of compiler generated thunks to recover or initialize extra data before calling specific functions. A thunk as used herein broadly refers to a piece of code to perform some delayed computation. This allows the functions to appear to take fewer arguments than are necessary yet be supplied with the correct and complete amount of data. The prior art often requires that each such thunk be allocated on its own page of memory such that it can start with writeable permission, be written upon with instructions to recover specific data, and then having the page marked as not writeable and executable, and depending on the architecture of the processor, the processor's instruction cache is flushed; these operations in the prior art are computationally expensive. Since each thunk requires a page of memory, these thunks need to be tracked and deallocated in many implementations. Uses of such thunks include “inner functions” in GCC and certain implementations of closures. At least certain embodiments of the invention provide an efficient way to use thunks by allocating paired chunks of memory and on one chunk of the pair write a series of small thunks that dereference a data area counterpart on the other chunk in the pair. Once written, the memory is protected as execute only and each thunk-data pair in the series is separately allocated and restored. Each thunk-data pair is provided as part of a thunk allocation which also takes the extra data that needs to be recovered. The extra data is stored in the appropriate location in the writeable chunk of memory. The instructions that are written vary according to the needs of the compiler or client and can be as simple as pushing the extra data as an extra stack argument.

Problems solved by technology

The prior art often requires that each such thunk be allocated on its own page of memory such that it can start with writeable permission, be written upon with instructions to recover specific data, and then having the page marked as not writeable and executable, and depending on the architecture of the processor, the processor's instruction cache is flushed; these operations in the prior art are computationally expensive.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Memory management for closures
  • Memory management for closures
  • Memory management for closures

Examples

Experimental program
Comparison scheme
Effect test

Example

[0021]Various embodiments and aspects of the inventions will be described with reference to details discussed below, and the accompanying drawings will illustrate the various embodiments. The following description and drawings are illustrative of the invention and are not to be construed as limiting the invention. Numerous specific details are described to provide a thorough understanding of various embodiments of the present invention. However, in certain instances, well-known or conventional details are not described in order to provide a concise discussion of embodiments of the present inventions.

[0022]Reference in the specification to one embodiment or an embodiment means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. The appearance of the phrase “in one embodiment” in various places in the specification do not necessarily refer to the same embodiment.

[0023]Examples of metho

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

Methods, software media, compilers and programming techniques are described for binding data to a function using thunk synthesis. In one exemplary method, a computing system executes a program having a function with a first set of arguments. In response to the function being called, a function pointer of the function is synthesized to recover an extra argument for the function in addition to the first set of arguments.

Description

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Owner APPLE INC
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products