1.1 --- a/optimiser.py Fri Feb 24 16:13:28 2017 +0100
1.2 +++ b/optimiser.py Sat Feb 25 22:19:53 2017 +0100
1.3 @@ -360,8 +360,20 @@
1.4
1.5 if base:
1.6 original_accessor = base
1.7 +
1.8 + # Employ names as contexts unless the context needs testing and
1.9 + # potentially updating. In such cases, temporary context storage is
1.10 + # used instead.
1.11 +
1.12 + elif name and not (context_test == "test" and
1.13 + final_method in ("access-invoke", "static-invoke")):
1.14 + original_accessor = "<name>" # refers to the name
1.15 +
1.16 + # Use a generic placeholder representing the access expression in
1.17 + # the general case.
1.18 +
1.19 else:
1.20 - original_accessor = "<expr>" # use a generic placeholder
1.21 + original_accessor = "<expr>"
1.22
1.23 # Prepare for any first attribute access.
1.24
1.25 @@ -385,6 +397,8 @@
1.26
1.27 # Set the context if already available.
1.28
1.29 + context_var = None
1.30 +
1.31 if context == "base":
1.32 accessor = context_var = (base,)
1.33 elif context == "original-accessor":
1.34 @@ -605,6 +619,11 @@
1.35 elif final_method not in ("assign", "static-assign", "static-invoke"):
1.36 emit(accessor)
1.37
1.38 + # Produce an advisory instruction regarding the context.
1.39 +
1.40 + if context_var:
1.41 + emit(("<context_identity>", context_var))
1.42 +
1.43 self.access_instructions[access_location] = instructions
1.44 self.accessor_kinds[access_location] = accessor_kinds
1.45