1.1 --- a/docs/assignment.txt Fri Jul 05 23:13:22 2013 +0200
1.2 +++ b/docs/assignment.txt Sun Jul 07 21:06:01 2013 +0200
1.3 @@ -43,6 +43,9 @@
1.4 unless attribute usage observations are employed to detect possible attribute
1.5 assignments
1.6
1.7 + Remember that once a function is assigned to a class, it will have that class
1.8 + as context (as an unbound method)
1.9 +
1.10 Access types:
1.11
1.12 Access to stored value from... Effect on context Optimised instruction Unoptimised instruction
2.1 --- a/docs/syspython.txt Fri Jul 05 23:13:22 2013 +0200
2.2 +++ b/docs/syspython.txt Sun Jul 07 21:06:01 2013 +0200
2.3 @@ -23,6 +23,27 @@
2.4 or method. Note that the apply function resembles the Python function of the
2.5 same name but is not actually that particular function.
2.6
2.7 +Low-Level Code
2.8 +--------------
2.9 +
2.10 +Most Python-level program code should be wrapped in special function
2.11 +invocations, and as a result other syntax features might be used to express
2.12 +low-level concepts. Low-level operations may also be expressed using other
2.13 +special functions. For example:
2.14 +
2.15 + storelocal(element, loadobjtable(loadattr(obj, classcode), attrcode))
2.16 +
2.17 +Here, element holds the raw data provided by the table access involving a base
2.18 +defined by the classcode of an object and an offset defined by the supplied
2.19 +attrcode.
2.20 +
2.21 +Note that all low-level functions deal only with addresses and offsets, not
2.22 +symbols. In the above example, loadattr combines the address of obj with the
2.23 +symbol classcode whose actual value must be substituted by the compiler.
2.24 +However, the loadobjtable function requires a genuine offset value for the
2.25 +classcode (which is why loadattr is being used to obtain it), and a genuine
2.26 +offset for the attrcode (which is provided directly).
2.27 +
2.28 Program Data and Data Structure Definition
2.29 ------------------------------------------
2.30
3.1 --- a/micropython/syspython.py Fri Jul 05 23:13:22 2013 +0200
3.2 +++ b/micropython/syspython.py Sun Jul 07 21:06:01 2013 +0200
3.3 @@ -52,10 +52,10 @@
3.4 # Some of the assignment operations cannot be supported unless attribute usage
3.5 # observations are being made.
3.6
3.7 -assattr_functions = ("storeaddress", "storeaddresscontext", "storeaddresscontext",
3.8 - "storeattr", "storeattrindex", None)
3.9 -getattr_functions = ("loadaddress", "loadaddresscontext", "loadaddresscontextcond",
3.10 - "loadattr", "loadattrindex", "loadattrindexcontextcond")
3.11 +assattr_functions = ("storeattrcontext", "storeattrcontext",
3.12 + "storeattr", "storeattrindexcontextcond")
3.13 +getattr_functions = ("loadattrcontext", "loadattrcontextcond",
3.14 + "loadattr", "loadattrindexcontextcond")
3.15
3.16 # Source code classes.
3.17
3.18 @@ -518,8 +518,8 @@
3.19
3.20 # Choose the appropriate special functions.
3.21
3.22 - (opaddress, opaddresscontext, opaddresscontextcond,
3.23 - opattr, opattrindex, opattrindexcontextcond) = expr and assattr_functions or getattr_functions
3.24 + (opattrcontext, opattrcontextcond, opattr, opattrindexcontextcond) = \
3.25 + expr and assattr_functions or getattr_functions
3.26
3.27 accessor = self.dispatch(node.expr)
3.28
3.29 @@ -536,11 +536,11 @@
3.30
3.31 if node._access_type == "static":
3.32 if node._set_context == "set":
3.33 - op = opaddresscontext
3.34 + op = opattrcontext
3.35 elif node._set_context == "cond":
3.36 - op = opaddresscontextcond
3.37 + op = opattrcontextcond
3.38 else:
3.39 - op = opaddress
3.40 + op = opattr
3.41
3.42 parent = self._generateValue(node._attr_deduced.parent)
3.43