# HG changeset patch # User Paul Boddie # Date 1240440753 -7200 # Node ID 7c52463d3038ff047e1276ec13ca0fc7dd7d8d72 # Parent 657d0220c45f475e24e9f2b182ba4b1c8385ba03 Added missing built-in methods. Added inspection of "if" test expressions. Removed StoreName from the constant storage optimisation (until population of locals/frames is implemented). Added debugging attributes to RSVPMachine for the object and parameter lists. Fixed the StoreName instruction to use the source, not the value. Added common names in use. diff -r 657d0220c45f -r 7c52463d3038 lib/builtins.py --- a/lib/builtins.py Mon Apr 20 01:50:00 2009 +0200 +++ b/lib/builtins.py Thu Apr 23 00:52:33 2009 +0200 @@ -34,6 +34,7 @@ def __mul__(self, other): pass def __radd__(self, other): pass def __mod__(self, other): pass + def __rmod__(self, other): pass def __lt__(self, other): pass def __gt__(self, other): pass def __le__(self, other): pass @@ -80,6 +81,7 @@ def __floordiv__(self, other): pass def __rfloordiv__(self, other): pass def __mod__(self, other): pass + def __rmod__(self, other): pass def __pow__(self, other): pass def __rpow__(self, other): pass def __lt__(self, other): pass @@ -114,7 +116,9 @@ def __floordiv__(self, other): pass def __rfloordiv__(self, other): pass def __mod__(self, other): pass + def __rmod__(self, other): pass def __pow__(self, other): pass + def __rpow__(self, other): pass def __and__(self, other): pass def __rand__(self, other): pass def __or__(self, other): pass diff -r 657d0220c45f -r 7c52463d3038 micropython/__init__.py --- a/micropython/__init__.py Mon Apr 20 01:50:00 2009 +0200 +++ b/micropython/__init__.py Thu Apr 23 00:52:33 2009 +0200 @@ -411,8 +411,10 @@ # Name records (used to track actual use of names). # Include names which may not be explicitly used in programs. + # NOTE: Potentially declare these when inspecting. For example, __iter__ + # NOTE: and next are usually implicitly invoked by "for" statements. - self.names_used = set(["__init__", "__call__", "__getitem__", "__bool__"]) + self.names_used = set(["__init__", "__call__", "__getitem__", "__bool__", "__iter__", "next"]) # Status information. diff -r 657d0220c45f -r 7c52463d3038 micropython/inspect.py --- a/micropython/inspect.py Mon Apr 20 01:50:00 2009 +0200 +++ b/micropython/inspect.py Thu Apr 23 00:52:33 2009 +0200 @@ -626,6 +626,7 @@ def visitIf(self, node): for test, body in node.tests: + self.dispatch(test) self.dispatch(body) if node.else_ is not None: self.dispatch(node.else_) diff -r 657d0220c45f -r 7c52463d3038 micropython/opt.py --- a/micropython/opt.py Mon Apr 20 01:50:00 2009 +0200 +++ b/micropython/opt.py Thu Apr 23 00:52:33 2009 +0200 @@ -155,7 +155,10 @@ "Return whether 'instruction' provides a constant target." - return isinstance(instruction, (StoreName, StoreAddress)) and \ + # NOTE: Removed StoreName, since this would then demand population of + # NOTE: locals/frames. + + return isinstance(instruction, StoreAddress) and \ instruction.attr.assignments == 1 def is_simple_input(self, instruction): diff -r 657d0220c45f -r 7c52463d3038 rsvp.py --- a/rsvp.py Mon Apr 20 01:50:00 2009 +0200 +++ b/rsvp.py Thu Apr 23 00:52:33 2009 +0200 @@ -88,6 +88,8 @@ """ self.memory = memory + self._objlist = objlist + self._paramlist = paramlist self.objlist = objlist.as_raw() self.paramlist = paramlist.as_raw() self.true_constant = true_constant @@ -333,7 +335,7 @@ def StoreName(self): frame = self.local_sp_stack[-1] - self.frame_stack[frame + self.operand] = self.value + self.frame_stack[frame + self.operand] = self.source LoadTemp = LoadName StoreTemp = StoreName