Stream: general

Topic: Cross thread JITModule


view this post on Zulip Cherry (May 30 2024 at 19:26):

I don't actually need to "use" this cross-thread, but I'd like to free_memory when I'm done with it. This requires me to hold onto JITModule in my type so that I'm able to call free_memory in the Drop impl when everything is done. From what I can tell it shouldn't be a problem to make this type compatible with such a use-case.

A few fields such as libcall_names: Box<dyn Fn(ir::LibCall) -> String> are !Send, which is stopping this type from being used in this way, but it should be able to be easily added.

I'm also fine with a different way that allows me to free the memory, even if it doesn't involve holding onto JITModule. All I need is to free memory without being restricted to the same thread. I don't care that much how it's done as long as it works.

Any thoughts on this?

view this post on Zulip bjorn3 (May 30 2024 at 19:38):

Huh, I thought I made JITModule Send a long time ago, guess not. IMO it makes sense to make JITModule implement Send.

view this post on Zulip Cherry (May 30 2024 at 19:49):

Ahh! So that's what happened. I'm glad to hear this then! :blush:

view this post on Zulip Cherry (May 30 2024 at 22:04):

bjorn3 said:

Huh, I thought I made JITModule Send a long time ago, guess not. IMO it makes sense to make JITModule implement Send.

Do you want me to PR for this, or would you rather do it yourself?

view this post on Zulip bjorn3 (May 31 2024 at 11:28):

If you don't mind opening a PR, please do. Otherwise I might do it somewhere in the next couple of days.


Last updated: Nov 22 2024 at 17:03 UTC