Force GC calls out of the straight line execution path

Harendra Kumar harendra.kumar at gmail.com
Mon Jun 13 13:34:20 UTC 2016


Hi Ömer,

I just checked and I do not see this behavior in 8.0.1 native code, it is
only seen in 7.10.3. So I guess this got fixed in 8.0.

How about the llvm generated code? Can we control this behavior for llvm
generated code as well? I first noticed this in llvm generated code with
ghc-7.10.3. I do not yet have llvm-3.7 installed to verify the same on
8.0.1.

-harendra

On 13 June 2016 at 18:04, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:

> Hi Harendra,
>
> Would it be possible for you to provide a minimal example that compiles to
> such
> assembly? It's hard to tell if this is an easy case.
>
> Also, just to make sure, you're using -O, right? (I'm not sure if we have a
> related transformation enabled with -O but just to make sure...)
>
> 2016-06-13 7:23 GMT-04:00 Harendra Kumar <harendra.kumar at gmail.com>:
> > Hi,
> >
> > I noticed in the generated code (llvm as well as native) that in some
> cases
> > the GC calls are in the straight path and the regular code is out of the
> > straight line path. Like this:
> >
> > => 0x408fc0:  lea    0x30(%r12),%rax
> > => 0x408fc5:  cmp    0x358(%r13),%rax
> > => 0x408fcc:  jbe    0x408fe9                   # notice jbe instead of
> ja
> > i.e. branch taken in normal case
> >
> > I tried to count in how many cases its happening in my executable and
> found
> > that its only a small percentage (4-6%) of cases but those cases include
> the
> > code which runs 99% of the time in my benchmark. Though it does not make
> a
> > whole lot of difference but the difference is perceptible and especially
> > when it is in a tight loop.
> >
> > Is it possible to somehow force all the GC calls out of the line during
> code
> > generation? Has it been thought/discussed before?
> >
> > -harendra
> >
> >
> >
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160613/aab95ab0/attachment.html>


More information about the ghc-devs mailing list