Review Request: Make temporary DUContext for default template parameters obsolete

Milian Wolff mail at milianw.de
Mon Oct 8 09:37:46 UTC 2012



> On Oct. 7, 2012, 5:51 p.m., David Nolden wrote:
> > languages/cpp/cppduchain/templatedeclaration.cpp, line 669
> > <http://git.reviewboard.kde.org/r/106757/diff/1/?file=88669#file88669line669>
> >
> >     You have to give PushValue a name, otherwise you have a no-op. ;-)

thanks, fixed.

regarding performance, I ran this in kdevplatform source dir:
time CLEAR_DUCHAIN_DIR=1 duchainify --threads=2 .

with patch:
real    2m27.023s
user    2m32.973s
sys     0m3.866s

real    2m28.571s
user    2m33.823s
sys     0m3.960s

without patch:
real    2m26.959s
user    2m31.673s
sys     0m3.776s

real    2m26.225s
user    2m29.280s
sys     0m3.733s

So yeah, it indeed looks to be a bit slower. I'll investigate in-depth later this week or so, but I think I'll commit to master first anyways as the impact is not too bad (and this is just a 'time' »benchmark« anyways).


- Milian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106757/#review20049
-----------------------------------------------------------


On Oct. 7, 2012, 4:50 p.m., Milian Wolff wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/106757/
> -----------------------------------------------------------
> 
> (Updated Oct. 7, 2012, 4:50 p.m.)
> 
> 
> Review request for KDevelop and David Nolden.
> 
> 
> Description
> -------
> 
> Use a thread-local QMultiHash<IndexedQualifiedIdentifier, IndexedType> lookup table to support default template parameters. This obsoletes the necessity of the temporary DUContext which may introduce instabilities as described in bug 297133.
> 
> One big caveat was cloning template declarations which contain an internal context. This resulted in both, the original and clone to reference the same internal context. Upon destruction of the clone, the ownership of the internal context was tried to be changed. This can crash, as it could happen while only holding a read lock, yet the referenced internal context is in the DUChain and thus must only be altered while holding a write lock.
> 
> This change also makes it possible to remove the code surrounding Declaration::clone and Declaration::clonePrivate, as this was the only places which actually used it. Considering the major pitfalls and caveats of this API, I say this is a very good thing.
> 
> Furthermore, while introducing the thread-local data, I fixed the two safety recursion counters: Previously they where shared between threads which does not make any sense when we want to count the recursion depth that is thread-specific.
> 
> 
> This addresses bug 297133.
>     http://bugs.kde.org/show_bug.cgi?id=297133
> 
> 
> Diffs
> -----
> 
>   languages/cpp/cppduchain/templatedeclaration.cpp e423693 
>   languages/cpp/cppduchain/templateparameterdeclaration.h 9fb44aa 
>   languages/cpp/cppduchain/templateparameterdeclaration.cpp 08b76bb 
> 
> Diff: http://git.reviewboard.kde.org/r/106757/diff/
> 
> 
> Testing
> -------
> 
> All existing unit tests pass. KDE Rocs and boost/proto/matches.hpp get parsed without crashing.
> 
> 
> Thanks,
> 
> Milian Wolff
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121008/39f27997/attachment.html>


More information about the KDevelop-devel mailing list