Skip to content
Snippets Groups Projects
  1. Mar 08, 2019
    • Damien George's avatar
      py: Add support to save native, viper and asm code to .mpy files. · 1396a026
      Damien George authored
      This commit adds support for saving and loading .mpy files that contain
      native code (native, viper and inline-asm).  A lot of the ground work was
      already done for this in the form of removing pointers from generated
      native code.  The changes here are mainly to link in qstr values to the
      native code, and change the format of .mpy files to contain native code
      blocks (possibly mixed with bytecode).
      
      A top-level summary:
      
      - @micropython.native, @micropython.viper and @micropython.asm_thumb/
        asm_xtensa are now allowed in .py files when compiling to .mpy, and they
        work transparently to the user.
      
      - Entire .py files can be compiled to native via mpy-cross -X emit=native
        and for the most part the generated .mpy files should work the same as
        their bytecode version.
      
      - The .mpy file format is changed to 1) specify in the header if the file
        contains native code and if so the architecture (eg x86, ARMV7M, Xtensa);
        2) for each function block the kind of code is specified (bytecode,
        native, viper, asm).
      
      - When native code is loaded from a .mpy file the native code must be
        modified (in place) to link qstr values in, just like bytecode (see
        py/persistentcode.c:arch_link_qstr() function).
      
      In addition, this now defines a public, native ABI for dynamically loadable
      native code generated by other languages, like C.
      1396a026
  2. Oct 13, 2018
    • Damien George's avatar
      py/emitnative: Load native fun table ptr from const table for all archs. · 00667105
      Damien George authored
      All architectures now have a dedicated register to hold the pointer to the
      native function table mp_fun_table, and so they all need to load this
      register at the start of the native function.  This commit makes the
      loading of this register uniform across architectures by passing the
      pointer in the constant table for the native function, and then loading the
      register from the constant table.  Doing it this way means that the pointer
      is not stored in the assembly code, helping to make the code more portable.
      00667105
    • Damien George's avatar
      py/asmx86: Change indirect calls to load fun ptr from the native table. · 355eb8ea
      Damien George authored
      Instead of storing the function pointer directly in the assembly code.
      This makes the generated code more independent of the runtime (so easier to
      relocate the code), and reduces the generated code size.
      355eb8ea
    • Damien George's avatar
      py/asmx86: Change stack management to reference locals by esp not ebp. · b7c6f859
      Damien George authored
      The esp register is always a fixed distance below ebp, and using esp to
      reference locals on the stack frees up the ebp register for general purpose
      use (which is important for an architecture with only 8 user registers).
      b7c6f859
  3. Oct 01, 2018
  4. Sep 27, 2018
  5. Sep 14, 2018
  6. Aug 16, 2018
  7. Aug 04, 2018
    • Damien George's avatar
    • Damien George's avatar
      py/emitnative: Fix x86 native zero checks by comparing full word. · 10830059
      Damien George authored
      On x86 archs (both 32 and 64 bit) a bool return value only sets the 8-bit
      al register, and the higher bits of the ax register have an undefined
      value.  When testing the return value of such cases it is required to just
      test al for zero/non-zero.  On the other hand, checking for truth or
      zero/non-zero on an integer return value requires checking all bits of the
      register.  These two cases must be distinguished and handled correctly in
      generated native code.  This patch makes sure of this.
      
      For other supported native archs (ARM, Thumb2, Xtensa) there is no such
      distinction and this patch does not change anything for them.
      10830059
  8. Feb 24, 2018
  9. Jul 31, 2017
  10. Dec 09, 2016
  11. Nov 27, 2016
  12. Nov 27, 2015
  13. Jun 04, 2015
  14. Apr 07, 2015
    • Damien George's avatar
      py: Implement full func arg passing for native emitter. · 9988618e
      Damien George authored
      This patch gets full function argument passing working with native
      emitter.  Includes named args, keyword args, default args, var args
      and var keyword args.  Fully Python compliant.
      
      It reuses the bytecode mp_setup_code_state function to do all the hard
      work.  This function is slightly adjusted to accommodate native calls,
      and the native emitter is forced a bit to emit similar prelude and
      code-info as bytecode.
      9988618e
  15. Feb 13, 2015
  16. Jan 20, 2015
  17. Jan 16, 2015
  18. Jan 14, 2015
  19. Jan 01, 2015
  20. Dec 10, 2014
  21. Oct 12, 2014
  22. Sep 29, 2014
  23. Sep 08, 2014
  24. Sep 06, 2014
Loading