Stream: cranelift

Topic: How to use interpreter?


view this post on Zulip Teymour Aldridge (Aug 05 2022 at 02:48):

Sorry if this question has already been asked - are there any directions on how to use the interpreter? Currently I translate source programs to cranelift-jit - I tried to use https://docs.rs/cranelift-interpreter/latest/cranelift_interpreter/environment/struct.FunctionStore.html#method.add to add every function from the module, but I couldn't find a convenient way to get an ir::Function from that. Is there a way to convert between the two, or would I need to rewrite the code I use to translate to Cranelift?

view this post on Zulip Afonso Bordado (Aug 05 2022 at 08:08):

Hey, you should be able to use the function that is stored in the Context and add it both to the interpreter FunctionStore and to define_function in the Module for use with the JIT

view this post on Zulip Afonso Bordado (Aug 05 2022 at 08:14):

The interpreter only operates in CLIF functions, and it doesn't interact very much with the compilation pipeline beyond that, so we really need the CLIF code.

view this post on Zulip Afonso Bordado (Aug 05 2022 at 08:16):

Also, the interpreter is quite experimental, and we're actively working on it, if you find any instruction that is not implemented or producing wrong results let me know and i'll try to fix it promptly!


Last updated: Oct 23 2024 at 20:03 UTC