Hi all - I'm currently working on a small example where I create a function, and then create a second function and try to call the first. I've tried a few variations of this, but I can't seem to get any of them to work. Here's the current one I have, if someone is up for a (hopefully quick) debugging session: https://gist.github.com/jntrnr/bd5d3b0fbe0e9dc8ea0f04c1d0930689
The error I'm getting is:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/jt/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.93.0/src/ir/dfg.rs:955:44
stack backtrace:
on the line that builds the call itself
The result of declare_func_in_func is only valid within a single function. You are calling it on the first function, but then using it on the second function.
bjorn3 said:
The result of declare_func_in_func is only valid within a single function. You are calling it on the first function, but then using it on the second function.
that makes sense. Is there a preferred way of doing what I'm trying to do?
(deleted)
Call it after clear_context.
You could use it right before inserting the call instruction for example.
@bjorn3 that did it, I think. Thanks for the help!
Last updated: Nov 22 2024 at 16:03 UTC