[libcxx] r215740 - Revert "Turn off extern templates for most uses."

Justin Bogner mail at justinbogner.com
Sat Aug 16 01:42:28 PDT 2014


Eric Fiselier <eric at efcs.ca> writes:
> Hi Justin,
>
> I'm not quite sure we are should do that right now. 
> If your compiling with MSAN and you call a function in an extern
> template MSAN will fire. 

I don't think I understand what you mean here. Which function? Why does
msan fire?

> For example testing test/string with MSAN enabled causes 124 failures.
> Normally there are just 2.

If there are invalid memory accesses we should fix them. I don't see how
explicit template instantiations would cause memory errors though.

Are there bots that show this issue? How can I reproduce it?

> We could probably guard the _LIBCPP_EXTERN_TEMPLATE definition to
> check for MSAN but for now I don't think we are ready to re-enable
> external template definitions.
>
> /Eric
>
> On Fri, Aug 15, 2014 at 11:58 AM, Justin Bogner <mail at justinbogner.com> wrote:
>
>     Author: bogner
>     Date: Fri Aug 15 12:58:56 2014
>     New Revision: 215740
>    
>     URL: http://llvm.org/viewvc/llvm-project?rev=215740&view=rev
>     Log:
>     Revert "Turn off extern templates for most uses."
>    
>     Turning off explicit template instantiation leads to a pretty
>     significant build time and code size cost. We're better off dealing
>     with ABI incompatibility issues that come up in a less heavy handed
>     way.
>    
>     This reverts commit r189610.
>    
>     Modified:
>         libcxx/trunk/include/__config
>         libcxx/trunk/src/algorithm.cpp
>         libcxx/trunk/src/ios.cpp
>         libcxx/trunk/src/locale.cpp
>         libcxx/trunk/src/string.cpp
>         libcxx/trunk/src/valarray.cpp
>    
>     Modified: libcxx/trunk/include/__config
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev
>     =215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/include/__config (original)
>     +++ libcxx/trunk/include/__config Fri Aug 15 12:58:56 2014
>     @@ -608,7 +608,7 @@ template <unsigned> struct __static_asse
>      #endif
>    
>      #ifndef _LIBCPP_EXTERN_TEMPLATE
>     -#define _LIBCPP_EXTERN_TEMPLATE(...)
>     +#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>      #endif
>    
>      #ifndef _LIBCPP_EXTERN_TEMPLATE2
>    
>     Modified: libcxx/trunk/src/algorithm.cpp
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/algorithm.cpp?
>     rev=215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/src/algorithm.cpp (original)
>     +++ libcxx/trunk/src/algorithm.cpp Fri Aug 15 12:58:56 2014
>     @@ -7,7 +7,6 @@
>      //
>      //===
>     ----------------------------------------------------------------------===/
>     /
>    
>     -#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>      #include "algorithm"
>      #include "random"
>      #include "mutex"
>    
>     Modified: libcxx/trunk/src/ios.cpp
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/ios.cpp?rev=
>     215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/src/ios.cpp (original)
>     +++ libcxx/trunk/src/ios.cpp Fri Aug 15 12:58:56 2014
>     @@ -7,8 +7,6 @@
>      //
>      //===
>     ----------------------------------------------------------------------===/
>     /
>    
>     -#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>     -
>      #include "ios"
>      #include "streambuf"
>      #include "istream"
>    
>     Modified: libcxx/trunk/src/locale.cpp
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=
>     215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/src/locale.cpp (original)
>     +++ libcxx/trunk/src/locale.cpp Fri Aug 15 12:58:56 2014
>     @@ -7,8 +7,6 @@
>      //
>      //===
>     ----------------------------------------------------------------------===/
>     /
>    
>     -#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>     -
>      // On Solaris, we need to define something to make the C99 parts of
>     localeconv
>      // visible.
>      #ifdef __sun__
>    
>     Modified: libcxx/trunk/src/string.cpp
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=
>     215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/src/string.cpp (original)
>     +++ libcxx/trunk/src/string.cpp Fri Aug 15 12:58:56 2014
>     @@ -7,8 +7,6 @@
>      //
>      //===
>     ----------------------------------------------------------------------===/
>     /
>    
>     -#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>     -
>      #include "string"
>      #include "cstdlib"
>      #include "cwchar"
>    
>     Modified: libcxx/trunk/src/valarray.cpp
>     URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/valarray.cpp?rev
>     =215740&r1=215739&r2=215740&view=diff
>     ==========================================================================
>     ====
>     --- libcxx/trunk/src/valarray.cpp (original)
>     +++ libcxx/trunk/src/valarray.cpp Fri Aug 15 12:58:56 2014
>     @@ -7,8 +7,6 @@
>      //
>      //===
>     ----------------------------------------------------------------------===/
>     /
>    
>     -#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
>     -
>      #include "valarray"
>    
>      _LIBCPP_BEGIN_NAMESPACE_STD
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list