1. 02 Jul, 2015 1 commit
  2. 13 Jun, 2015 1 commit
  3. 17 May, 2015 1 commit
  4. 12 May, 2015 2 commits
    • Damien George's avatar
      py: Add mp_obj_get_int_truncated and use it where appropriate. · c50772d1
      Damien George authored
      mp_obj_get_int_truncated will raise a TypeError if the argument is not
      an integral type.  Use mp_obj_int_get_truncated only when you know the
      argument is a small or big int.
      c50772d1
    • 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
      x86.
      
      The only loss is that the error message "unhashable type" is now the
      more generic "unsupported type for __hash__".
      c2a4e4ef
  5. 05 May, 2015 1 commit
    • Paul Sokolovsky's avatar
      objsingleton: New home for Ellipsis and NotImplemented. · 76677270
      Paul Sokolovsky authored
      Having NotImplemented as MP_OBJ_SENTINEL turned out to be problematic
      (it needs to be checked for in a lot of places, otherwise it'll crash
      as would pass MP_OBJ_IS_OBJ()), so made a proper singleton value like
      Ellipsis, both of them sharing the same type.
      76677270
  6. 20 Apr, 2015 1 commit
  7. 16 Apr, 2015 1 commit
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      Previous to this patch the printing mechanism was a bit of a tangled
      mess.  This patch attempts to consolidate printing into one interface.
      
      All (non-debug) printing now uses the mp_print* family of functions,
      mainly mp_printf.  All these functions take an mp_print_t structure as
      their first argument, and this structure defines the printing backend
      through the "print_strn" function of said structure.
      
      Printing from the uPy core can reach the platform-defined print code via
      two paths: either through mp_sys_stdout_obj (defined pert port) in
      conjunction with mp_stream_write; or through the mp_plat_print structure
      which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
      on the platform.  The former is only used when MICROPY_PY_IO is defined.
      
      With this new scheme printing is generally more efficient (less layers
      to go through, less arguments to pass), and, given an mp_print_t*
      structure, one can call mp_print_str for efficiency instead of
      mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
      Thumb2 archs.
      7f9d1d6a
  8. 11 Apr, 2015 1 commit
  9. 07 Apr, 2015 1 commit
    • Damien George's avatar
      py: Implement full func arg passing for native emitter. · 9988618e
      Damien George authored
      This patch gets full function argument passing working with native
      emitter.  Includes named args, keyword args, default args, var args
      and var keyword args.  Fully Python compliant.
      
      It reuses the bytecode mp_setup_code_state function to do all the hard
      work.  This function is slightly adjusted to accommodate native calls,
      and the native emitter is forced a bit to emit similar prelude and
      code-info as bytecode.
      9988618e
  10. 04 Apr, 2015 1 commit
  11. 03 Apr, 2015 1 commit
  12. 25 Mar, 2015 1 commit
    • Paul Sokolovsky's avatar
      py: Cast mp_obj_t to concrete types explicitly. · 3d598256
      Paul Sokolovsky authored
      mp_obj_t internal representation doesn't have to be a pointer to object,
      it can be anything.
      
      There's also a support for back-conversion in the form of MP_OBJ_UNCAST.
      This is kind of optimization/status quo preserver to minimize patching the
      existing code and avoid doing potentially expensive MP_OBJ_CAST over and
      over. But then one may imagine implementations where MP_OBJ_UNCAST is very
      expensive. But such implementations are unlikely interesting in practice.
      3d598256
  13. 20 Mar, 2015 3 commits
  14. 06 Mar, 2015 1 commit
  15. 27 Feb, 2015 1 commit
    • Paul Sokolovsky's avatar
      objarray: Implement array slice assignment. · cefcbb22
      Paul Sokolovsky authored
      This is rarely used feature which takes enough code to implement, so is
      controlled by MICROPY_PY_ARRAY_SLICE_ASSIGN config setting, default off.
      But otherwise it may be useful, as allows to update arbitrary-sized data
      buffers in-place.
      
      Slice is yet to implement, and actually, slice assignment implemented in
      such a way that RHS of assignment should be array of the exact same item
      typecode as LHS. CPython has it more relaxed, where RHS can be any sequence
      of compatible types (e.g. it's possible to assign list of int's to a
      bytearray slice).
      
      Overall, when all "slice write" features are implemented, it may cost ~1KB
      of code.
      cefcbb22
  16. 23 Feb, 2015 1 commit
  17. 21 Feb, 2015 1 commit
  18. 15 Feb, 2015 1 commit
  19. 08 Feb, 2015 1 commit
  20. 25 Jan, 2015 1 commit
  21. 21 Jan, 2015 2 commits
    • Damien George's avatar
      py: Remove mp_obj_str_builder and use vstr instead. · 05005f67
      Damien George authored
      With this patch str/bytes construction is streamlined.  Always use a
      vstr to build a str/bytes object.  If the size is known beforehand then
      use vstr_init_len to allocate only required memory.  Otherwise use
      vstr_init and the vstr will grow as needed.  Then use
      mp_obj_new_str_from_vstr to create a str/bytes object using the vstr
      memory.
      
      Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes
      on unix x64.
      05005f67
    • Damien George's avatar
      py: Add mp_obj_new_str_from_vstr, and use it where relevant. · 0b9ee861
      Damien George authored
      This patch allows to reuse vstr memory when creating str/bytes object.
      This improves memory usage.
      
      Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88
      bytes on unix x64.
      0b9ee861
  22. 16 Jan, 2015 1 commit
  23. 11 Jan, 2015 1 commit
  24. 29 Dec, 2014 3 commits
  25. 10 Dec, 2014 1 commit
  26. 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.
      78d702c3
  27. 08 Dec, 2014 1 commit
    • Paul Sokolovsky's avatar
      modsys: Add sys.print_exception(exc, file=sys.stdout) function. · 46c3ab20
      Paul Sokolovsky authored
      The function is modeled after traceback.print_exception(), but unbloated,
      and put into existing module to save overhead on adding another module.
      Compliant traceback.print_exception() is intended to be implemented in
      micropython-lib in terms of sys.print_exception().
      
      This change required refactoring mp_obj_print_exception() to take pfenv_t
      interface arguments.
      
      Addresses #751.
      46c3ab20
  28. 05 Dec, 2014 1 commit
  29. 29 Nov, 2014 1 commit
  30. 27 Nov, 2014 1 commit
  31. 16 Nov, 2014 2 commits
  32. 25 Oct, 2014 2 commits