# HG changeset patch # User Paul Boddie # Date 1298824730 -3600 # Node ID c87bdb84d9d3f32c979396a054ba6cb933ac7ccf # Parent 4a8dd27c299420de7198020e8e81e8af762ece74 Introduced placeholder functions for print in order to let all tests pass. Added TestIdentity and status-related optimisation suggestions. diff -r 4a8dd27c2994 -r c87bdb84d9d3 TO_DO.txt --- a/TO_DO.txt Sun Feb 27 02:45:38 2011 +0100 +++ b/TO_DO.txt Sun Feb 27 17:38:50 2011 +0100 @@ -1,22 +1,3 @@ -Permit __class__ as being differently defined for classes and instances. Since __class__ -is always defined, no shadowing may occur for the attribute exposing it at different -levels. - - The instance definition of __class__ should be stored in the object table. - - Each common definition for instances of a class shall be stored as the first - attribute of each class. - - Access to __class__ has to be detected and a special instruction (sequence) - generated to handle the class/instance logic. - - The type class should be exposed as each class's __class__ attribute. - - Note that object table information will not be able to reflect the class-type - relationship, but isinstance will need to check for instances and classes, anyway. - -Tuple references to stack locations in a merged stack/heap memory model. - Attribute Usage =============== @@ -111,3 +92,12 @@ __getitem__ could be written in Python, using a native method only to access fragments. Consider better "macro" support where new expressions need to be generated and processed. + +Detect TestIdentity results involving constants, potentially optimising status-affected +instructions: + + TestIdentity(x, y) # where x is always y + JumpIfFalse(...) # would be removed (never false) + JumpIfTrue(...) # changed to Jump(...) + +Status-affected blocks could be optimised away for such constant-related results. diff -r 4a8dd27c2994 -r c87bdb84d9d3 rsvplib.py --- a/rsvplib.py Sun Feb 27 02:45:38 2011 +0100 +++ b/rsvplib.py Sun Feb 27 17:38:50 2011 +0100 @@ -445,6 +445,14 @@ else: self.machine.result = DataValue(self.constants[False], self.constants[False]) + def builtins_print(self): + # NOTE: Do nothing for now. + pass + + def builtins_printnl(self): + # NOTE: Do nothing for now. + pass + native_functions = { # Native method implementations: @@ -491,6 +499,8 @@ # Native helper functions: "__builtins__._isinstance" : builtins_isinstance, + "__builtins__._print" : builtins_print, + "__builtins__._printnl" : builtins_printnl, } # vim: tabstop=4 expandtab shiftwidth=4