empirical assessment of c like implementations for
play

Empirical Assessment of C ++ -like Implementations for Multiple - PowerPoint PPT Presentation

Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Floral Morandat Roland Ducournau LIRMM The University of Montpellier & CNRS MASPEGHI/ICOOOLPS10, June 2115, 2010, Maribor Slovenia Outline


  1. Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Floréal Morandat ∗ Roland Ducournau LIRMM — The University of Montpellier & CNRS MASPEGHI/ICOOOLPS’10, June 21–15, 2010, Maribor — Slovenia

  2. Outline Introduction 1 Implementation Techniques 2 Execution Testbed 3 Results and Discussion 4 Conclusion and Prospects 5 Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 2

  3. Outline Introduction 1 Implementation Techniques 2 Execution Testbed 3 Results and Discussion 4 Conclusion and Prospects 5 Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 3

  4. Introduction Context & Motivation Compilation of multiple inheritance with static typing : Constant time Reasonable space Compatible with dynamic loading (OWA) Objective Only two implementation techniques satisfy these requirements: C ++ Subobjects (virtual inheritance) Perfect Class Hashing Which is the best one? Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 4

  5. Outline Introduction 1 Implementation Techniques 2 Single Subtyping C ++ Subobjects Perfect Class Hashing Abstract assessment Execution Testbed 3 Results and Discussion 4 Conclusion and Prospects 5 Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 5

  6. Single Subtyping (SST) method table table object layout object Attribute Access load [object + #attributeOffset] -> value ; Read store value -> [object + #attributeOffset] ; Write Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 6

  7. Single Subtyping (SST) method table table attr Offset object layout value object Attribute Access load [object + #attributeOffset] -> value ; Read store value -> [object + #attributeOffset] ; Write Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 6

  8. Single Subtyping (SST) method method table table meth Offset attr Offset object layout value object Method invocation load [object + #tableOffset] -> table load [table + #methodOffset] -> method call method Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 7

  9. Single Subtyping (SST) class id method class Offset method table table meth Offset attr Offset object layout value object Subtype test load [object + #tableOffset], table load [table + #classIdPosition], class cmp #classId, class bne #checkFailed Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 8

  10. Single Subtyping (SST) Advantages Compatible with OWA Optimal time/space for dynamic loading Time: Constant for all mechanism Space: Linear in the specialization relationship size i.e. quadratic in the class number Simple at compile-time Invariants References don’t depend on their static type Positions independent of receiver’s dynamic type Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 9

  11. From SST to MI MI can’t preserve both OWA and SST invariants Preserving SST invariants Coloring [Dixon et al. 1989] Requires CWA at link-time Preserving OWA and position invariant C ++ Subobjects (virtual inheritance) References depend on their static types Overhead: Cubic table size, pointer adjustments, . . . Preserving OWA and reference invariant Perfect Class Hashing Positions depend on the dynamic type Overhead: Hashing + Hashtable Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 10

  12. C ++ Subobjects (SO) object Method invocation load [object + #tableOffset], table load [table + #methOffset + fieldLen], delta2 load [table + #methOffset], method add object, delta2, object2 call method Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 11

  13. C ++ Subobjects (SO) method table table object Method invocation load [object + #tableOffset], table load [table + #methOffset + fieldLen], delta2 load [table + #methOffset], method add object, delta2, object2 call method Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 11

  14. C ++ Subobjects (SO) method delta2 method table table meth Offset object Method invocation load [object + #tableOffset], table load [table + #methOffset + fieldLen], delta2 load [table + #methOffset], method add object, delta2, object2 call method Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 11

  15. C ++ Subobjects (SO) method delta2 method table table meth Offset table2 delta2 object2 object Method invocation load [object + #tableOffset], table load [table + #methOffset + fieldLen], delta2 load [table + #methOffset], method add object, delta2, object2 call method Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 11

  16. C ++ Subobjects (SO) table1 attr Offset value object1 Attribute access load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  17. C ++ Subobjects (SO) method table table object Attribute access load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  18. C ++ Subobjects (SO) delta1 cast Offset method table table object Attribute access load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  19. C ++ Subobjects (SO) delta1 cast Offset method table table table1 delta1 object object1 Attribute access load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  20. C ++ Subobjects (SO) delta1 cast Offset method table table table1 attr Offset delta1 value object object1 Attribute access load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  21. C ++ Subobjects (SO) delta1 cast Offset method table table table1 delta1 object object1 Pointer adjustment load [object + #tableOffset], table load [table + #castOffset], delta1 add object, delta1, object1 load [object1 + #attrOffset], value Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 12

  22. Perfect Class Hashing (PH) Object Preamble load [object + #tableOffset], table load [table + #hashingOffset], h and #classId, h, hv sub table, hv, htable Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 13

  23. Perfect Class Hashing (PH) method table table Object Preamble load [object + #tableOffset], table load [table + #hashingOffset], h and #classId, h, hv sub table, hv, htable Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 13

  24. Perfect Class Hashing (PH) h method table table Object Preamble load [object + #tableOffset], table load [table + #hashingOffset], h and #classId, h, hv sub table, hv, htable Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 13

  25. Perfect Class Hashing (PH) h hashtable method table hv table Object Preamble load [object + #tableOffset], table load [table + #hashingOffset], h and #classId, h, hv sub table, hv, htable Empirical Assessment of C ++ -like Implementations for Multiple Inheritance Introduction Implementation Techniques Testbed Results Conclusion 13

Recommend


More recommend