Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LispWorks specific: were slots change from tnon-transactional to transaction, the parents need (:optimize-slot-access nil) #18

Open
Yehouda opened this issue Feb 12, 2020 · 1 comment

Comments

@Yehouda
Copy link

Yehouda commented Feb 12, 2020

The code already adds (:optimize-slot-access nil) to transactional classes, but when such a class is inherited from non-transactional class and overrides a slot to make it transactional, it needs to ensure that all accesses to this slot are not optimized.

For example, the class stmx.util:tmap overrides the slot root which is inherited from stmx.util:gmap via stmx.util:rbmap, and make it transactional. But when an object of class stmx.util:tmap is passed to the method stmx.util::gmap/rebalance-after-insert on stmx.util:rbmap, it may set the root slot, and this access is optimized, because it is on an instance stmx.util:rbmap, which allows optimizations. LispWorks optimizes slot-value and (setf slot-value) on the arguments of methods when the specializer class allows it (not documented properly). To prevent that, stmx.util:rbmap needs to have (:optimize-slot-access nil) too. In principle stmx.util:gmap needs it too, but there are no slot-value accesses to root in a method specilizes on stmx.util:gmap, so this does not causes problem.

To pass the tests, we (LispWorks ltd) also needed to add it to stmx.util:ghash-table. With these two fixes, all the tests in stmx.test work,but really all classes with slots that are overriden to transactional need to either have (:optimize-slot-access nil), or ensure that they don't use slot-value on any of these slots in any ofthe methods that specialize on them.

@cosmos72
Copy link
Owner

Thanks for spotting this!
As you can imagine, the code was tested very lightly on LispWorks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants