# HG changeset patch # User Paul Boddie # Date 1479751363 -3600 # Node ID b493fc35aab40bfafa604c199e63f52b0e94bc0e # Parent 906138d55b2be4137cb5dd85070c5b2abb6ce9ed Removed the __load_function operation, making sure that __load_static provides the appropriate attribute for target initialisation. diff -r 906138d55b2b -r b493fc35aab4 encoders.py --- a/encoders.py Mon Nov 21 17:05:41 2016 +0100 +++ b/encoders.py Mon Nov 21 19:02:43 2016 +0100 @@ -187,10 +187,6 @@ "__test_common_instance", "__test_common_object", "__test_common_type", ) -encoding_ops = ( - "__encode_callable", - ) - static_ops = ( "__load_static", ) @@ -246,18 +242,11 @@ a[1] = encode_symbol("pos", arg) a.insert(2, encode_symbol("code", arg)) - # Replace encoded operations. - - elif op in encoding_ops: - origin = a[0] - kind = a[1] - op = "__load_function" - a = [kind == "" and encode_instantiator_pointer(origin) or encode_function_pointer(origin)] - # Obtain addresses of static objects. elif op in static_ops: a[0] = "&%s" % a[0] + a[1] = "&%s" % a[1] argstr = "(%s)" % ", ".join(a) diff -r 906138d55b2b -r b493fc35aab4 optimiser.py --- a/optimiser.py Mon Nov 21 17:05:41 2016 +0100 +++ b/optimiser.py Mon Nov 21 19:02:43 2016 +0100 @@ -512,12 +512,9 @@ parent, attrname = origin.rsplit(".", 1) emit(("__store_via_object", parent, attrname, "")) - elif final_method == "static": - accessor = ("__load_static", origin) - - elif final_method == "static-invoke": - kind = self.importer.get_object(origin).get_kind() - accessor = ("__encode_callable", origin, kind) + elif final_method in ("static", "static-invoke"): + parent, attrname = origin.rsplit(".", 1) + accessor = ("__load_static", parent, origin) # Wrap accesses in context operations. diff -r 906138d55b2b -r b493fc35aab4 templates/ops.c --- a/templates/ops.c Mon Nov 21 17:05:41 2016 +0100 +++ b/templates/ops.c Mon Nov 21 19:02:43 2016 +0100 @@ -5,19 +5,11 @@ #include "progconsts.h" #include "progtypes.h" -/* Direct access to functions. */ - -__attr __load_function(__func fn) -{ - __attr out = {0, .fn=fn}; - return out; -} - /* Direct access and manipulation of static objects. */ -__attr __load_static(__ref obj) +__attr __load_static(__ref parent, __ref obj) { - __attr out = {0, .value=obj}; + __attr out = {.context=parent, .value=obj}; return out; } diff -r 906138d55b2b -r b493fc35aab4 templates/ops.h --- a/templates/ops.h Mon Nov 21 17:05:41 2016 +0100 +++ b/templates/ops.h Mon Nov 21 19:02:43 2016 +0100 @@ -6,13 +6,9 @@ #include "types.h" #include /* for __COPY */ -/* Direct access to functions. */ - -__attr __load_function(__func fn); - /* Direct access and manipulation of static objects. */ -__attr __load_static(__ref obj); +__attr __load_static(__ref parent, __ref obj); /* Direct retrieval operations, returning attributes. */