-
Notifications
You must be signed in to change notification settings - Fork 14
Backward Compatibility
Backward Compatibility.
There is currently no policy to keep the backward compatibility of the SPVM language.
If you look at Changes, you see a lot of breaking backward compatibility.
You expect backward compatibility to be improved little by little as more modules are released to CPAN. For now, there are more than 100 SPVM modules on CPAN.
SPVM is designed to keep binary compatibility.
Even if the SPVM language itself is upgraded, previously installed SPVM modules and applications will work correctly without experiencing segmentation faults.
However, whether or not SPVM developers will actually keep binary compatibility is pending until version 1.0.
Here is how developers can keep binary compatibility after version 1.0 is reached.
Binary compatibility is not kept if the implementation of the SPVM operation code defined in spvm_implement.h is changed.
This is because the precompiled code contains the implementation of the operation code defined in spvm_implement.h.
On the other hand, implementation changes in spvm_api.c will not affect binary compatibility.
Binary compatibility is not be kept if the order of Native APIs defined in spvm_native.h is changed (i.e., the IDs are changed in the documentation).
Do not change the enumeration value published to users.
A getting enumeration value is replaced to an interger literal at compilation time.
For this, if an enumeration value is changed after first publication to users, the binary compatibility is not kept.
If binary compatibility is broken due to a major upgrade of the SPVM core or an intentional change in the ABI, precompiled or native modules may cause segmentation faults. In such cases, you can recover the environment by reinstalling the affected modules.
The following one-liner identifies modules that contain native or precompiled classes and reinstalls them using cpanm.
# Reinstall modules affected by binary compatibility changes (Example for SPVM::Mojolicious)
curl -sL https://raw.githubusercontent.com/yuki-kimoto/SPVM/refs/heads/master/util/cpandeps | perl - --verbose --native-class-only SPVM::Mojolicious | grep -vx "SPVM" | xargs cpanm --reinstallNote: Replace SPVM::Mojolicious with the module name you are using.
This one-liner automates the identification and reinstallation of modules that are susceptible to ABI changes:
-
Fetching and Executing
cpandeps:curlretrieves the latest dependency analysis script from the SPVM repository, andperl -executes it directly without needing to save the file locally. -
Filtering with
--native-class-only: This is the core of the optimization. The script analyzes the dependency tree of the specified module (e.g.,SPVM::Mojolicious) and filters for only those distributions that contain Native or Precompiled classes. -
Excluding the Core:
grep -vx "SPVM"ensures that the SPVM core itself is excluded from the reinstallation list, as it has presumably already been upgraded. -
Forced Reinstallation:
xargs cpanm --reinstalltakes the list of identified modules and performs a fresh installation. This process ensures that all C source files (including precompiled ones) are compiled again and linked against the currently installed SPVM core headers and libraries.
By targeting only modules with native or precompiled components, this command minimizes the recovery time while ensuring that all binary-dependent parts of your environment are consistent with the new SPVM version.