Presentation is loading. Please wait.

Presentation is loading. Please wait.

Multiple Ownership Nicholas Cameron Sophia Drossopoulou James Noble Matthew Smith.

Similar presentations


Presentation on theme: "Multiple Ownership Nicholas Cameron Sophia Drossopoulou James Noble Matthew Smith."— Presentation transcript:

1 Multiple Ownership Nicholas Cameron Sophia Drossopoulou James Noble Matthew Smith

2 ncameron@doc.ic.ac.uk2 Background – Ownership Types Multiple Ownership Objects in Boxes Variance - ? MOJO Effects

3 ncameron@doc.ic.ac.uk3 Background

4 ncameron@doc.ic.ac.uk4 Ownership Types The heap is messy:

5 ncameron@doc.ic.ac.uk5 Ownership Types Organise it:

6 ncameron@doc.ic.ac.uk6 Ownership Types Give each object an owner:

7 ncameron@doc.ic.ac.uk7 Ownership Types class Project { Task t1; Task t2; List clients; }

8 ncameron@doc.ic.ac.uk8 Our Work

9 ncameron@doc.ic.ac.uk9 The Objects In Boxes Model

10 ncameron@doc.ic.ac.uk10 A Box is a Set of Objects

11 ncameron@doc.ic.ac.uk11 Objects in Boxes Single owner interpretation: An object is in its owner’s box

12 ncameron@doc.ic.ac.uk12 Programs are not Trees

13 ncameron@doc.ic.ac.uk13 One Owner is not Enough 75% of ownership structures require multiple ownership [34] Mitchell, ECOOP, ’06 Trees can not describe non-hierarchical structures

14 ncameron@doc.ic.ac.uk14 Objects in Boxes Multiple Ownership: objects may be in more than one box An object with multiple owners is in the intersection of their boxes:

15 ncameron@doc.ic.ac.uk15 Objects in Boxes

16 ncameron@doc.ic.ac.uk16 A Descriptive System Describes the heap Does not restrict references etc.

17 ncameron@doc.ic.ac.uk17 MOJO

18 ncameron@doc.ic.ac.uk18 MOJO Class declarations have the usual, formal ownership parameters: class C …

19 ncameron@doc.ic.ac.uk19 MOJO Class declarations have the usual, formal ownership parameters: class C … Types may have multiple corresponding actual owner parameters: C

20 ncameron@doc.ic.ac.uk20 MOJO Class declarations have the usual, formal ownership parameters: class C … Types may have multiple corresponding actual owner parameters: C

21 ncameron@doc.ic.ac.uk21 MOJO Class declarations have the usual, formal ownership parameters: class C … Types may have multiple corresponding actual owner parameters: C

22 ncameron@doc.ic.ac.uk22 MOJO class Connection { … } class Client { Connection c; } class Server { Connection c; }

23 ncameron@doc.ic.ac.uk23 Variance

24 ncameron@doc.ic.ac.uk24 Variance Connection Some owner

25 ncameron@doc.ic.ac.uk25 Variance Connection Some box May be the intersection of several boxes Variance in the number of owners

26 ncameron@doc.ic.ac.uk26 Subtyping Subtyping with wildcards is variant with respect to owners: C

27 ncameron@doc.ic.ac.uk27 Subtyping Subtyping with wildcards is variant with respect to owners: C

28 ncameron@doc.ic.ac.uk28 Subtyping Subtyping with wildcards is variant with respect to owners: C

29 ncameron@doc.ic.ac.uk29 Subtyping Subtyping with wildcards is variant with respect to owners: C

30 ncameron@doc.ic.ac.uk30 Constraints class C a intersects b, b disjoint c { … }

31 ncameron@doc.ic.ac.uk31 Constraints class D a intersects b { D } class E a disjoint b { }

32 ncameron@doc.ic.ac.uk32 Constraints class D a intersects b { D } class E a disjoint b { D  }

33 ncameron@doc.ic.ac.uk33 Constraints class D a intersects b { D Object } class E a disjoint b { D  }

34 ncameron@doc.ic.ac.uk34 Typing - strict Strict method sends and assignments to deal with variance of owners: class C { C f; } C ca; C c1; C c2; ca.f = ca;

35 ncameron@doc.ic.ac.uk35 Typing - strict Strict method sends and assignments to deal with variance of owners: class C { C f; } C ca; C c1; C c2; ca.f = ca; c1.f = c2; 

36 ncameron@doc.ic.ac.uk36 Typing - strict

37 ncameron@doc.ic.ac.uk37 Effects

38 ncameron@doc.ic.ac.uk38 Effects

39 ncameron@doc.ic.ac.uk39 Effects Task t1; Task t2; … t1.f; // reads x / writes ε

40 ncameron@doc.ic.ac.uk40 Effects Task t1; Task t2; … t1.f; // reads x / writes ε t1.f = t2.f; // reads x,y / writes x

41 ncameron@doc.ic.ac.uk41 Effects with Multiple Owners Task t1; Task t2; … t1.f; // reads x & ? / writes ε

42 ncameron@doc.ic.ac.uk42 Effects with Multiple Owners Task t1; Task t2; … t1.f; // reads x & ? / writes ε t1.f = t2.f; // reads x & ?,y & z/ writes x & ?

43 ncameron@doc.ic.ac.uk43 Effects with Multiple Owners t1.f = t2.f; // reads x & ?,y & z/ writes x & ?

44 ncameron@doc.ic.ac.uk44 Disjointness Two expressions are disjoint if their effects do not overlap Complicated by ? – but & = intersection

45 ncameron@doc.ic.ac.uk45 Future Work

46 ncameron@doc.ic.ac.uk46 Future Work Explore variant owners using existential types class TaskList { Task datum; TaskList next; }

47 ncameron@doc.ic.ac.uk47 Future Work Reference and modification control

48 ncameron@doc.ic.ac.uk48 Future Work Constraints Topology - inside Unary - may read, may write Binary – may point to, may modify

49 ncameron@doc.ic.ac.uk49 Summary Ownership Types Multiple Ownership Objects in Boxes Variance MOJO Effects Thank you! Any questions?


Download ppt "Multiple Ownership Nicholas Cameron Sophia Drossopoulou James Noble Matthew Smith."

Similar presentations


Ads by Google