1. 12 Apr, 2017 6 commits
    • Damien George's avatar
      py/gc: Execute finaliser code in a protected environment. · c7e8c6f7
      Damien George authored
      If a finaliser raises an exception then it must not propagate through the
      GC sweep function.  This patch protects against such a thing by running
      finaliser code via the mp_call_function_1_protected call.
      
      This patch also adds scheduler lock/unlock calls around the finaliser
      execution to further protect against any possible reentrancy issues: the
      memory manager is already locked when doing a collection, but we also don't
      want to allow any scheduled code to run, KeyboardInterrupts to interupt the
      code, nor threads to switch.
      c7e8c6f7
    • Damien George's avatar
      py/nlrsetjmp: Add check for failed NLR jump. · 08242eed
      Damien George authored
      Also optimise the function so it only needs to call the MP_STATE_THREAD
      macro once (following how other nlr code is written).
      08242eed
    • Damien George's avatar
    • Damien George's avatar
      py/objfloat: Add implementation of high-quality float hashing. · a73501b1
      Damien George authored
      Disabled by default.
      a73501b1
    • Damien George's avatar
      py: Optimise types for common case where type has a single parent type. · 816413e4
      Damien George authored
      The common cases for inheritance are 0 or 1 parent types, for both built-in
      types (eg built-in exceptions) as well as user defined types.  So it makes
      sense to optimise the case of 1 parent type by storing just the type and
      not a tuple of 1 value (that value being the single parent type).
      
      This patch makes such an optimisation.  Even though there is a bit more
      code to handle the two cases (either a single type or a tuple with 2 or
      more values) it helps reduce overall code size because it eliminates the
      need to create a static tuple to hold single parents (eg for the built-in
      exceptions).  It also helps reduce RAM usage for user defined types that
      only derive from a single parent.
      
      Changes in code size (in bytes) due to this patch:
      
          bare-arm:       -16
          minimal (x86): -176
          unix (x86-64): -320
          unix nanbox:   -384
          stmhal:         -64
          cc3200:         -32
          esp8266:       -108
      816413e4
    • Damien George's avatar
  2. 11 Apr, 2017 5 commits
  3. 10 Apr, 2017 3 commits
    • Paul Sokolovsky's avatar
      extmod/machine_signal: Support all Pin's arguments to the constructor. · 605ff91e
      Paul Sokolovsky authored
      This implements the orginal idea is that Signal is a subclass of Pin, and
      thus can accept all the same argument as Pin, and additionally, "inverted"
      param. On the practical side, it allows to avoid many enclosed parenses for
      a typical declararion, e.g. for Zephyr:
      
      Signal(Pin(("GPIO_0", 1))).
      
      Of course, passing a Pin to Signal constructor is still supported and is the
      most generic form (e.g. Unix port will only support such form, as it doesn't
      have "builtin" Pins), what's introduces here is just practical readability
      optimization.
      
      "value" kwarg is treated as applying to a Signal (i.e. accounts for possible
      inversion).
      605ff91e
    • Damien George's avatar
    • Damien George's avatar
      py: Make sure that static emg-exc-buffer is aligned to size of mp_obj_t. · ee86de1f
      Damien George authored
      This buffer is used to allocate objects temporarily, and such objects
      require that their underlying memory be correctly aligned for their data
      type.  Aligning for mp_obj_t should be sufficient for emergency exceptions,
      but in general the memory buffer should aligned to the maximum alignment of
      the machine (eg on a 32-bit machine with mp_obj_t being 4 bytes, a double
      may not be correctly aligned).
      
      This patch fixes a bug for certain nan-boxing builds, where mp_obj_t is 8
      bytes and must be aligned to 8 bytes (even though the machine is 32 bit).
      ee86de1f
  4. 08 Apr, 2017 7 commits
  5. 07 Apr, 2017 7 commits
  6. 06 Apr, 2017 2 commits
  7. 05 Apr, 2017 10 commits