Comparison of nlr implementations
-
- Posts: 5
- Joined: Fri Apr 15, 2016 11:27 am
- Location: Abingdon, UK
Comparison of nlr implementations
What are the advantages of using the assembler implementations of non-local return as opposed to the setjmp/longjmp implementation? Are the assembler versions better (e.g. faster or using fewer resources) or are there circumstances where setjmp does not work correctly? For the mbed port, I'm using the setjmp implementation because the online compiler is ARMCC which is not configured to accept GNU assembler syntax.
Re: Comparison of nlr implementations
nlr_* set of functions is special-tailored functions for the functionality MicroPython needs and thus allows to squeeze every CPU cycle out of otherwise expensive operations of exception handling. setjmp/longjmp are generic functions which work on the "best effort" basis. They were added initially to allow for quick porting to different Unix architectures.
There's also a caveat that setjmp-based implementation of nlr_push is actually a macro and there were cases of setjmp-based ports being broken by peculiar usages of nlr_push. They were fixed and no hard to support for setjmp cases surfaced further, but if you ask for a complete picture, that's it.
There's also a caveat that setjmp-based implementation of nlr_push is actually a macro and there were cases of setjmp-based ports being broken by peculiar usages of nlr_push. They were fixed and no hard to support for setjmp cases surfaced further, but if you ask for a complete picture, 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/
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/
-
- Posts: 5
- Joined: Fri Apr 15, 2016 11:27 am
- Location: Abingdon, UK
Re: Comparison of nlr implementations
Many thanks for the explanation.