[PATCH] LibDriver, llvm-lib: introduce.

Rui Ueyama ruiu at google.com
Tue Jun 9 20:32:09 PDT 2015


I think you still need a lock for LLD, but I'd rather not edit that code.
Once the new COFF port is ready to use, that code will be deleted entirely,
so maybe you want to just leave it alone.

A few other comments on the patch.

- StringSaver does one thing, so it has only one function: save(). Does it
make sense to make the class to overload operator() so that we can call
Saver(S) instead of Saver.save(S)?

- "Pass a pointer if an object could be mutated" is my personal coding
style and not everybody does that in LLVM. Which do we
prefer, StringSaver(BumpPtrAllocator *Alloc)
or StringSaver(BumpPtrAllocator &Alloc) as a constructor's signature?

On Tue, Jun 9, 2015 at 5:43 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> > I tried doing something similar at one point. IIRC the main stumbling
> block
> > was a StringSaver that gets called under a lock in LLD for .drective,
> which
> > was hard to disentangle for some reason.
>
> I just noticed that.
>
> Rui, do you remember why the lock was needed? Isn't the allocation
> itself thread safe? Would it be sufficient to pass in an allocator
> that used a std::mutex in Allocate?
>
> I have attached the work in progress patches (builds and all tests pass).
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150609/0d617c45/attachment.html>


More information about the llvm-commits mailing list