-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you have multiple functions in the same JIT compilation or do you have to compile them individually? #74
Comments
For each function you have to call |
Do I make a seperate function builder for all of them? |
Yes. You can reuse the |
when I use the FuncRef using a builder.ins().call() I get a index out of bounds |
The return value of declare_func_in_func can only be used in the |
I got 2 functions to work however now my print function spits out completely wrong data again (except when you send in 0). Also how do i get a value from the return data of call()? |
correction: The data gets completely mangled the print function prints the correct data but the data itself is inherently worng its suppose to give me however when I send anything above zero it sends me 251892446413572 |
You can use
Can you show the clif ir you are using? You can print the |
|
How do you call the function from native code? Do you cast it to a function pointer of type |
im using |
If you use |
Its working now. The so for the dfg.inst_result() you have to append two results with dfg.append_result()? I noticed only the second returned the updated data |
You shouldn't ever need to use |
Well inst results just returns an empty array. Is the the |
You should call |
The issue with that is that the current |
You can use the |
How do I allocate a chunk of memory? |
You did call a function to do so like malloc. Basically the same way you did do in C. |
Is there a builtin function for malloc in cranelift IR or do I need to make like a function myself and implement it? I saw there were built in address functions that use u32 instead of i64 how do I recast them or can I just do |
You can directly import the malloc from libc. If you don't define a function yourself, cranelift-jit will try to look it up using dlsym as fallback.
You can use the Line 388 in 4b12506
|
as the title says. Do you have to compile them individually and then use indirect call? or is there some other way of doing it?
The text was updated successfully, but these errors were encountered: