1. 04 Jun, 2019 1 commit
  2. 08 Apr, 2019 2 commits
  3. 08 Mar, 2019 3 commits
  4. 05 Mar, 2019 4 commits
    • Damien George's avatar
      py/persistentcode: Define static qstr set to reduce size of mpy files. · 4f0931b2
      Damien George authored
      When encoded in the mpy file, if qstr <= QSTR_LAST_STATIC then store two
      bytes: 0, static_qstr_id.  Otherwise encode the qstr as usual (either with
      string data or a reference into the qstr window).
      Reduces mpy file size by about 5%.
    • Damien George's avatar
      py/persistentcode: Pack qstrs directly in bytecode to reduce mpy size. · 992a6e1d
      Damien George authored
      Instead of emitting two bytes in the bytecode for where the linked qstr
      should be written to, it is now replaced by the actual qstr data, or a
      reference into the qstr window.
      Reduces mpy file size by about 10%.
    • Damien George's avatar
      py/persistentcode: Add a qstr window to save mpy files more efficiently. · 5996eeb4
      Damien George authored
      This is an implementation of a sliding qstr window used to reduce the
      number of qstrs stored in a .mpy file.  The window size is configured to 32
      entries which takes a fixed 64 bytes (16-bits each) on the C stack when
      loading/saving a .mpy file.  It allows to remember the most recent 32 qstrs
      so they don't need to be stored again in the .mpy file.  The qstr window
      uses a simple least-recently-used mechanism to discard the least recently
      used qstr when the window overflows (similar to dictionary compression).
      This scheme only needs a single pass to save/load the .mpy file.
      Reduces mpy file size by about 25% with a window size of 32.
    • Damien George's avatar
      py: Replace POP_BLOCK and POP_EXCEPT opcodes with POP_EXCEPT_JUMP. · 5a2599d9
      Damien George authored
      POP_BLOCK and POP_EXCEPT are now the same, and are always followed by a
      JUMP.  So this optimisation reduces code size, and RAM usage of bytecode by
      two bytes for each try-except handler.
  5. 15 Dec, 2018 1 commit
  6. 12 Dec, 2018 1 commit
    • Damien George's avatar
      tools/mpy-tool.py: Fix calc of opcode size for opcodes with map caching. · 814d580a
      Damien George authored
      Following an equivalent fix to py/bc.c.  The reason the incorrect values
      for the opcode constants were not previously causing a bug is because they
      were never being used: these opcodes always have qstr arguments so the part
      of the code that was comparing them would never be reached.
      Thanks to @malinah for finding the problem and providing the initial patch.
  7. 01 Aug, 2018 1 commit
    • Rich Barlow's avatar
      tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen mods · 6e5a40cf
      Rich Barlow authored
      The first dynamic qstr pool is double the size of the 'alloc' field of
      the last const qstr pool. The built in const qstr pool
      (mp_qstr_const_pool) has a hardcoded alloc size of 10, meaning that the
      first dynamic pool is allocated space for 20 entries. The alloc size
      must be less than or equal to the actual number of qstrs in the pool
      (the 'len' field) to ensure that the first dynamically created qstr
      triggers the creation of a new pool.
      When modules are frozen a second const pool is created (generally
      mp_qstr_frozen_const_pool) and linked to the built in pool. However,
      this second const pool had its 'alloc' field set to the number of qstrs
      in the pool. When freezing a large quantity of modules this can result
      in thousands of qstrs being in the pool. This means that the first
      dynamically created qstr results in a massive allocation. This commit
      sets the alloc size of the frozen qstr pool to 10 or less (if the number
      of qstrs in the pool is less than 10). The result of this is that the
      allocation behaviour when a dynamic qstr is created is identical with an
      without frozen code.
      Note that there is the potential for a slight memory inefficiency if the
      frozen modules have less than 10 qstrs, as the first few dynamic
      allocations will have quite a large overhead, but the geometric growth
      soon deals with this.
  8. 09 Jul, 2018 2 commits
  9. 15 Nov, 2017 1 commit
  10. 09 Oct, 2017 1 commit
  11. 04 Oct, 2017 1 commit
  12. 16 Aug, 2017 1 commit
  13. 12 Aug, 2017 1 commit
  14. 16 May, 2017 1 commit
  15. 13 May, 2017 1 commit
  16. 30 Apr, 2017 1 commit
  17. 22 Apr, 2017 1 commit
    • Damien George's avatar
      py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. · dd11af20
      Damien George authored
      This patch allows the following code to run without allocating on the heap:
      Before this patch such a call would allocate a super object on the heap and
      then load the foo method and call it right away.  The super object is only
      needed to perform the lookup of the method and not needed after that.  This
      patch makes an optimisation to allocate the super object on the C stack and
      discard it right after use.
      Changes in code size due to this patch are:
         bare-arm: +128
          minimal: +232
         unix x64: +416
      unix nanbox: +364
           stmhal: +184
          esp8266: +340
           cc3200: +128
  18. 16 Feb, 2017 1 commit
  19. 05 Jan, 2017 1 commit
  20. 23 Sep, 2016 1 commit
  21. 02 Sep, 2016 3 commits
  22. 10 Aug, 2016 1 commit
  23. 23 May, 2016 2 commits
  24. 16 May, 2016 1 commit
  25. 03 May, 2016 1 commit
  26. 15 Apr, 2016 1 commit
  27. 13 Apr, 2016 1 commit