[cfe-dev] Why clang needs to fork into itself?

Dimitry Andric dimitry at andric.com
Mon Jan 27 13:56:58 PST 2014


Unfortunately, it is also incredibly wasteful.  And lib/Support/Unix/Program.inc does not even use vfork(), which is at least a little lighter on system resources.

If I recall correctly, this point has already come up way in the past, but I cannot find the thread right now.  I do recall that some fixes were proposed, but got shot down due to various problems... :-/

-Dimitry

On 27 Jan 2014, at 22:41, Tomasz Mikolajczyk <tmmikolajczyk at gmail.com> wrote:

> I haven't see the code but potentially the purpose of forking is to
> handle internal compiler errors, especially the case when the child
> process crashes when processing an input code. That may be easily
> detected and handled properly by the parent process, by collecting the
> trace, logs and by encouraging user to fill an issue in the bug DB,
> etc.
> 
> On Mon, Jan 27, 2014 at 9:02 PM, Yuri <yuri at rawbw.com> wrote:
>> I noticed that even the simple command 'clang -c -emit-llvm c.cpp' calls
>> fork, and forks into itself.
>> Why does it need to do this? This would potentially complicate profiling,
>> debugging, etc. All tools should be fork-aware.
>> Also unnecessary operation must cause some performance hit.
>> 
>> It is understandable when compiler would, for example, fork into an external
>> macro preprocessor, or assembler, or linker, but why into itself?
>> 
>> Yuri
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140127/3c06d29b/attachment.sig>


More information about the cfe-dev mailing list