Just updated the source and now I get the unreachable error again. The JIT doesn't know how to handle a RAUW on a value it has emitted. UNREACHABLE executed at /home/conrado/engines/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1542! I think that it's not helpful now, but I can post the program, if you want me to. On Sun, Jan 31, 2010 at 2:49 PM, Jeffrey Yasskin <jyasskin at google.com>wrote:> On Sun, Jan 31, 2010 at 7:35 AM, Conrado Miranda > <miranda.conrado at gmail.com> wrote: > > Great! It just worked. I was a bit worried about using pointers to call > > functions because it's a little too overwhelming in a big project, I > think. > > > > Just for the record, if the function code isn't freed with > > freeMachineCodeForFunction, I get a segmentation fault during > > recompileAndRelinkFunction with this stack dump: > > Running pass 'X86 Machine Code Emitter' on function '@do_print' > > Well, it's not supposed to segfault. At worst, it should give you an > assertion error when you do something wrong (when it's compiled with > asserts, of course). Could you either file a bug, or send me the exact > code you were using with the command line you used to compile it > against svn head? > > Thanks, > Jeffrey >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100131/5c796f95/attachment.html>
Hm, I wonder if the error message for llvm_unreachable should change. I think I remember a couple people focusing incorrectly on the UNREACHABLE instead of the actual error message above it (which means it's our fault, not theirs). Miranda, this is pointing at the same problem you had before. You have a function JIT-compiled, and you're trying to RAUW (ReplaceAllUsesWith) it. You'll need to call freeMachineCodeForFunction(x) before you call x->replaceAllUsesWith(y). And yes, putting your code (and a gdb-produced stack trace when there's a crash) somewhere we can see it (for example, pastebin.com) will always help us debug problems. On Sunday, January 31, 2010, Conrado Miranda <miranda.conrado at gmail.com> wrote:> Just updated the source and now I get the unreachable error again. > > The JIT doesn't know how to handle a RAUW on a value it has emitted. > UNREACHABLE executed at /home/conrado/engines/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1542! > > I think that it's not helpful now, but I can post the program, if you want me to. > > > > On Sun, Jan 31, 2010 at 2:49 PM, Jeffrey Yasskin <jyasskin at google.com> wrote: > > > On Sun, Jan 31, 2010 at 7:35 AM, Conrado Miranda > <miranda.conrado at gmail.com> wrote: >> Great! It just worked. I was a bit worried about using pointers to call >> functions because it's a little too overwhelming in a big project, I think. >> >> Just for the record, if the function code isn't freed with >> freeMachineCodeForFunction, I get a segmentation fault during >> recompileAndRelinkFunction with this stack dump: >> Running pass 'X86 Machine Code Emitter' on function '@do_print' > > Well, it's not supposed to segfault. At worst, it should give you an > assertion error when you do something wrong (when it's compiled with > asserts, of course). Could you either file a bug, or send me the exact > code you were using with the command line you used to compile it > against svn head? > > Thanks, > Jeffrey > >
On Mon, Feb 1, 2010 at 3:41 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:> Hm, I wonder if the error message for llvm_unreachable should change. > I think I remember a couple people focusing incorrectly on the > UNREACHABLE instead of the actual error message above it (which means > it's our fault, not theirs). >I think so. It really seems like it's the programmers fault> Miranda, this is pointing at the same problem you had before. You have > a function JIT-compiled, and you're trying to RAUW > (ReplaceAllUsesWith) it. You'll need to call > freeMachineCodeForFunction(x) before you call > x->replaceAllUsesWith(y). >Actually, I didn't call freeMachineCodeForFunction(x) (I know it's a leak, but just to show it's possible not to call).> And yes, putting your code (and a gdb-produced stack trace when > there's a crash) somewhere we can see it (for example, pastebin.com) > will always help us debug problems. >The headers are a little mess, but it compiles OK. Main file: http://miranda.pastebin.com/m10213c9c File with function A (following your convention): http://miranda.pastebin.com/m2dbe2e64 File with function B: http://miranda.pastebin.com/m2dbe2e64 File with function C: http://miranda.pastebin.com/m32f19219 gdb trace: http://miranda.pastebin.com/m5c794b0d When I call recompileAndRelinkFunction without calling freeMachineCodeForFunction for the same function, it crashes. Just ask if more info is needed. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100201/f7d04d35/attachment.html>