Kavindu Gimhan Zoysa via llvm-dev
2021-May-05 04:26 UTC
[llvm-dev] Why is method call treated as a safe point for GC
Hi all, In the LLVM GC framework, we are talking about the safe points which are used to run the GC. When selecting the safe points, methods call are considered as safe points. I cannot understand the reason to treat method calls as safe points. Can you explain the reason? Thank you, Kavindu Kavindu Gimhan Zoysa, BSc(Hons) | ENTC | UoM, SSE | WSO2 GitHub <https://github.com/KavinduZoysa> LinkedIn <https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium <https://medium.com/@kavindugimhanzoysa> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210505/ad1b4485/attachment.html>
David Chisnall via llvm-dev
2021-May-05 08:50 UTC
[llvm-dev] Why is method call treated as a safe point for GC
Hi, I believe this is to permit local reasoning. A method call is not necessarily a real safe point, but if the callee reaches a safe point then the entire stack must be treated as a safe point. Without this assumption, you could reach a safe point in the current leaf function but the caller would not be in a safe point and so your stack would be in an inconsistent state. In theory, you could make may-be-a-safepoint an attribute on methods and avoid making the call site a safe point for cases where you can statically prove that nothing reachable from the callee contains a safe point. In practice, if you have sufficient analysis to be able to guarantee that the callee doesn't contain safe points (which also implies that it has a sufficiently short execution time that the lack of safepoints will not impact overall performance) then you probably want to inline it. At this point, the method call no longer exists and so you don't have to worry about it as a potential safe point. David On 05/05/2021 05:26, Kavindu Gimhan Zoysa via llvm-dev wrote:> Hi all, > > In the LLVM GC framework, we are talking about the safe points which are > used to run the GC. When selecting the safe points, methods call are > considered as safe points. I cannot understand the reason to treat > method calls as safe points. Can you explain the reason? > > Thank you, > Kavindu > > Kavindu Gimhan Zoysa, > BSc(Hons) | ENTC | UoM, > SSE | WSO2 > > GitHub <https://github.com/KavinduZoysa> LinkedIn > <https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium > <https://medium.com/@kavindugimhanzoysa> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >