1. 10 10月, 2019 1 次提交
  2. 08 10月, 2019 6 次提交
  3. 05 10月, 2019 10 次提交
  4. 04 10月, 2019 9 次提交
  5. 03 10月, 2019 6 次提交
  6. 01 10月, 2019 8 次提交
    • D
      tests/basics: Add test for getting name of func with closed over locals. · 4102320e
      Damien George 提交于
      Tests correct decoding of the prelude to get the function name.
      4102320e
    • D
      py/bc: Don't include mp_decode_uint funcs when not needed. · 1d042341
      Damien George 提交于
      These are now only needed when persistent code is disabled.
      1d042341
    • D
      fd9b7efe
    • D
      py: Rework and compress second part of bytecode prelude. · c8c0fd4c
      Damien George 提交于
      This patch compresses the second part of the bytecode prelude which
      contains the source file name, function name, source-line-number mapping
      and cell closure information.  This part of the prelude now begins with a
      single varible length unsigned integer which encodes 2 numbers, being the
      byte-size of the following 2 sections in the header: the "source info
      section" and the "closure section".  After decoding this variable unsigned
      integer it's possible to skip over one or both of these sections very
      easily.
      
      This scheme saves about 2 bytes for most functions compared to the original
      format: one in the case that there are no closure cells, and one because
      padding was eliminated.
      c8c0fd4c
    • D
      py: Compress first part of bytecode prelude. · b5ebfadb
      Damien George 提交于
      The start of the bytecode prelude contains 6 numbers telling the amount of
      stack needed for the Python values and exceptions, and the signature of the
      function.  Prior to this patch these numbers were all encoded one after the
      other (2x variable unsigned integers, then 4x bytes), but using so many
      bytes is unnecessary.
      
      An entropy analysis of around 150,000 bytecode functions from the CPython
      standard library showed that the optimal Shannon coding would need about
      7.1 bits on average to encode these 6 numbers, compared to the existing 48
      bits.
      
      This patch attempts to get close to this optimal value by packing the 6
      numbers into a single, varible-length unsigned integer via bit-wise
      interleaving.  The interleaving scheme is chosen to minimise the average
      number of bytes needed, and at the same time keep the scheme simple enough
      so it can be implemented without too much overhead in code size or speed.
      The scheme requires about 10.5 bits on average to store the 6 numbers.
      
      As a result most functions which originally took 6 bytes to encode these 6
      numbers now need only 1 byte (in 80% of cases).
      b5ebfadb
    • D
      py: Add n_state to mp_code_state_t struct. · 81d04a02
      Damien George 提交于
      This value is used often enough that it is better to cache it instead of
      decode it each time.
      81d04a02
    • D
      py/bc: Change mp_code_state_t.exc_sp to exc_sp_idx. · 4c5e1a03
      Damien George 提交于
      Change from a pointer to an index, to make space in mp_code_state_t.
      4c5e1a03
    • D
      py/bc: Remove comments referring to obsolete currently_in_except_block. · 1d7afcce
      Damien George 提交于
      It was made obsolete in 6f9e3ff7
      1d7afcce