Skip to content
Snippets Groups Projects
  1. Feb 01, 2018
  2. Jan 31, 2018
  3. Jan 10, 2018
  4. Dec 29, 2017
    • stijn's avatar
      42c4dd09
    • stijn's avatar
      py/nlr: Fix nlr functions for 64bit ports built with gcc on Windows · b184b6ae
      stijn authored
      The number of registers used should be 10, not 12, to match the assembly
      code in nlrx64.c. With this change the 64bit mingw builds don't need to
      use the setjmp implementation, and this fixes miscellaneous crashes and
      assertion failures as reported in #1751 for instance.
      
      To avoid mistakes in the future where something gcc-related for Windows
      only gets fixed for one particular compiler/environment combination,
      make use of a MICROPY_NLR_OS_WINDOWS macro.
      
      To make sure everything nlr-related is now ok when built with gcc this
      has been verified with:
      - unix port built with gcc on Cygwin (i686-pc-cygwin-gcc and
        x86_64-pc-cygwin-gcc, version 6.4.0)
      - windows port built with mingw-w64's gcc from Cygwin
       (i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc, version 6.4.0)
       and MSYS2 (like the ones on Cygwin but version 7.2.0)
      b184b6ae
    • stijn's avatar
      windows/mpconfigport: Enable some features, including the Python stack · 8041de59
      stijn authored
      Add some features which are already enabled in the unix port and
      default to using the Python stack for scoped allocations: this can be
      more performant in cases the heap is heavily used because for example
      the memory needed for storing *args and **kwargs doesn't require
      scanning the heap to find a free block.
      8041de59
    • stijn's avatar
      windows/mpconfigport: Provide off_t definition for MSVC port · 6fc58db5
      stijn authored
      For MSVC off_t is defined in sys/types.h but according to the comment
      earlier in mpconfigport.h this cannot be included directly.
      So just make off_t the same as mp_off_t.
      This fixes the build for MSVC with MICROPY_STREAMS_POSIX_API
      enabled because stream.h uses off_t.
      6fc58db5
    • Damien George's avatar
      py/mpz: In mpz_as_str_inpl, convert always-false checks to assertions. · e7842744
      Damien George authored
      There are two checks that are always false so can be converted to (negated)
      assertions to save code space and execution time.  They are:
      
      1. The check of the str parameter, which is required to be non-NULL as per
         the original comment that it has enough space in it as calculated by
         mp_int_format_size.  And for all uses of this function str is indeed
         non-NULL.
      
      2. The check of the base parameter, which is already required to be between
         2 and 16 (inclusive) via the assertion in mp_int_format_size.
      e7842744
    • Damien George's avatar
      py/mpz: Simplify handling of borrow and quo adjustment in mpn_div. · 9766fddc
      Damien George authored
      The motivation behind this patch is to remove unreachable code in mpn_div.
      This unreachable code was added some time ago in
      9a21d2e0, when a loop in mpn_div was copied
      and adjusted to work when mpz_dig_t was exactly half of the size of
      mpz_dbl_dig_t (a common case).  The loop was copied correctly but it wasn't
      noticed at the time that the final part of the calculation of num-quo*den
      could be optimised, and hence unreachable code was left for a case that
      never occurred.
      
      The observation for the optimisation is that the initial value of quo in
      mpn_div is either exact or too large (never too small), and therefore the
      subtraction of quo*den from num may subtract exactly enough or too much
      (but never too little).  Using this observation the part of the algorithm
      that handles the borrow value can be simplified, and most importantly this
      eliminates the unreachable code.
      
      The new code has been tested with DIG_SIZE=3 and DIG_SIZE=4 by dividing all
      possible combinations of non-negative integers with between 0 and 3
      (inclusive) mpz digits.
      9766fddc
    • Damien George's avatar
      py/parse: Fix macro evaluation by avoiding empty __VA_ARGS__. · c7cb1dfc
      Damien George authored
      Empty __VA_ARGS__ are not allowed in the C preprocessor so adjust the rule
      arg offset calculation to not use them.  Also, some compilers (eg MSVC)
      require an extra layer of macro expansion.
      c7cb1dfc
  5. Dec 28, 2017
Loading