Stream: general

Topic: Calling Rust functions from JITted code


view this post on Zulip HactarCE (Mar 13 2020 at 02:23):

As part of my program, I am going to have a JIT-compiled scripting language with a fair number of built-in functions and such, which I'd like to write in Rust for speed, safety, and abstraction. I can't find anything in InstBuilder that inserts a call to a Rust function. Do I have to write out the function signature myself, or is there some macro ... is there an example I can look at?

Thanks.

view this post on Zulip HactarCE (Mar 13 2020 at 02:25):

My understanding of Cranelift is based on the simplejit-demo by the way

view this post on Zulip bjorn3 (Mar 13 2020 at 13:01):

If you pass your function to https://docs.rs/cranelift-simplejit/0.59.0/cranelift_simplejit/struct.SimpleJITBuilder.html#method.symbol and then use the normal declare_function, you can use it like a function created using cranelift.

view this post on Zulip HactarCE (Mar 13 2020 at 21:48):

Alright cool, thanks


Last updated: Dec 23 2024 at 12:05 UTC