1.1 --- a/encoders.py Mon Nov 21 17:05:41 2016 +0100
1.2 +++ b/encoders.py Mon Nov 21 19:02:43 2016 +0100
1.3 @@ -187,10 +187,6 @@
1.4 "__test_common_instance", "__test_common_object", "__test_common_type",
1.5 )
1.6
1.7 -encoding_ops = (
1.8 - "__encode_callable",
1.9 - )
1.10 -
1.11 static_ops = (
1.12 "__load_static",
1.13 )
1.14 @@ -246,18 +242,11 @@
1.15 a[1] = encode_symbol("pos", arg)
1.16 a.insert(2, encode_symbol("code", arg))
1.17
1.18 - # Replace encoded operations.
1.19 -
1.20 - elif op in encoding_ops:
1.21 - origin = a[0]
1.22 - kind = a[1]
1.23 - op = "__load_function"
1.24 - a = [kind == "<class>" and encode_instantiator_pointer(origin) or encode_function_pointer(origin)]
1.25 -
1.26 # Obtain addresses of static objects.
1.27
1.28 elif op in static_ops:
1.29 a[0] = "&%s" % a[0]
1.30 + a[1] = "&%s" % a[1]
1.31
1.32 argstr = "(%s)" % ", ".join(a)
1.33
2.1 --- a/optimiser.py Mon Nov 21 17:05:41 2016 +0100
2.2 +++ b/optimiser.py Mon Nov 21 19:02:43 2016 +0100
2.3 @@ -512,12 +512,9 @@
2.4 parent, attrname = origin.rsplit(".", 1)
2.5 emit(("__store_via_object", parent, attrname, "<assexpr>"))
2.6
2.7 - elif final_method == "static":
2.8 - accessor = ("__load_static", origin)
2.9 -
2.10 - elif final_method == "static-invoke":
2.11 - kind = self.importer.get_object(origin).get_kind()
2.12 - accessor = ("__encode_callable", origin, kind)
2.13 + elif final_method in ("static", "static-invoke"):
2.14 + parent, attrname = origin.rsplit(".", 1)
2.15 + accessor = ("__load_static", parent, origin)
2.16
2.17 # Wrap accesses in context operations.
2.18
3.1 --- a/templates/ops.c Mon Nov 21 17:05:41 2016 +0100
3.2 +++ b/templates/ops.c Mon Nov 21 19:02:43 2016 +0100
3.3 @@ -5,19 +5,11 @@
3.4 #include "progconsts.h"
3.5 #include "progtypes.h"
3.6
3.7 -/* Direct access to functions. */
3.8 -
3.9 -__attr __load_function(__func fn)
3.10 -{
3.11 - __attr out = {0, .fn=fn};
3.12 - return out;
3.13 -}
3.14 -
3.15 /* Direct access and manipulation of static objects. */
3.16
3.17 -__attr __load_static(__ref obj)
3.18 +__attr __load_static(__ref parent, __ref obj)
3.19 {
3.20 - __attr out = {0, .value=obj};
3.21 + __attr out = {.context=parent, .value=obj};
3.22 return out;
3.23 }
3.24
4.1 --- a/templates/ops.h Mon Nov 21 17:05:41 2016 +0100
4.2 +++ b/templates/ops.h Mon Nov 21 19:02:43 2016 +0100
4.3 @@ -6,13 +6,9 @@
4.4 #include "types.h"
4.5 #include <string.h> /* for __COPY */
4.6
4.7 -/* Direct access to functions. */
4.8 -
4.9 -__attr __load_function(__func fn);
4.10 -
4.11 /* Direct access and manipulation of static objects. */
4.12
4.13 -__attr __load_static(__ref obj);
4.14 +__attr __load_static(__ref parent, __ref obj);
4.15
4.16 /* Direct retrieval operations, returning attributes. */
4.17