Skip to content
Snippets Groups Projects
  1. Jun 22, 2018
  2. Jul 31, 2017
  3. Jul 05, 2017
  4. Apr 22, 2017
    • Damien George's avatar
      py/compile: Refactor handling of special super() call. · 5335942b
      Damien George authored
      This patch refactors the handling of the special super() call within the
      compiler.  It removes the need for a global (to the compiler) state variable
      which keeps track of whether the subject of an expression is super.  The
      handling of super() is now done entirely within one function, which makes
      the compiler a bit cleaner and allows to easily add more optimisations to
      super calls.
      
      Changes to the code size are:
      
         bare-arm: +12
          minimal:  +0
         unix x64: +48
      unix nanbox: -16
           stmhal:  +4
           cc3200:  +0
          esp8266: -56
      5335942b
  5. Feb 17, 2017
    • Damien George's avatar
      py/grammar: Remove unused rule. · bdebfaa4
      Damien George authored
      Since the recent changes to string/bytes literal concatenation, this rule
      is no longer used.
      bdebfaa4
    • Damien George's avatar
      py: Do adjacent str/bytes literal concatenation in lexer, not compiler. · 534b7c36
      Damien George authored
      It's much more efficient in RAM and code size to do implicit literal string
      concatenation in the lexer, as opposed to the compiler.
      
      RAM usage is reduced because the concatenation can be done right away in the
      tokeniser by just accumulating the string/bytes literals into the lexer's
      vstr.  Prior to this patch adjacent strings/bytes would create a parse tree
      (one node per string/bytes) and then in the compiler a whole new chunk of
      memory was allocated to store the concatenated string, which used more than
      double the memory compared to just accumulating in the lexer.
      
      This patch also significantly reduces code size:
      
      bare-arm: -204
      minimal:  -204
      unix x64: -328
      stmhal:   -208
      esp8266:  -284
      cc3200:   -224
      534b7c36
  6. Feb 16, 2017
    • Damien George's avatar
      py/grammar: Group no-compile grammar rules together to shrink tables. · 71019ae4
      Damien George authored
      Grammar rules have 2 variants: ones that are attached to a specific
      compile function which is called to compile that grammar node, and ones
      that don't have a compile function and are instead just inspected to see
      what form they take.
      
      In the compiler there is a table of all grammar rules, with each entry
      having a pointer to the associated compile function.  Those rules with no
      compile function have a null pointer.  There are 120 such rules, so that's
      120 words of essentially wasted code space.
      
      By grouping together the compile vs no-compile rules we can put all the
      no-compile rules at the end of the list of rules, and then we don't need
      to store the null pointers.  We just have a truncated table and it's
      guaranteed that when indexing this table we only index the first half,
      the half with populated pointers.
      
      This patch implements such a grouping by having a specific macro for the
      compile vs no-compile grammar rules (DEF_RULE vs DEF_RULE_NC).  It saves
      around 460 bytes of code on 32-bit archs.
      71019ae4
  7. Apr 14, 2016
    • Damien George's avatar
      py: Simplify "and" action within parser by making ident-rules explicit. · 0c1de1cd
      Damien George authored
      Most grammar rules can optimise to the identity if they only have a single
      argument, saving a lot of RAM building the parse tree.  Previous to this
      patch, whether a given grammar rule could be optimised was defined (mostly
      implicitly) by a complicated set of logic rules.  With this patch the
      definition is always specified explicitly by using "and_ident" in the rule
      definition in the grammar.  This simplifies the logic of the parser,
      making it a bit smaller and faster.  RAM usage in unaffected.
      0c1de1cd
  8. Apr 13, 2016
    • pohmelie's avatar
      py: add async/await/async for/async with syntax · 81ebba7e
      pohmelie authored
      They are sugar for marking function as generator, "yield from"
      and pep492 python "semantically equivalents" respectively.
      
      @dpgeorge was the original author of this patch, but @pohmelie made
      changes to implement `async for` and `async with`.
      81ebba7e
  9. Mar 16, 2016
  10. Nov 23, 2015
  11. Nov 17, 2015
  12. Oct 08, 2015
  13. Jul 24, 2015
  14. Apr 21, 2015
  15. Feb 08, 2015
    • Damien George's avatar
      py: Parse big-int/float/imag constants directly in parser. · 7d414a1b
      Damien George authored
      Previous to this patch, a big-int, float or imag constant was interned
      (made into a qstr) and then parsed at runtime to create an object each
      time it was needed.  This is wasteful in RAM and not efficient.  Now,
      these constants are parsed straight away in the parser and turned into
      objects.  This allows constants with large numbers of digits (so
      addresses issue #1103) and takes us a step closer to #722.
      7d414a1b
  16. Dec 27, 2014
    • Damien George's avatar
      py: Allow to properly disable builtin slice operation. · 83204f34
      Damien George authored
      This patch makes the MICROPY_PY_BUILTINS_SLICE compile-time option
      fully disable the builtin slice operation (when set to 0).  This
      includes removing the slice sytanx from the grammar.  Now, enabling
      slice costs 4228 bytes on unix x64, and 1816 bytes on stmhal.
      83204f34
    • Damien George's avatar
      py: Allow to properly disable builtin "set" object. · e37dcaaf
      Damien George authored
      This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully
      disable the builtin set object (when set to 0).  This includes removing
      set constructor/comprehension from the grammar, the compiler and the
      emitters.  Now, enabling set costs 8168 bytes on unix x64, and 3576
      bytes on stmhal.
      e37dcaaf
  17. Dec 20, 2014
  18. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  19. Apr 27, 2014
  20. Feb 10, 2014
  21. Feb 05, 2014
  22. Jan 15, 2014
  23. Jan 04, 2014
  24. Dec 12, 2013
  25. Oct 18, 2013
  26. Oct 04, 2013
Loading