py/persistentcode.h: Split the native and bytecode ABI version. #9303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The intent is to allow us to make breaking changes to the native ABI (e.g. changes to dynruntime.h) without needing the bytecode version to increment.
With this commit, there's now a supported bytecode .mpy version and a native .mpy version.
When generating an .mpy, if it has any native code then it gets the native version, otherwise the bytecode version.
When loading an .mpy, if it has native code, then it must match the native version exactly. If it has only bytecode, then any version between the current bytecode version and native version will be loaded.
e.g. MicroPython v1.19 will load any future bytecode .mpy until we increment
MPY_VERSION_BYTECODE
, but will only load v6 native mpy files.The main driver for this is #8813 however I think this is generally useful. There have been cases where we haven't added a useful feature to dynruntime.h because we don't want to break bytecode compatibility.
This work was funded through GitHub Sponsors.