1. 03 Jun, 2015 1 commit
  2. 12 May, 2015 1 commit
    • Damien George's avatar
      py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. · c2a4e4ef
      Damien George authored
      Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
      the operator argument.  Hashing for int, str and bytes still go via
      fast-path in mp_unary_op since they are the most common objects which
      need to be hashed.
      This lead to quite a bit of code cleanup, and should be more efficient
      if anything.  It saves 176 bytes code space on Thumb2, and 360 bytes on
      The only loss is that the error message "unhashable type" is now the
      more generic "unsupported type for __hash__".
  3. 09 May, 2015 2 commits
    • Paul Sokolovsky's avatar
      runtime: Add TODO for mp_resume() on handling .close(). · 4a60cac9
      Paul Sokolovsky authored
      Exceptions in .close() should be ignored (dumped to sys.stderr, not
      propagated), but in uPy, they are propagated. Fix would require
      nlr-wrapping .close() call, which is expensive. Bu on the other hand,
      .close() is not called often, so maybe that's not too bad (depends,
      if it's finally called and that causes stack overflow, there's nothing
      good in that). And yet on another hand, .close() can be implemented to
      catch exceptions on its side, and that should be the right choice.
    • Paul Sokolovsky's avatar
      py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION. · 4ed7b7f7
      Paul Sokolovsky authored
      Testing for incorrect value led to premature termination of generator
      containing yield from for such iterator (e.g. "yield from [1, 2]").
  4. 16 Apr, 2015 1 commit
  5. 11 Apr, 2015 1 commit
  6. 02 Apr, 2015 2 commits
  7. 21 Mar, 2015 1 commit
    • Damien George's avatar
      py: Combine duplicated code that converts members from a lookup. · 55b74d1f
      Damien George authored
      Despite initial guess, this code factoring does not hamper performance.
      In fact it seems to improve speed by a little: running pystone(1.2) on
      pyboard (which gives a very stable result) this patch takes pystones
      from 1729.51 up to 1742.16.  Also, pystones on x64 increase by around
      the same proportion (but it's much noisier).
      Taking a look at the generated machine code, stack usage with this patch
      is unchanged, and call is tail-optimised with all arguments in
      registers.  Code size decreases by about 50 bytes on Thumb2 archs.
  8. 20 Mar, 2015 1 commit
  9. 03 Mar, 2015 1 commit
  10. 15 Feb, 2015 1 commit
  11. 08 Feb, 2015 1 commit
    • Damien George's avatar
      py: Parse big-int/float/imag constants directly in parser. · 7d414a1b
      Damien George authored
      Previous to this patch, a big-int, float or imag constant was interned
      (made into a qstr) and then parsed at runtime to create an object each
      time it was needed.  This is wasteful in RAM and not efficient.  Now,
      these constants are parsed straight away in the parser and turned into
      objects.  This allows constants with large numbers of digits (so
      addresses issue #1103) and takes us a step closer to #722.
  12. 07 Feb, 2015 1 commit
    • Damien George's avatar
      py: Protect mp_parse and mp_compile with nlr push/pop block. · 0bfc7638
      Damien George authored
      To enable parsing constants more efficiently, mp_parse should be allowed
      to raise an exception, and mp_compile can already raise a MemoryError.
      So these functions need to be protected by an nlr push/pop block.
      This patch adds that feature in all places.  This allows to simplify how
      mp_parse and mp_compile are called: they now raise an exception if they
      have an error and so explicit checking is not needed anymore.
  13. 27 Jan, 2015 1 commit
    • Damien George's avatar
      py: Specify unary/binary op name in TypeError error message. · a5efcd47
      Damien George authored
      Eg, "() + 1" now tells you that __add__ is not supported for tuple and
      int types (before it just said the generic "binary operator").  We reuse
      the table of names for slot lookup because it would be a waste of code
      space to store the pretty name for each operator.
  14. 20 Jan, 2015 1 commit
  15. 16 Jan, 2015 1 commit
  16. 07 Jan, 2015 1 commit
  17. 01 Jan, 2015 1 commit
  18. 21 Dec, 2014 1 commit
  19. 09 Dec, 2014 1 commit
    • Damien George's avatar
      py: Allow builtins to be overridden. · 78d702c3
      Damien George authored
      This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
      which, when enabled, allows to override all names within the builtins
      module.  A builtins override dict is created the first time the user
      assigns to a name in the builtins model, and then that dict is searched
      first on subsequent lookups.  Note that this implementation doesn't
      allow deleting of names.
      This patch also does some refactoring of builtins code, creating the
      modbuiltins.c file.
      Addresses issue #959.
  20. 05 Dec, 2014 1 commit
    • Damien George's avatar
      py: Optimise lexer by exposing lexer type. · a4c52c5a
      Damien George authored
      mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer
      functions (like checking current token kind) are now inlined.
      This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460
      bytes on bare-arm.  It also saves a tiny bit of RAM since mp_lexer_t
      is a bit smaller.  Also will run a bit more efficiently.
  21. 06 Nov, 2014 1 commit
  22. 02 Nov, 2014 1 commit
  23. 25 Oct, 2014 3 commits
  24. 23 Oct, 2014 1 commit
  25. 09 Oct, 2014 1 commit
  26. 07 Oct, 2014 1 commit
  27. 05 Oct, 2014 1 commit
    • Damien George's avatar
      py: Implement proper context save/restore for eval/exec; factor code. · c4d0868d
      Damien George authored
      This has benefits all round: code factoring for parse/compile/execute,
      proper context save/restore for exec, allow to sepcify globals/locals
      for eval, and reduced ROM usage by >100 bytes on stmhal and unix.
      Also, the call to mp_parse_compile_execute is tail call optimised for
      the import code, so it doesn't increase stack memory usage.
  28. 03 Oct, 2014 1 commit
  29. 25 Sep, 2014 2 commits
  30. 23 Sep, 2014 1 commit
    • Damien George's avatar
      stmhal: Initialise stack pointer correctly. · eaaebf32
      Damien George authored
      Stack is full descending and must be 8-byte aligned.  It must start off
      pointing to just above the last byte of RAM.
      Previously, stack started pointed to last byte of RAM (eg 0x2001ffff)
      and so was not 8-byte aligned.  This caused a bug in combination with
      This patch also updates some debug printing code.
      Addresses issue #872 (among many other undiscovered issues).
  31. 30 Aug, 2014 4 commits
  32. 28 Aug, 2014 1 commit