[cfe-dev] computed goto/labels as values in interpreters

Eli Friedman eli.friedman at gmail.com
Fri Aug 17 11:50:58 PDT 2012


On Fri, Aug 17, 2012 at 11:42 AM, Carsten Mattner
<carstenmattner at gmail.com> wrote:
> On Fri, Aug 17, 2012 at 7:40 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Fri, Aug 17, 2012 at 8:14 AM, Carsten Mattner
>> <carstenmattner at gmail.com> wrote:
>>> After searching list archives and bug reports I wasn't able to conclude
>>> whether computed goto/labels as values as used in Erlang and other (Guile)
>>> interpreters is supported in clang 3.1. With some BSDs working to make
>>> clang/clang++ the base cc/c++ this is going to be even more important.
>>>
>>> Is clang 3.1 supposed to compile beam_emu.c correctly and with the
>>> same or comparable optimization result?
>>>
>>> https://github.com/erlang/otp/blob/master/erts/emulator/beam/beam_emu.c
>>
>> Yes, it's supposed to.
>
> Yes, seems to work but with some interesting differences compared to
> gcc. While gcc-4.7 takes 6s to recompile Erlang's emulator if I
> 'touch beam_emu.c', clang takes 2m11s and consumes around 141MB RES vs
> 40MB gcc.

IIRC, there's been some work in this area since 3.1.  If you're still
seeing issues on trunk, please file a bug.

> Not sure why but clang also seemed to result in a longer
> time to run ar. Tests were conducted on i386 linux 3.5.1 with
> glibc-2.15 against erlang's maint branch. Next, a process which is
> known to be slow is building some of the generated C++ files in lib/wx
> (wxWidgets Erlang bindings). Now, when linking erl_gl.so with clang
> it took forever to finish (didn't time). This is similar to the ar
> archive step in erts/emulator. Is there anything inherently slow with
> gcc-4.7, glibc-2.15, and binutils-2.22? ar and ld from binutils at
> fault? While linking erl_gl.so RES of clang was at 265MB. It seemed
> to be an infinite loop and I stopped it after more than 5 minutes.

I'm not following this... linking shouldn't be spending any
substantial amount of time in the "clang" process.  clang just invokes
ld.

If you have a reproducible infinite loop, please file a bug.

-Eli



More information about the cfe-dev mailing list