Persistent Bytecode

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Persistent Bytecode

Post by Roberthh » Thu Feb 25, 2016 9:08 pm

Hello Folks!
A great fanfare and praise for the persistent bytecode. I just tried it on PyBoard and it works impressively. I'll check out more.
Will that also be available on WiPy?
Best Regards, Robert

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Persistent Bytecode

Post by Damien » Fri Feb 26, 2016 7:44 pm

Thanks for the feedback! It would work on WiPy, but there everthing goes in RAM (including code and constants) so it wouldn't be that useful.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Persistent Bytecode

Post by Roberthh » Fri Feb 26, 2016 9:34 pm

Hello Damien. I did not try the variant where the bytecode is compiled into the package. Just the one where a pre-compiled file is loaded (to RAM) instead of the source file. And that should be useful for WiPy too, since it allows to run larger programs. The extra RAM space needed for compilation is saved.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Persistent Bytecode

Post by Damien » Sat Feb 27, 2016 10:24 am

Ok, yes importing .mpy files from the filesystem would be possible on the WiPy and would help reduce RAM requirements. It's a single config option if Daniel wants to enable it.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Persistent Bytecode

Post by Roberthh » Wed Mar 02, 2016 7:49 am

Hello Daimen, thanks for the reply. I have a question and a remark:;
Q: You said that a single config option would enable importing mpy files on WiPy. Is that something I could do myself, like in the mpconfigport.h file, and then rebuild the image? I have rebuilt the image a few times, that's easy enough.
R: When I call mpy-cross with the name of a non-existing file, I get the error message "MemoryError: lexer could not allocate memory". Needless to say that Murphy made this happen on my first attempt.
Regards, Robert

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Persistent Bytecode

Post by Damien » Wed Mar 02, 2016 4:13 pm

Roberthh wrote: Q: You said that a single config option would enable importing mpy files on WiPy. Is that something I could do myself, like in the mpconfigport.h file, and then rebuild the image? I have rebuilt the image a few times, that's easy enough.
It should be enough to add this line:

Code: Select all

#define MICROPY_PERSISTENT_CODE_LOAD (1)
R: When I call mpy-cross with the name of a non-existing file, I get the error message "MemoryError: lexer could not allocate memory". Needless to say that Murphy made this happen on my first attempt.
Regards, Robert
Now fixed.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Persistent Bytecode

Post by Roberthh » Thu Mar 03, 2016 6:40 am

Hello Damien. Thanks a lot, that worked.
Robert

Post Reply