Windows Port: "Basic Block in function 'fill!' does not have terminator!"

242 views
Skip to first unread message

Keno Fischer

unread,
Feb 26, 2012, 7:38:09 PM2/26/12
to juli...@googlegroups.com
After a lot of debugging, there is one last error to resolve that I am
currently lost on. The JIT compiler works fine on hundreds of functions but
then fails on fill!. Following advice I got on the llvm IRC channel I added
a verifier pass which fails for that function with:
"Basic Block in function 'fill!' does not have terminator!"

Any ideas?

Jeff Bezanson

unread,
Feb 26, 2012, 7:42:24 PM2/26/12
to juli...@googlegroups.com
Have you merged in the latest version of the julia sources? I may have
fixed this recently.
Otherwise I'm not sure how this would vary across platforms.
Thanks for the hard work.

Stefan Karpinski

unread,
Feb 26, 2012, 8:05:09 PM2/26/12
to juli...@googlegroups.com
I cannot express how much it's appreciated that you're doing this.

Keno Fischer

unread,
Feb 26, 2012, 8:21:52 PM2/26/12
to juli...@googlegroups.com
I pulled the latest changes, but the problem still persist. Can you point me
to the changes you made that you thought could have fixed this, so that I
have a starting point?

Jeff Bezanson

unread,
Feb 26, 2012, 9:05:57 PM2/26/12
to juli...@googlegroups.com
If you look at codegen.cpp:156, where I have a call to
verifyFunction(), you can uncomment the line before that to dump all
function bodies. Hopefully the one right before the verification error
is the offending llvm code. If you send me that I might be able to
spot the problem.
Possibly related to long being 32 bits on windows?

Keno Fischer

unread,
Feb 26, 2012, 9:07:08 PM2/26/12
to juli...@googlegroups.com
Here you go:

Basic Block in function 'fill!' does not have terminator!
label
%if

I think I'm pretty close though

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Sonntag, 26. Februar 2012 21:06
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Jeff Bezanson

unread,
Feb 26, 2012, 9:09:36 PM2/26/12
to juli...@googlegroups.com
It doesn't dump any more disassembly than that if you uncomment f->dump()?

Keno Fischer

unread,
Feb 26, 2012, 9:10:12 PM2/26/12
to juli...@googlegroups.com
Nope

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Sonntag, 26. Februar 2012 21:10
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Keno Fischer

unread,
Feb 26, 2012, 9:17:25 PM2/26/12
to juli...@googlegroups.com
The debugger shows me that it never gets to f->dump() in the case of fill!.
Very strange. I'll investigate further!

Jeff Bezanson

unread,
Feb 26, 2012, 9:23:08 PM2/26/12
to juli...@googlegroups.com
Oh, that would happen if you added a verification pass to the pass
manager, which runs before my dump() and verify().

Keno Fischer

unread,
Feb 26, 2012, 9:25:03 PM2/26/12
to juli...@googlegroups.com
I added a verification pass right before llvm SIGSEGV'd because of the
missing terminator, but I'm not using the PassManager.

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Sonntag, 26. Februar 2012 21:23
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Keno Fischer

unread,
Feb 26, 2012, 9:35:02 PM2/26/12
to juli...@googlegroups.com
Ok, thanks to the magic of GDB, I found where the problem is (windows
specific library code ...). Should be easy to fix (I hope). Thanks for the
help.

Jeff Bezanson

unread,
Feb 26, 2012, 9:42:38 PM2/26/12
to juli...@googlegroups.com
You are all over this. You should be doing this on github so we can
follow along!

Keno Fischer

unread,
Feb 26, 2012, 9:46:02 PM2/26/12
to juli...@googlegroups.com
Ok, will do

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Sonntag, 26. Februar 2012 21:43
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Bill Hart

unread,
Feb 26, 2012, 9:52:39 PM2/26/12
to juli...@googlegroups.com
As I only found Julia a few days ago, I didn't even realise yet that
it wasn't ported to Windows (I was using it on linux). But from
someone who uses Windows on their laptop:

+1 for doing this
+1 for using MinGW
+1 for being awesome

Bill.

Keno Fischer

unread,
Feb 26, 2012, 10:09:06 PM2/26/12
to juli...@googlegroups.com
Ok, actual underlying issue is that on linux dlopen(NULL) loads all symbols
that have been loaded, but the windows equivalent only loads the current
process (i.e. not the symbols in the standard library). How do you think we
should resolve this? Have a const reference to the c runtime library in
Julia that is defined to : on linux? Or rather do some sort runtime
detection?

Jeff Bezanson

unread,
Feb 26, 2012, 10:15:52 PM2/26/12
to juli...@googlegroups.com
Ideal would be to have julia obtain a reference to libc at init time,
and then default to looking in both the process handle and the libc
handle in ccall.cpp.

Keno Fischer

unread,
Feb 27, 2012, 8:17:30 AM2/27/12
to juli...@googlegroups.com
Another question: Why are we using both libm and libfdm? Is it possible to
use the latter completely?

Thanks,
Keno

P.S. I'll upload my wip to github once I get my repositories untangled, it's
a mess currently.

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Sonntag, 26. Februar 2012 22:16
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Viral Shah

unread,
Feb 27, 2012, 11:00:32 AM2/27/12
to juli...@googlegroups.com
We use libm for some stuff that is not in fdlibm, and for some functions where one needs fast assembly implementations - like sqrt and exp2.

The best way forward is to take the FreeBSD libm, and make it independent. It is based on fdlibm, with a lot of accumulated fixes over the years. I have put together openlibm, along these lines:

https://github.com/JuliaLang/openlibm

It builds, works with julia, but some work needs to be done before we can be confident to use it, and also build the assembly routines, which I haven't figured out yet. We can then chuck fdlibm and libm altogether.

-viral

Keno Fischer

unread,
Feb 27, 2012, 10:37:17 PM2/27/12
to juli...@googlegroups.com
When creating new functions within the Julia static library, how can I tell
the linker not to ignore those functions when linking to the REPL, even
though I'm only using them in Julia? This seems to have been done quite a
few times within Julia, but I can't seem to get it to work.

Thanks,
Keno

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Viral Shah
> Sent: Montag, 27. Februar 2012 11:01
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Jeff Bezanson

unread,
Feb 27, 2012, 11:16:35 PM2/27/12
to juli...@googlegroups.com
Is this on windows?
We set symbols to hidden by default on linux, so you have to add them
to src/julia.expmap, and mark them with DLLEXPORT. I imagine there
might be windows-specific linking details though.
Adding functions there is pretty controversial, but I assume you have
good reasons related to the windows port?

Keno Fischer

unread,
Feb 27, 2012, 11:21:10 PM2/27/12
to juli...@googlegroups.com
Ok, for now I just set it all to visible (I'll deal with the details later).
Yes, I have a good reason (though it's only temporary right now and I might
be able to remove it in the future). I'm currently rewriting the child
process invocation/piping using libuv.

> -----Original Message-----
> From: juli...@googlegroups.com [mailto:juli...@googlegroups.com]
> On Behalf Of Jeff Bezanson
> Sent: Montag, 27. Februar 2012 23:17
> To: juli...@googlegroups.com
> Subject: Re: [julia-dev] Windows Port: "Basic Block in function 'fill!'
does not
> have terminator!"
>

Stefan Karpinski

unread,
Feb 28, 2012, 12:44:26 AM2/28/12
to juli...@googlegroups.com
Woah. That's a lot of work. I wrote that in the first place and it's highly non-trivial.
Reply all
Reply to author
Forward
0 new messages