1 Object contexts:
2
3 Object Context
4 ------ -------
5 function overridable
6 method defining/originating class
7 class null
8 instance self
9 module null
10
11 Assignment types:
12
13 Assignment of stored value to... Effect on context
14 -------------------------------- -----------------
15 local preserved
16 global (module) preserved
17 class overridden (if overridable)
18 instance preserved
19
20 Assignment to a namespace preserves the context except for some class
21 assignments
22
23 Assigning to classes:
24
25 Assignment of... Effect on context
26 ---------------- -----------------
27 function (overridable context) overridden by class (becomes method)
28 method (existing context) preserved
29 class (null context) preserved
30 instance (self context) preserved
31 module (null context) preserved
32
33 With run-time restrictions on assignment targets:
34
35 Assignment of stored value to... Effect on context Optimised instruction Unoptimised instruction
36 -------------------------------- ----------------- --------------------- -----------------------
37 local preserved StoreName
38 global (module) preserved StoreAddress StoreAttrIndex
39 instance preserved StoreAttr StoreAttrIndex
40
41 Class assignments are not permitted
42
43 Access types:
44
45 Access to stored value from... Effect on context Optimised instruction Unoptimised instruction
46 ------------------------------ ----------------- --------------------- -----------------------
47 local preserved LoadName
48 global (module) preserved LoadAddress LoadAttrIndex
49 class preserved LoadAddress LoadAttrIndex
50 class via instance overridden LoadAddressContext(Cond) LoadAttrIndexContext(Cond)
51 instance preserved LoadAttr LoadAttrIndex
52
53 Access to a namespace may not preserve the stored context
54
55 Access to class attributes via instances:
56
57 Access to stored value with... Effect on context
58 ------------------------------ -----------------
59 compatible class as context overridden
60 incompatible class as context preserved
61 null context preserved
62 other context (instance) preserved
63
64 Optimisation possibilities for class attribute access via instances:
65
66 Class Class attribute Context of attribute Instruction
67 ----- --------------- -------------------- -----------
68 known constant preserved LoadAddress
69 known constant overridden LoadAddressContext
70 known not constant preserved LoadAddress (attribute may always be preserved)
71 known not constant overridden LoadAddressContext (attribute may always be overridden)
72 known not constant not known LoadAddressContextCond (perform context check)
73 not known not known preserved LoadAttrIndex (attribute may have preserved context in all classes)
74 not known not known overridden LoadAttrIndexContext (attribute may have overridden context in all classes)
75 not known not known not known LoadAttrIndexContextCond (perform context check for class attribute access)
76
77 Since the object table encodes sufficient information (an instance must be
78 compatible to access the class attribute, and compatibility information is
79 stored), an explicit compatibility test may not always be required at
80 run-time