|[eigen] MSVC inlining - just FYI|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] MSVC inlining - just FYI
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Thu, 17 Dec 2009 10:18:57 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=mJM/QASfMegdrDyfI2Ntvn7bPnz7HNgGvyb8ZdIbaUE=; b=aHd0jcXpsPJw3i8wF3BuuRjiSEVqCK9DyPHvEou5QdZklGCvxs56Fjdhlf6l2pW507 olmJ4wVkp3XgdaUBcN9Z4TpNVKqT2LTqS42LsYNN4/mOrod8rIOLUWvlGIB/eb206x65 crR6ahxz8T6QOBvFlLIB2urb8Oxl/yAccaQE0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=B+AowXgF1+jXozL/wAoLTINyex/PFvJgDDyT0Pr/ORz1MtRqi0t2rF8UwZgxaUIHZY 06OzMI5kla4h9Ady0MivjeykQjEIeSGDJYLnTiofozWHsTBF0iLsVTzeHES2ccQTeLrl uNVKsRbEtBLoZSMlNK+QP10Ld5jfXxfUIl8Do=
So, after some reading I was able to find out the following things I'ld quickly like to share.
There was a recent discussion regarding the inlining problem on comp.lang.c++.moderated
The problem which is affecting us is that MSVC does not inline functions returning an unwindable object (an object having a non-trivial destructor or an object having members with non-trivial destructors). Here is an example where the __forceinline is ignored unless exception handling is disabled.
template <typename T>
UnwindableTemplate() : m_data(0)
delete  m_data;
template <typename T>
__forceinline UnwindableTemplate<T> create_unwindable()
void main ()
UnwindableTemplate<float> unwind = create_unwindable<float>();
Here, I choose the unwindable object to mimik our ei_matrix_storage classes for the particular case when we are dealing with dynamic sized objects. As a consequence, this leads to the fact that functions returning expressions containing matrix members by value will not be inlined. Currently it seems as if this can not be remedied. Returning a reference to a local temporary seems tempting since we are anyways trying to enforce inlining but I would refrain from such a solution and say we just live with it.
It seems as if with newer compiler versions the SSE issue mentioned in the forum is fixed and not our actual problem.