runtime systems
play

Runtime systems Programmation Fonctionnelle Avance - PowerPoint PPT Presentation

Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Programmation Fonctionnelle Avance http://www-lipn.univ-paris13.fr/~saiu/teaching/PFA-2010 Luca Saiu


  1. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Programmation Fonctionnelle Avancée http://www-lipn.univ-paris13.fr/~saiu/teaching/PFA-2010 Luca Saiu saiu@lipn.univ-paris13.fr Master Informatique 2 ème année, spécialité Programmation et Logiciels Sûrs Laboratoire d’Informatique de l’Université Paris Nord — Institut Galilée 2010-12-08 Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  2. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  3. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  4. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  5. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  6. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  7. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Runtime systems Functional program are very high-level: it’s not obvious how to implement them. Complex library support at run time How do we represent objects in memory? Think about memory words, bits and pointers How do we release memory? The runtime must be written in a low-level language (C, assembly) Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  8. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  9. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  10. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  11. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  12. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  13. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  14. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Think of an efficient implementation Return the given list with 42 prepended, without modifying anything: let f xs = 42 :: xs;; What if we call f with a ten-million-element list? We don’t need to copy anything! We’re just building a very small structure (one cons) which refers the given one We should always pass and return pointers to data structures in memory Fast and simple! but when do we destroy lists...? Anyway we don’t want to allocate in memory small data which fit in registers: avoid allocation whenever possible Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  15. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Binary words Figure: A 32-bit word Modern machines have 32- or 64-bit words. There are assembly instructions working efficiently on word-sized data (arithmetics, load, store) At the hardware level, memory is untyped : a binary word can represent an integer, a boolean, a float, some characters, a pointer 1 , a sum type element with no parameters... 1 Today we ignore internal pointers for simplicity Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

  16. Introduction and hardware architecture reminders Object representation and runtime typing Automatic memory management Binary words Figure: A 32-bit word Modern machines have 32- or 64-bit words. There are assembly instructions working efficiently on word-sized data (arithmetics, load, store) At the hardware level, memory is untyped : a binary word can represent an integer, a boolean, a float, some characters, a pointer 1 , a sum type element with no parameters... 1 Today we ignore internal pointers for simplicity Luca Saiu — saiu@lipn.univ-paris13.fr Runtime systems

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend