Stream: general

Topic: Inline caching and Cranelift


view this post on Zulip Adel Prokurov (Feb 21 2022 at 09:35):

Hello! I want to implement ICs using hot swapping, I found out there is CallConv::Fast, is it the calling convention I should use to call into IC entries?

view this post on Zulip fitzgen (he/him) (Feb 22 2022 at 18:55):

although you could probably make ICs that technically work with cranelift, it doesn't really have built in support for it and I would be surprised if you could get something that worked well out of it

I don't know a ton about the implementation of ICs but I would expect you would ideally want a tail call style ABI for them, for example, and cranelift doesn't have any support for tail calls right now

view this post on Zulip Chris Fallin (Feb 22 2022 at 19:00):

Yep, tail calls and lack of prologue/epilogue are the two key bits; we don't have either right now, but they could (and probably eventually will) be added

view this post on Zulip Chris Fallin (Feb 22 2022 at 19:01):

For now, what one could do is implement an "IC interpreter loop", where ICs are given indices, and every IC site calls this function, and the function body is a loop around a switch(ic_index) { ... }

view this post on Zulip Chris Fallin (Feb 22 2022 at 19:01):

that's not as efficient, but at least has the desired semantics wrt tail calls (no stack growth) while chaining


Last updated: Nov 22 2024 at 16:03 UTC