-
Notifications
You must be signed in to change notification settings - Fork 30
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
Error when compiling non-inlined functions. #100
Comments
Ah good question.. So I could be entirely wrong, but my understanding of it is as follows: If a function is inlined, any objects allocated on the stack by that function can instead just be allocated in on the stack of whatever bigger function your function has been inlined into, and that is all great. However, if a function is not inlined, its stack will have to be unwound after it returns, and the caller will need somewhere to put the objects returned by the callee. Julia may deal with this by allocating space with the garbage collector (c.f. "boxing"). This means inserting a call to one or more functions from libjulia that typically include terms like "gc" and "alloc" -- in this case It does so happen that the In this case, we have a few potential solutions
|
To test the second option ("Return only llvm types and pointers") you might try having your non-inlined |
So, I tried returning |
By commenting parts of the non-inlined functions it seems that the cause of the error is the line that creates a new block (it contains the But the funny thing is the test function compiles if I only put in that exact line: function test()
# md = MallocDeque{Int}()
# push!(md, 1)
md = MallocDeques.rear_deque_block(Int, 2)
free(md)
end
compile_executable(test, (), "./", filename="test_compilation") |
I got it to work! It was a tricky issue. Your idea of returning 0 was actually right but I did it the wrong way. In the first non-working example I gave, I was redefining |
Hooray! |
Hi,
Thank you for this nice package.
I am the author of MallocDeques.jl, and I am facing an issue that I don't really understand. MallocDeques.jl consists mostly of inlined functions, which compile fine. However, whenever I try to de-inline some of these functions I get errors from StaticCompiler.jl.
Working inlined example:
non-Working de-inlined example
The error
Looking at the generated LLVM IR code I can't see any obvious
throw
call. I'll keep investigating using Cthulhu, but I wondered if you knew about specific edge cases using non-inlined functions?The text was updated successfully, but these errors were encountered: