hila
Uploaded by
12 SLIDES
245 VUES
120LIKES

Monadic Regions: A Unified Approach to Region-Based Memory Management and Effect Encapsulation

DESCRIPTION

This paper introduces a monadic framework for region-based memory management, synthesizing two research lines: region-based memory management and monadic encapsulation of effects. By defining regions that specify object lifetimes and embedding imperative features into pure languages, we propose a new system that enhances the control and safety of memory allocation. The framework allows for the creation and manipulation of region-allocated values, encapsulating computations within a monadic context for better resource management. The compatibility with System F demonstrates its wide applicability and relevance.

1 / 12

Télécharger la présentation

Monadic Regions: A Unified Approach to Region-Based Memory Management and Effect Encapsulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Monadic Regions Matthew Fluet Cornell University

  2. Introduction • Draw together two lines of research • Region-based memory management • Regions delimit lifetimes of objects • new .e • Monadic encapsulation of effects • Embed imperative features in pure languages • runST :: .(s. RGN s )  

  3. FRGN = System F + RGN monad • System F • Monadic (sub)-language • Monadic types and operations • RGN r – monadic region computations • RGNVar r – region allocated values • RGNHandle r – region handles

  4. FRGN = System F + RGN monad • Create and read region allocated values allocRGNVar :: ,r.   RGNHandle r  RGN r (RGNVar r ) readRGNVar :: ,r. RGNVar r   RGN r 

  5. FRGN = System F + RGN monad • Encapsulate and run a monadic computation runRGN :: .(r. RGNHandle r  RGN r )  

  6. FRGN = System F + RGN monad • Encapsulate a region newRGN :: ,r.(s. RGNHandle s  RGN s )  RGN r α

  7. FRGN = System F + RGN monad • Encapsulate a region newRGN :: ,r.(s. r  s  RGNHandle s  RGN s )  RGN r α  ≡ ,r,s. RGN r   RGN s 

  8. Single Effect Calculus • LIFO stack of regions imposes a partial order on live (allocated) regions • Regions lower on the stack outlive regions higher on the stack • A single region can serve as a witness for a set of effects • Region appears as a single effect in place of the set

  9. Translation • Type-preserving translation from Single Effect Calculus to FRGN new .e newRGN (.w.h. e)

  10. Conclusion • Monadic encoding of effects applicable to region calculi • Trivial (syntactic) equality on types • Encapsulation within monad

  11. FRGN = System F + RGN monad • Monadic unit and bind returnRGN :: ,r.   RGN r  thenRGN :: ,,r. RGN r  ( RGN r )  RGN r 

More Related
SlideServe
Audio
Live Player
Audio Wave
Play slide audio to activate visualizer