Generating machine code at runtime with MicroPython (sometimes called JIT)

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
pfalcon
Posts: 1154
Joined: Fri Feb 28, 2014 2:05 pm

Generating machine code at runtime with MicroPython (sometimes called JIT)

Post by pfalcon » Sun Oct 21, 2018 8:03 pm

Here's some code I wrote as an Xmas project 2014/2015 (celebrating MicroPython's first year), exploring/learning about Tracing JIT. It's just very simple class to generate and execute machine code with MicroPython. Roughly speaking, it's prototype of what MicroPython does using @micropython.native/@micropython.viper decorators do, except those are implemented in C, so nobody besides @dbpeorge now how they work and how to extend/improve them. This implementation is on the other hand in Python, so would be easy to hack on.

All this time it sat in my working dir, so I decided to brush it up a bit and push on github, to serve as yet another example of what/how can be done with MicroPython.

https://github.com/pfalcon/micropython-jitgen
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Generating machine code at runtime with MicroPython (sometimes called JIT)

Post by jickster » Sun Oct 21, 2018 11:28 pm

Is Tracing JIT the same thing that Java does?

And is it the same thing @dpgeorge talked about here?

https://github.com/micropython/micropython/issues/4085


Sent from my iPhone using Tapatalk Pro

pfalcon
Posts: 1154
Joined: Fri Feb 28, 2014 2:05 pm

Re: Generating machine code at runtime with MicroPython (sometimes called JIT)

Post by pfalcon » Wed Oct 24, 2018 8:07 am

Yes, that's it.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1154
Joined: Fri Feb 28, 2014 2:05 pm

Re: Generating machine code at runtime with MicroPython (sometimes called JIT)

Post by pfalcon » Fri Feb 22, 2019 10:31 pm

Further development along those lines includes LLVM bindings for MicroPython: viewtopic.php?f=15&t=5994
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply