Download presentation
Presentation is loading. Please wait.
Published byScott Stewart Modified over 9 years ago
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 MOJO Variance - ? Effects and Disjointness
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 But, Programs are not Trees “We’re tired of trees… We should stop believing in trees, roots, radicles” Deleuze and Guattari, A Thousand Plateaus
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 We Propose: Objects in Multiple 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 Multiple Boxes
16
ncameron@doc.ic.ac.uk16 MOJO
17
ncameron@doc.ic.ac.uk17 A Descriptive System Describes the heap Does not restrict references etc.
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 But: C
30
ncameron@doc.ic.ac.uk30 Strict typing – field assignment Strict method sends and assignments to deal with variance of owners: class D { D f; } D da; D d1; D d2; da.f = da;
31
ncameron@doc.ic.ac.uk31 Strict typing – field assignment Strict method sends and assignments to deal with variance of owners: class D { D f; } D da; D d1; D d2; da.f = da; d1.f = d2;
32
ncameron@doc.ic.ac.uk32 Strict typing – field assignment Strict method sends and assignments to deal with variance of owners: class D { D f; } D da; D d1; D d2; D db; D dc; d1 = db; d2 = dc; da.f = da; d1.f = d2;
33
ncameron@doc.ic.ac.uk33 Strict typing – field assignment
34
ncameron@doc.ic.ac.uk34 Constraints intersects disjoint
35
ncameron@doc.ic.ac.uk35 Constraints class C a intersects b, b disjoint c { … }
36
ncameron@doc.ic.ac.uk36 Constraints class D a intersects b { D } class E a disjoint b { }
37
ncameron@doc.ic.ac.uk37 Constraints class D a intersects b { D } class E a disjoint b { D }
38
ncameron@doc.ic.ac.uk38 Constraints class D a intersects b { D Object } class E a disjoint b { D }
39
ncameron@doc.ic.ac.uk39 Effects
40
ncameron@doc.ic.ac.uk40 Effects
41
ncameron@doc.ic.ac.uk41 Effects Task t1; Task t2; … t1.f; // reads x / writes ε
42
ncameron@doc.ic.ac.uk42 Effects Task t1; Task t2; … t1.f; // reads x / writes ε t1.f = t2.f; // reads x,y / writes x
43
ncameron@doc.ic.ac.uk43 Effects with Multiple Owners Task t1; Task t2; … t1.f; // reads x & ? / writes ε
44
ncameron@doc.ic.ac.uk44 Effects with Multiple Owners Task t1; Task t2; … t1.f; // reads x & ? / writes ε t1.f = t2.f; // reads x & ?,y & z / writes x & ?
45
ncameron@doc.ic.ac.uk45 Effects with Multiple Owners t1.f = t2.f; // reads x & ?,y & z/ writes x & ?
46
ncameron@doc.ic.ac.uk46 Disjointness Two expressions are disjoint if their effects do not overlap Complicated by ? – but & = intersection
47
ncameron@doc.ic.ac.uk47 Disjointness cl1 disjoint cl2 Connection c1; Connection c2;
48
ncameron@doc.ic.ac.uk48 Disjointness cl1 disjoint cl2 Connection c1; Connection c2; cl.drop(); //rd cl1 & ? / wr cl1 & ? c2.send(…); //rd cl2 & ? / wr cl2 & ?
49
ncameron@doc.ic.ac.uk49 Disjointness cl1 disjoint cl2 Connection c1; Connection c2; cl.drop(); //rd cl1 & ? / wr cl1 & ? c2.send(…); //rd cl2 & ? / wr cl2 & ? cl1 & ? # cl2 & ?
50
ncameron@doc.ic.ac.uk50 Disjointness cl1 disjoint cl2 Connection c1; Connection c2; cl.drop(); //rd cl1 & ? / wr cl1 & ? c2.send(…); //rd cl2 & ? / wr cl2 & ? cl1 & ? # cl2 & ? c2.send() does not affect c1.drop()
51
ncameron@doc.ic.ac.uk51 Future Work
52
ncameron@doc.ic.ac.uk52 Future Work Explore variant owners using existential types class TaskList { Task datum; TaskList next; }
53
ncameron@doc.ic.ac.uk53 Future Work Reference and modification control
54
ncameron@doc.ic.ac.uk54 Future Work Constraints Topology - inside Unary - may read, may write Binary – may point to, may modify
55
ncameron@doc.ic.ac.uk55 Summary Multiple Owners Objects in Boxes Variance Formalism - MOJO Effects Disjointness Thank you! Any questions? “structures like the city, which do require overlapping sets within them, are nevertheless persistently conceived as trees” Christopher Alexander, A City is not a Tree
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.