diff options
Diffstat (limited to 'indra/llcommon')
271 files changed, 688 insertions, 281 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 5cce8ff2c4..c60fa45937 100644..100755 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories( ${EXPAT_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} + ${BREAKPAD_INCLUDE_DIRECTORIES} ) # add_executable(lltreeiterators lltreeiterators.cpp) @@ -121,6 +122,7 @@ set(llcommon_HEADER_FILES linden_common.h linked_lists.h llaccountingcost.h + llalignedarray.h llallocator.h llallocator_heap_profile.h llagentconstants.h @@ -236,6 +238,7 @@ set(llcommon_HEADER_FILES llstrider.h llstring.h llstringtable.h + llstaticstringtable.h llsys.h llthread.h llthreadsafequeue.h @@ -246,7 +249,6 @@ set(llcommon_HEADER_FILES lluuid.h lluuidhashmap.h llversionserver.h - llversionviewer.h llworkerthread.h ll_template_cast.h metaclass.h diff --git a/indra/llcommon/bitpack.cpp b/indra/llcommon/bitpack.cpp index cdcaba0765..cdcaba0765 100644..100755 --- a/indra/llcommon/bitpack.cpp +++ b/indra/llcommon/bitpack.cpp diff --git a/indra/llcommon/bitpack.h b/indra/llcommon/bitpack.h index 037300dd14..037300dd14 100644..100755 --- a/indra/llcommon/bitpack.h +++ b/indra/llcommon/bitpack.h diff --git a/indra/llcommon/ctype_workaround.h b/indra/llcommon/ctype_workaround.h index 552be9fb90..552be9fb90 100644..100755 --- a/indra/llcommon/ctype_workaround.h +++ b/indra/llcommon/ctype_workaround.h diff --git a/indra/llcommon/doublelinkedlist.h b/indra/llcommon/doublelinkedlist.h index 0aeaa69df3..0aeaa69df3 100644..100755 --- a/indra/llcommon/doublelinkedlist.h +++ b/indra/llcommon/doublelinkedlist.h diff --git a/indra/llcommon/fix_macros.h b/indra/llcommon/fix_macros.h index ef959decff..ef959decff 100644..100755 --- a/indra/llcommon/fix_macros.h +++ b/indra/llcommon/fix_macros.h diff --git a/indra/llcommon/imageids.cpp b/indra/llcommon/imageids.cpp index 7d647e5c36..7d647e5c36 100644..100755 --- a/indra/llcommon/imageids.cpp +++ b/indra/llcommon/imageids.cpp diff --git a/indra/llcommon/imageids.h b/indra/llcommon/imageids.h index 18c8ecb074..18c8ecb074 100644..100755 --- a/indra/llcommon/imageids.h +++ b/indra/llcommon/imageids.h diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index d32ae6c041..d32ae6c041 100644..100755 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 0da83720bd..0da83720bd 100644..100755 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h diff --git a/indra/llcommon/is_approx_equal_fraction.h b/indra/llcommon/is_approx_equal_fraction.h index 4a9b2e2725..4a9b2e2725 100644..100755 --- a/indra/llcommon/is_approx_equal_fraction.h +++ b/indra/llcommon/is_approx_equal_fraction.h diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index 5cfcdab41c..5cfcdab41c 100644..100755 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h diff --git a/indra/llcommon/linked_lists.h b/indra/llcommon/linked_lists.h index 6b25295b7b..6b25295b7b 100644..100755 --- a/indra/llcommon/linked_lists.h +++ b/indra/llcommon/linked_lists.h diff --git a/indra/llcommon/ll_template_cast.h b/indra/llcommon/ll_template_cast.h index c8f9a2f7eb..c8f9a2f7eb 100644..100755 --- a/indra/llcommon/ll_template_cast.h +++ b/indra/llcommon/ll_template_cast.h diff --git a/indra/llcommon/llaccountingcost.h b/indra/llcommon/llaccountingcost.h index 0ef3b50c6d..0ef3b50c6d 100644..100755 --- a/indra/llcommon/llaccountingcost.h +++ b/indra/llcommon/llaccountingcost.h diff --git a/indra/llcommon/llagentconstants.h b/indra/llcommon/llagentconstants.h index cd237da4eb..cd237da4eb 100644..100755 --- a/indra/llcommon/llagentconstants.h +++ b/indra/llcommon/llagentconstants.h diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h new file mode 100644 index 0000000000..ed8fd31205 --- /dev/null +++ b/indra/llcommon/llalignedarray.h @@ -0,0 +1,139 @@ +/** + * @file llalignedarray.h + * @brief A static array which obeys alignment restrictions and mimics std::vector accessors. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLALIGNEDARRAY_H +#define LL_LLALIGNEDARRAY_H + +#include "llmemory.h" + +template <class T, U32 alignment> +class LLAlignedArray +{ +public: + T* mArray; + U32 mElementCount; + U32 mCapacity; + + LLAlignedArray(); + ~LLAlignedArray(); + + void push_back(const T& elem); + U32 size() const { return mElementCount; } + void resize(U32 size); + T* append(S32 N); + T& operator[](int idx); + const T& operator[](int idx) const; +}; + +template <class T, U32 alignment> +LLAlignedArray<T, alignment>::LLAlignedArray() +{ + llassert(alignment >= 16); + mArray = NULL; + mElementCount = 0; + mCapacity = 0; +} + +template <class T, U32 alignment> +LLAlignedArray<T, alignment>::~LLAlignedArray() +{ + ll_aligned_free(mArray); + mArray = NULL; + mElementCount = 0; + mCapacity = 0; +} + +template <class T, U32 alignment> +void LLAlignedArray<T, alignment>::push_back(const T& elem) +{ + T* old_buf = NULL; + if (mCapacity <= mElementCount) + { + mCapacity++; + mCapacity *= 2; + T* new_buf = (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment); + if (mArray) + { + ll_memcpy_nonaliased_aligned_16((char*)new_buf, (char*)mArray, sizeof(T)*mElementCount); + } + old_buf = mArray; + mArray = new_buf; + } + + mArray[mElementCount++] = elem; + + //delete old array here to prevent error on a.push_back(a[0]) + ll_aligned_free(old_buf); +} + +template <class T, U32 alignment> +void LLAlignedArray<T, alignment>::resize(U32 size) +{ + if (mCapacity < size) + { + mCapacity = size+mCapacity*2; + T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment) : NULL; + if (mArray) + { + ll_memcpy_nonaliased_aligned_16((char*) new_buf, (char*) mArray, sizeof(T)*mElementCount); + ll_aligned_free(mArray); + } + + /*for (U32 i = mElementCount; i < mCapacity; ++i) + { + new(new_buf+i) T(); + }*/ + mArray = new_buf; + } + + mElementCount = size; +} + + +template <class T, U32 alignment> +T& LLAlignedArray<T, alignment>::operator[](int idx) +{ + llassert(idx < mElementCount); + return mArray[idx]; +} + +template <class T, U32 alignment> +const T& LLAlignedArray<T, alignment>::operator[](int idx) const +{ + llassert(idx < mElementCount); + return mArray[idx]; +} + +template <class T, U32 alignment> +T* LLAlignedArray<T, alignment>::append(S32 N) +{ + U32 sz = size(); + resize(sz+N); + return &((*this)[sz]); +} + +#endif + diff --git a/indra/llcommon/llallocator.cpp b/indra/llcommon/llallocator.cpp index 34fc28d8cc..34fc28d8cc 100644..100755 --- a/indra/llcommon/llallocator.cpp +++ b/indra/llcommon/llallocator.cpp diff --git a/indra/llcommon/llallocator.h b/indra/llcommon/llallocator.h index d26ad73c5b..d26ad73c5b 100644..100755 --- a/indra/llcommon/llallocator.h +++ b/indra/llcommon/llallocator.h diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp index b574ef668b..b574ef668b 100644..100755 --- a/indra/llcommon/llallocator_heap_profile.cpp +++ b/indra/llcommon/llallocator_heap_profile.cpp diff --git a/indra/llcommon/llallocator_heap_profile.h b/indra/llcommon/llallocator_heap_profile.h index 69300b829b..69300b829b 100644..100755 --- a/indra/llcommon/llallocator_heap_profile.h +++ b/indra/llcommon/llallocator_heap_profile.h diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index ca258900c7..c6da205815 100644..100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -69,10 +69,16 @@ bool windows_post_minidump_callback(const wchar_t* dump_path, void setup_signals(); void default_unix_signal_handler(int signum, siginfo_t *info, void *); +#if LL_LINUX +#include "google_breakpad/minidump_descriptor.h" +bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded); +#else // Called by breakpad exception handler after the minidump has been generated. bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded); +#endif + # if LL_DARWIN /* OSX doesn't support SIGRT* */ S32 LL_SMACKDOWN_SIGNAL = SIGUSR1; @@ -313,7 +319,7 @@ void LLApp::setupErrorHandling() // Add google breakpad exception handler configured for Darwin/Linux. bool installHandler = true; -#ifdef LL_DARWIN +#if LL_DARWIN // For the special case of Darwin, we do not want to install the handler if // the process is being debugged as the app will exit with value ABRT (6) if // we do. Unfortunately, the code below which performs that test relies on @@ -346,14 +352,21 @@ void LLApp::setupErrorHandling() installHandler = true; } #endif -#endif + if(installHandler && (mExceptionHandler == 0)) { std::string dumpPath = "/tmp/"; - mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true); + mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, 0); + } +#elif LL_LINUX + if(installHandler && (mExceptionHandler == 0)) + { + google_breakpad::MinidumpDescriptor desc("/tmp"); + new google_breakpad::ExceptionHandler(desc, 0, &unix_minidump_callback, 0, true, 0); } #endif +#endif startErrorThread(); } @@ -410,6 +423,9 @@ void LLApp::setMiniDumpDir(const std::string &path) wchar_t buffer[MAX_MINDUMP_PATH_LENGTH]; mbstowcs(buffer, path.c_str(), MAX_MINDUMP_PATH_LENGTH); mExceptionHandler->set_dump_path(std::wstring(buffer)); +#elif LL_LINUX + google_breakpad::MinidumpDescriptor desc(path); + mExceptionHandler->set_minidump_descriptor(desc); #else mExceptionHandler->set_dump_path(path); #endif @@ -857,6 +873,43 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) } } +#if LL_LINUX +bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded) +{ + // Copy minidump file path into fixed buffer in the app instance to avoid + // heap allocations in a crash handler. + + // path format: <dump_dir>/<minidump_id>.dmp + int dirPathLength = strlen(minidump_desc.path()); + + // The path must not be truncated. + llassert((dirPathLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH); + + char * path = LLApp::instance()->getMiniDumpFilename(); + S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; + strncpy(path, minidump_desc.path(), remaining); + remaining -= dirPathLength; + path += dirPathLength; + if (remaining > 0 && dirPathLength > 0 && path[-1] != '/') + { + *path++ = '/'; + --remaining; + } + + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + LLApp::runErrorHandler(); + +#ifndef LL_RELEASE_FOR_DOWNLOAD + clear_signals(); + return false; +#else + return true; +#endif + +} +#endif + + bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index a536a06ea5..afa06df23e 100644..100755 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -38,7 +38,7 @@ typedef LLAtomic32<U32> LLAtomicU32; class LLErrorThread; class LLLiveFile; #if LL_LINUX -typedef struct siginfo siginfo_t; +#include <signal.h> #endif typedef void (*LLAppErrorHandler)(); diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index d1c44c9403..d1c44c9403 100644..100755 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 034546c3f3..1fe7d98472 100644..100755 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -164,14 +164,20 @@ public: ~LLAtomic32<Type>() {}; operator const Type() { apr_uint32_t data = apr_atomic_read32(&mData); return Type(data); } + + Type CurrentValue() const { apr_uint32_t data = apr_atomic_read32(const_cast< volatile apr_uint32_t* >(&mData)); return Type(data); } + Type operator =(const Type& x) { apr_atomic_set32(&mData, apr_uint32_t(x)); return Type(mData); } void operator -=(Type x) { apr_atomic_sub32(&mData, apr_uint32_t(x)); } void operator +=(Type x) { apr_atomic_add32(&mData, apr_uint32_t(x)); } Type operator ++(int) { return apr_atomic_inc32(&mData); } // Type++ Type operator --(int) { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise) + + Type operator ++() { return apr_atomic_inc32(&mData); } // Type++ + Type operator --() { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise) private: - apr_uint32_t mData; + volatile apr_uint32_t mData; }; typedef LLAtomic32<U32> LLAtomicU32; @@ -182,8 +188,10 @@ typedef LLAtomic32<S32> LLAtomicS32; // abbreviated flags #define LL_APR_R (APR_READ) // "r" #define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w" +#define LL_APR_A (APR_CREATE|APR_WRITE|APR_APPEND) // "w" #define LL_APR_RB (APR_READ|APR_BINARY) // "rb" #define LL_APR_WB (APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY) // "wb" +#define LL_APR_AB (APR_CREATE|APR_WRITE|APR_BINARY|APR_APPEND) #define LL_APR_RPB (APR_READ|APR_WRITE|APR_BINARY) // "r+b" #define LL_APR_WPB (APR_CREATE|APR_TRUNCATE|APR_READ|APR_WRITE|APR_BINARY) // "w+b" diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 5ae2df3994..5ae2df3994 100644..100755 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 69b01731e5..69b01731e5 100644..100755 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h diff --git a/indra/llcommon/llassoclist.h b/indra/llcommon/llassoclist.h index 2950504155..2950504155 100644..100755 --- a/indra/llcommon/llassoclist.h +++ b/indra/llcommon/llassoclist.h diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h index f47f447b45..f47f447b45 100644..100755 --- a/indra/llcommon/llavatarconstants.h +++ b/indra/llcommon/llavatarconstants.h diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 642bd82e90..642bd82e90 100644..100755 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 7542a8dece..7542a8dece 100644..100755 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h diff --git a/indra/llcommon/llbase32.cpp b/indra/llcommon/llbase32.cpp index 053ac0d32f..053ac0d32f 100644..100755 --- a/indra/llcommon/llbase32.cpp +++ b/indra/llcommon/llbase32.cpp diff --git a/indra/llcommon/llbase32.h b/indra/llcommon/llbase32.h index eeb96d789d..eeb96d789d 100644..100755 --- a/indra/llcommon/llbase32.h +++ b/indra/llcommon/llbase32.h diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index 4e82cf7f20..4e82cf7f20 100644..100755 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp diff --git a/indra/llcommon/llbase64.h b/indra/llcommon/llbase64.h index 16d2c217d0..16d2c217d0 100644..100755 --- a/indra/llcommon/llbase64.h +++ b/indra/llcommon/llbase64.h diff --git a/indra/llcommon/llboost.h b/indra/llcommon/llboost.h index 57d958a51a..57d958a51a 100644..100755 --- a/indra/llcommon/llboost.h +++ b/indra/llcommon/llboost.h diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index f5b242fdfc..f5b242fdfc 100644..100755 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h diff --git a/indra/llcommon/llclickaction.h b/indra/llcommon/llclickaction.h index 1f87d8eec3..1f87d8eec3 100644..100755 --- a/indra/llcommon/llclickaction.h +++ b/indra/llcommon/llclickaction.h diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp index 8be9e4f4de..b938b0e65a 100644..100755 --- a/indra/llcommon/llcommon.cpp +++ b/indra/llcommon/llcommon.cpp @@ -44,6 +44,7 @@ void LLCommon::initClass() } LLTimer::initClass(); LLThreadSafeRefCount::initThreadSafeRefCount(); + assert_main_thread(); // Make sure we record the main thread // LLWorkerThread::initClass(); // LLFrameCallbackManager::initClass(); } diff --git a/indra/llcommon/llcommon.h b/indra/llcommon/llcommon.h index ca9cad5d05..ca9cad5d05 100644..100755 --- a/indra/llcommon/llcommon.h +++ b/indra/llcommon/llcommon.h diff --git a/indra/llcommon/llcommonutils.cpp b/indra/llcommon/llcommonutils.cpp index d82554c202..d82554c202 100644..100755 --- a/indra/llcommon/llcommonutils.cpp +++ b/indra/llcommon/llcommonutils.cpp diff --git a/indra/llcommon/llcommonutils.h b/indra/llcommon/llcommonutils.h index 755dc41fb4..755dc41fb4 100644..100755 --- a/indra/llcommon/llcommonutils.h +++ b/indra/llcommon/llcommonutils.h diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 0b5829eb7e..9122704306 100644..100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -115,7 +115,7 @@ std::string LLCoros::getNameByID(const void* self_id) const // passed to us comes. for (CoroMap::const_iterator mi(mCoros.begin()), mend(mCoros.end()); mi != mend; ++mi) { - namespace coro_private = boost::coroutines::detail; + namespace coro_private = boost::dcoroutines::detail; if (static_cast<void*>(coro_private::coroutine_accessor::get_impl(const_cast<coro&>(*mi->second)).get()) == self_id) { diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index d75f28ec1a..03df406b68 100644..100755 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -29,7 +29,7 @@ #if ! defined(LL_LLCOROS_H) #define LL_LLCOROS_H -#include <boost/coroutine/coroutine.hpp> +#include <boost/dcoroutine/coroutine.hpp> #include "llsingleton.h" #include <boost/ptr_container/ptr_map.hpp> #include <string> @@ -78,8 +78,8 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros> { public: - /// Canonical boost::coroutines::coroutine signature we use - typedef boost::coroutines::coroutine<void()> coro; + /// Canonical boost::dcoroutines::coroutine signature we use + typedef boost::dcoroutines::coroutine<void()> coro; /// Canonical 'self' type typedef coro::self self; diff --git a/indra/llcommon/llcrc.cpp b/indra/llcommon/llcrc.cpp index e80da0bb0d..e80da0bb0d 100644..100755 --- a/indra/llcommon/llcrc.cpp +++ b/indra/llcommon/llcrc.cpp diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h index 2d291d92a1..2d291d92a1 100644..100755 --- a/indra/llcommon/llcrc.h +++ b/indra/llcommon/llcrc.h diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp index 87d79b1ee0..49aac9ce75 100644..100755 --- a/indra/llcommon/llcriticaldamp.cpp +++ b/indra/llcommon/llcriticaldamp.cpp @@ -87,3 +87,4 @@ F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache) return interpolant; } + diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h index 52f052ae25..52f052ae25 100644..100755 --- a/indra/llcommon/llcriticaldamp.h +++ b/indra/llcommon/llcriticaldamp.h diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llcommon/llcursortypes.cpp index ec60097195..ec60097195 100644..100755 --- a/indra/llcommon/llcursortypes.cpp +++ b/indra/llcommon/llcursortypes.cpp diff --git a/indra/llcommon/llcursortypes.h b/indra/llcommon/llcursortypes.h index cb6d6636a0..cb6d6636a0 100644..100755 --- a/indra/llcommon/llcursortypes.h +++ b/indra/llcommon/llcursortypes.h diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h index 131b819c99..131b819c99 100644..100755 --- a/indra/llcommon/lldarray.h +++ b/indra/llcommon/lldarray.h diff --git a/indra/llcommon/lldarrayptr.h b/indra/llcommon/lldarrayptr.h index c9a0b204d1..c9a0b204d1 100644..100755 --- a/indra/llcommon/lldarrayptr.h +++ b/indra/llcommon/lldarrayptr.h diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 030ef6a3c7..030ef6a3c7 100644..100755 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 7ff8b550ad..7ff8b550ad 100644..100755 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 5a4b8325f4..5a4b8325f4 100644..100755 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h diff --git a/indra/llcommon/lldeleteutils.h b/indra/llcommon/lldeleteutils.h index f250dc3028..f250dc3028 100644..100755 --- a/indra/llcommon/lldeleteutils.h +++ b/indra/llcommon/lldeleteutils.h diff --git a/indra/llcommon/lldependencies.cpp b/indra/llcommon/lldependencies.cpp index 0e72c175cb..0e72c175cb 100644..100755 --- a/indra/llcommon/lldependencies.cpp +++ b/indra/llcommon/lldependencies.cpp diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index e0294e271b..e0294e271b 100644..100755 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h diff --git a/indra/llcommon/lldepthstack.h b/indra/llcommon/lldepthstack.h index d9db54efc7..d9db54efc7 100644..100755 --- a/indra/llcommon/lldepthstack.h +++ b/indra/llcommon/lldepthstack.h diff --git a/indra/llcommon/lldictionary.cpp b/indra/llcommon/lldictionary.cpp index e16c35ed6a..e16c35ed6a 100644..100755 --- a/indra/llcommon/lldictionary.cpp +++ b/indra/llcommon/lldictionary.cpp diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h index c752859a36..c752859a36 100644..100755 --- a/indra/llcommon/lldictionary.h +++ b/indra/llcommon/lldictionary.h diff --git a/indra/llcommon/lldlinked.h b/indra/llcommon/lldlinked.h index 3f7c197be7..3f7c197be7 100644..100755 --- a/indra/llcommon/lldlinked.h +++ b/indra/llcommon/lldlinked.h diff --git a/indra/llcommon/lldoubledispatch.h b/indra/llcommon/lldoubledispatch.h index 8ed295b6f1..8ed295b6f1 100644..100755 --- a/indra/llcommon/lldoubledispatch.h +++ b/indra/llcommon/lldoubledispatch.h diff --git a/indra/llcommon/lldqueueptr.h b/indra/llcommon/lldqueueptr.h index 9fe08191e1..9fe08191e1 100644..100755 --- a/indra/llcommon/lldqueueptr.h +++ b/indra/llcommon/lldqueueptr.h diff --git a/indra/llcommon/llendianswizzle.h b/indra/llcommon/llendianswizzle.h index 4c08074a9c..4c08074a9c 100644..100755 --- a/indra/llcommon/llendianswizzle.h +++ b/indra/llcommon/llendianswizzle.h diff --git a/indra/llcommon/llenum.h b/indra/llcommon/llenum.h index f57b2bc0b5..f57b2bc0b5 100644..100755 --- a/indra/llcommon/llenum.h +++ b/indra/llcommon/llenum.h diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 9b0141eb76..9b0141eb76 100644..100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index b65b410153..b65b410153 100644..100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 480654b1a2..480654b1a2 100644..100755 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 37cee579cd..37cee579cd 100644..100755 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index 950fcd6e83..950fcd6e83 100644..100755 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp diff --git a/indra/llcommon/llerrorthread.h b/indra/llcommon/llerrorthread.h index 474cef3a50..474cef3a50 100644..100755 --- a/indra/llcommon/llerrorthread.h +++ b/indra/llcommon/llerrorthread.h diff --git a/indra/llcommon/llevent.cpp b/indra/llcommon/llevent.cpp index 633df01588..633df01588 100644..100755 --- a/indra/llcommon/llevent.cpp +++ b/indra/llcommon/llevent.cpp diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h index 8cd682b8bf..8cd682b8bf 100644..100755 --- a/indra/llcommon/llevent.h +++ b/indra/llcommon/llevent.h diff --git a/indra/llcommon/lleventapi.cpp b/indra/llcommon/lleventapi.cpp index ff5459c1eb..ff5459c1eb 100644..100755 --- a/indra/llcommon/lleventapi.cpp +++ b/indra/llcommon/lleventapi.cpp diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h index 1a37d780b6..5991fe8fd5 100644..100755 --- a/indra/llcommon/lleventapi.h +++ b/indra/llcommon/lleventapi.h @@ -47,6 +47,7 @@ class LL_COMMON_API LLEventAPI: public LLDispatchListener, typedef LLInstanceTracker<LLEventAPI, std::string> ibase; public: + /** * @param name LLEventPump name on which this LLEventAPI will listen. This * also serves as the LLInstanceTracker instance key. diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 81cc33fbba..81cc33fbba 100644..100755 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index 88a5e6ec74..a42af63b65 100644..100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -29,8 +29,8 @@ #if ! defined(LL_LLEVENTCORO_H) #define LL_LLEVENTCORO_H -#include <boost/coroutine/coroutine.hpp> -#include <boost/coroutine/future.hpp> +#include <boost/dcoroutine/coroutine.hpp> +#include <boost/dcoroutine/future.hpp> #include <boost/optional.hpp> #include <string> #include <stdexcept> @@ -206,13 +206,13 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD()) { // declare the future - boost::coroutines::future<LLSD> future(self); + boost::dcoroutines::future<LLSD> future(self); // make a callback that will assign a value to the future, and listen on // the specified LLEventPump with that callback std::string listenerName(LLEventDetail::listenerNameForCoro(self)); LLTempBoundListener connection( replyPump.getPump().listen(listenerName, - voidlistener(boost::coroutines::make_callback(future)))); + voidlistener(boost::dcoroutines::make_callback(future)))); // skip the "post" part if requestPump is default-constructed if (requestPump) { @@ -257,7 +257,7 @@ namespace LLEventDetail * This helper is specifically for the two-pump version of waitForEventOn(). * We use a single future object, but we want to listen on two pumps with it. * Since we must still adapt from (the callable constructed by) - * boost::coroutines::make_callback() (void return) to provide an event + * boost::dcoroutines::make_callback() (void return) to provide an event * listener (bool return), we've adapted LLVoidListener for the purpose. The * basic idea is that we construct a distinct instance of WaitForEventOnHelper * -- binding different instance data -- for each of the pumps. Then, when a @@ -331,16 +331,16 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event, const LLSD& replyPump1NamePath=LLSD()) { // declare the future - boost::coroutines::future<LLEventWithID> future(self); + boost::dcoroutines::future<LLEventWithID> future(self); // either callback will assign a value to this future; listen on // each specified LLEventPump with a callback std::string name(LLEventDetail::listenerNameForCoro(self)); LLTempBoundListener connection0( replyPump0.getPump().listen(name + "a", - LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 0))); + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 0))); LLTempBoundListener connection1( replyPump1.getPump().listen(name + "b", - LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 1))); + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 1))); // skip the "post" part if requestPump is default-constructed if (requestPump) { diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp index 5b6d4efbe9..5b6d4efbe9 100644..100755 --- a/indra/llcommon/lleventdispatcher.cpp +++ b/indra/llcommon/lleventdispatcher.cpp diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 7acc61de4e..7acc61de4e 100644..100755 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h diff --git a/indra/llcommon/lleventemitter.h b/indra/llcommon/lleventemitter.h index cd82fc56f9..cd82fc56f9 100644..100755 --- a/indra/llcommon/lleventemitter.h +++ b/indra/llcommon/lleventemitter.h diff --git a/indra/llcommon/lleventfilter.cpp b/indra/llcommon/lleventfilter.cpp index d36a107254..d36a107254 100644..100755 --- a/indra/llcommon/lleventfilter.cpp +++ b/indra/llcommon/lleventfilter.cpp diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h index e822a664f5..e822a664f5 100644..100755 --- a/indra/llcommon/lleventfilter.h +++ b/indra/llcommon/lleventfilter.h diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 0855180dcd..0855180dcd 100644..100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 65b0fef354..65b0fef354 100644..100755 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h diff --git a/indra/llcommon/lleventtimer.cpp b/indra/llcommon/lleventtimer.cpp index 0d96e03da4..0d96e03da4 100644..100755 --- a/indra/llcommon/lleventtimer.cpp +++ b/indra/llcommon/lleventtimer.cpp diff --git a/indra/llcommon/lleventtimer.h b/indra/llcommon/lleventtimer.h index 7f42623d01..dc918121e1 100644..100755 --- a/indra/llcommon/lleventtimer.h +++ b/indra/llcommon/lleventtimer.h @@ -36,6 +36,7 @@ class LL_COMMON_API LLEventTimer : public LLInstanceTracker<LLEventTimer> { public: + LLEventTimer(F32 period); // period is the amount of time between each call to tick() in seconds LLEventTimer(const LLDate& time); virtual ~LLEventTimer(); diff --git a/indra/llcommon/llextendedstatus.h b/indra/llcommon/llextendedstatus.h index 8ce173d1ff..8ce173d1ff 100644..100755 --- a/indra/llcommon/llextendedstatus.h +++ b/indra/llcommon/llextendedstatus.h diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 9b15804e97..51a9441cd5 100644..100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -107,17 +107,13 @@ class NamedTimerFactory : public LLSingleton<NamedTimerFactory> { public: NamedTimerFactory() - : mTimerRoot(NULL) - {} - - /*virtual */ void initSingleton() + : mTimerRoot(new LLFastTimer::NamedTimer("root")) { - mTimerRoot = new LLFastTimer::NamedTimer("root"); mRootFrameState.setNamedTimer(mTimerRoot); mTimerRoot->setFrameState(&mRootFrameState); mTimerRoot->mParent = mTimerRoot; mTimerRoot->setCollapsed(false); - mRootFrameState.mParent = &mRootFrameState; + mRootFrameState.mParent = &mRootFrameState; } ~NamedTimerFactory() diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 81c4b78775..a99a1d88af 100644..100755 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -139,10 +139,11 @@ public: // used to statically declare a new named timer class LL_COMMON_API DeclareTimer - : public LLInstanceTracker<DeclareTimer> + : public LLInstanceTracker< DeclareTimer > { friend class LLFastTimer; public: + DeclareTimer(const std::string& name, bool open); DeclareTimer(const std::string& name); diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 864b6e6975..864b6e6975 100644..100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index 9d70db96ea..9d70db96ea 100644..100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index cd7c0c7c09..cd7c0c7c09 100644..100755 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp diff --git a/indra/llcommon/llfindlocale.h b/indra/llcommon/llfindlocale.h index 6770db5774..6770db5774 100644..100755 --- a/indra/llcommon/llfindlocale.h +++ b/indra/llcommon/llfindlocale.h diff --git a/indra/llcommon/llfixedbuffer.cpp b/indra/llcommon/llfixedbuffer.cpp index d394f179fb..d394f179fb 100644..100755 --- a/indra/llcommon/llfixedbuffer.cpp +++ b/indra/llcommon/llfixedbuffer.cpp diff --git a/indra/llcommon/llfixedbuffer.h b/indra/llcommon/llfixedbuffer.h index 554cf48a4c..554cf48a4c 100644..100755 --- a/indra/llcommon/llfixedbuffer.h +++ b/indra/llcommon/llfixedbuffer.h diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp index f6d0f5bce8..f6d0f5bce8 100644..100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llcommon/llfoldertype.cpp diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h index a0c847914f..a0c847914f 100755..100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h diff --git a/indra/llcommon/llformat.cpp b/indra/llcommon/llformat.cpp index 3b2b3038ea..3b2b3038ea 100644..100755 --- a/indra/llcommon/llformat.cpp +++ b/indra/llcommon/llformat.cpp diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h index a4ec5e01de..a4ec5e01de 100644..100755 --- a/indra/llcommon/llformat.h +++ b/indra/llcommon/llformat.h diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index ec64195b21..ec64195b21 100644..100755 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 45754f3785..45754f3785 100644..100755 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h diff --git a/indra/llcommon/llhandle.h b/indra/llcommon/llhandle.h index 401e4d759a..401e4d759a 100644..100755 --- a/indra/llcommon/llhandle.h +++ b/indra/llcommon/llhandle.h diff --git a/indra/llcommon/llhash.h b/indra/llcommon/llhash.h index c077ebe93f..c077ebe93f 100644..100755 --- a/indra/llcommon/llhash.h +++ b/indra/llcommon/llhash.h diff --git a/indra/llcommon/llheartbeat.cpp b/indra/llcommon/llheartbeat.cpp index 18a0c489bd..18a0c489bd 100644..100755 --- a/indra/llcommon/llheartbeat.cpp +++ b/indra/llcommon/llheartbeat.cpp diff --git a/indra/llcommon/llheartbeat.h b/indra/llcommon/llheartbeat.h index 4a75fcc103..4a75fcc103 100644..100755 --- a/indra/llcommon/llheartbeat.h +++ b/indra/llcommon/llheartbeat.h diff --git a/indra/llcommon/llhttpstatuscodes.h b/indra/llcommon/llhttpstatuscodes.h index 0173461dad..0173461dad 100644..100755 --- a/indra/llcommon/llhttpstatuscodes.h +++ b/indra/llcommon/llhttpstatuscodes.h diff --git a/indra/llcommon/llindexedqueue.h b/indra/llcommon/llindexedqueue.h index aa2675d87d..aa2675d87d 100644..100755 --- a/indra/llcommon/llindexedqueue.h +++ b/indra/llcommon/llindexedqueue.h diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 89c831d296..89c831d296 100644..100755 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index ae836645b9..ae836645b9 100644..100755 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h diff --git a/indra/llcommon/llinstancetracker.cpp b/indra/llcommon/llinstancetracker.cpp index 5dc3ea5d7b..64a313b5ff 100644..100755 --- a/indra/llcommon/llinstancetracker.cpp +++ b/indra/llcommon/llinstancetracker.cpp @@ -32,18 +32,3 @@ // external library headers // other Linden headers -//static -void * & LLInstanceTrackerBase::getInstances(std::type_info const & info) -{ - typedef std::map<std::string, void *> InstancesMap; - static InstancesMap instances; - - // std::map::insert() is just what we want here. You attempt to insert a - // (key, value) pair. If the specified key doesn't yet exist, it inserts - // the pair and returns a std::pair of (iterator, true). If the specified - // key DOES exist, insert() simply returns (iterator, false). One lookup - // handles both cases. - return instances.insert(InstancesMap::value_type(info.name(), - InstancesMap::mapped_type())) - .first->second; -} diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 1eab270e3c..361182380a 100644..100755 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -46,21 +46,7 @@ class LL_COMMON_API LLInstanceTrackerBase { protected: - /// Get a process-unique void* pointer slot for the specified type_info - static void * & getInstances(std::type_info const & info); - /// Find or create a STATICDATA instance for the specified TRACKED class. - /// STATICDATA must be default-constructible. - template<typename STATICDATA, class TRACKED> - static STATICDATA& getStatic() - { - void *& instances = getInstances(typeid(TRACKED)); - if (! instances) - { - instances = new STATICDATA; - } - return *static_cast<STATICDATA*>(instances); - } /// It's not essential to derive your STATICDATA (for use with /// getStatic()) from StaticBase; it's just that both known @@ -74,6 +60,8 @@ protected: }; }; +LL_COMMON_API void assert_main_thread(); + /// This mix-in class adds support for tracking all instances of the specified class parameter T /// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup /// If KEY is not provided, then instances are stored in a simple set @@ -81,14 +69,18 @@ protected: template<typename T, typename KEY = T*> class LLInstanceTracker : public LLInstanceTrackerBase { - typedef LLInstanceTracker<T, KEY> MyT; + typedef LLInstanceTracker<T, KEY> self_t; typedef typename std::map<KEY, T*> InstanceMap; struct StaticData: public StaticBase { InstanceMap sMap; }; - static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); } - static InstanceMap& getMap_() { return getStatic().sMap; } + static StaticData& getStatic() { static StaticData sData; return sData;} + static InstanceMap& getMap_() + { + // assert_main_thread(); fwiw this class is not thread safe, and it used by multiple threads. Bad things happen. + return getStatic().sMap; + } public: class instance_iter : public boost::iterator_facade<instance_iter, T, boost::forward_traversal_tag> @@ -232,13 +224,13 @@ private: template<typename T> class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase { - typedef LLInstanceTracker<T, T*> MyT; + typedef LLInstanceTracker<T, T*> self_t; typedef typename std::set<T*> InstanceSet; struct StaticData: public StaticBase { InstanceSet sSet; }; - static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); } + static StaticData& getStatic() { static StaticData sData; return sData; } static InstanceSet& getSet_() { return getStatic().sSet; } public: diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h index 1f576cc19e..1f576cc19e 100644..100755 --- a/indra/llcommon/llkeythrottle.h +++ b/indra/llcommon/llkeythrottle.h diff --git a/indra/llcommon/llkeyusetracker.h b/indra/llcommon/llkeyusetracker.h index 1fb222dd40..1fb222dd40 100644..100755 --- a/indra/llcommon/llkeyusetracker.h +++ b/indra/llcommon/llkeyusetracker.h diff --git a/indra/llcommon/lllazy.cpp b/indra/llcommon/lllazy.cpp index 29fa040387..29fa040387 100644..100755 --- a/indra/llcommon/lllazy.cpp +++ b/indra/llcommon/lllazy.cpp diff --git a/indra/llcommon/lllazy.h b/indra/llcommon/lllazy.h index 5f3bbce79e..5f3bbce79e 100644..100755 --- a/indra/llcommon/lllazy.h +++ b/indra/llcommon/lllazy.h diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 0a57ef1c48..0a57ef1c48 100644..100755 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp diff --git a/indra/llcommon/llleap.h b/indra/llcommon/llleap.h index 1a1ad23d39..e33f25e530 100644..100755 --- a/indra/llcommon/llleap.h +++ b/indra/llcommon/llleap.h @@ -32,6 +32,7 @@ class LL_COMMON_API LLLeap: public LLInstanceTracker<LLLeap> { public: + /** * Pass a brief string description, mostly for logging purposes. The desc * need not be unique, but obviously the clearer we can make it, the diff --git a/indra/llcommon/llleaplistener.cpp b/indra/llcommon/llleaplistener.cpp index fa5730f112..fa5730f112 100644..100755 --- a/indra/llcommon/llleaplistener.cpp +++ b/indra/llcommon/llleaplistener.cpp diff --git a/indra/llcommon/llleaplistener.h b/indra/llcommon/llleaplistener.h index 2193d81b9e..2193d81b9e 100644..100755 --- a/indra/llcommon/llleaplistener.h +++ b/indra/llcommon/llleaplistener.h diff --git a/indra/llcommon/lllinkedqueue.h b/indra/llcommon/lllinkedqueue.h index 8336608809..8336608809 100644..100755 --- a/indra/llcommon/lllinkedqueue.h +++ b/indra/llcommon/lllinkedqueue.h diff --git a/indra/llcommon/lllistenerwrapper.h b/indra/llcommon/lllistenerwrapper.h index 09d074abca..09d074abca 100644..100755 --- a/indra/llcommon/lllistenerwrapper.h +++ b/indra/llcommon/lllistenerwrapper.h diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index 3a3dfa9f28..3a3dfa9f28 100644..100755 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp diff --git a/indra/llcommon/llliveappconfig.h b/indra/llcommon/llliveappconfig.h index 4fd7c26a07..4fd7c26a07 100644..100755 --- a/indra/llcommon/llliveappconfig.h +++ b/indra/llcommon/llliveappconfig.h diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index c1987baf55..c1987baf55 100644..100755 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp diff --git a/indra/llcommon/lllivefile.h b/indra/llcommon/lllivefile.h index 320aa4bc3e..320aa4bc3e 100644..100755 --- a/indra/llcommon/lllivefile.h +++ b/indra/llcommon/lllivefile.h diff --git a/indra/llcommon/lllocalidhashmap.h b/indra/llcommon/lllocalidhashmap.h index 8f4f91a560..8f4f91a560 100644..100755 --- a/indra/llcommon/lllocalidhashmap.h +++ b/indra/llcommon/lllocalidhashmap.h diff --git a/indra/llcommon/lllog.cpp b/indra/llcommon/lllog.cpp index fc4058b5c9..fc4058b5c9 100644..100755 --- a/indra/llcommon/lllog.cpp +++ b/indra/llcommon/lllog.cpp diff --git a/indra/llcommon/lllog.h b/indra/llcommon/lllog.h index 7964412e83..7964412e83 100644..100755 --- a/indra/llcommon/lllog.h +++ b/indra/llcommon/lllog.h diff --git a/indra/llcommon/lllslconstants.h b/indra/llcommon/lllslconstants.h index 9f32598e61..9f32598e61 100644..100755 --- a/indra/llcommon/lllslconstants.h +++ b/indra/llcommon/lllslconstants.h diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h index 6294a15d3b..6294a15d3b 100644..100755 --- a/indra/llcommon/llmap.h +++ b/indra/llcommon/llmap.h diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index 1409c55d1c..1409c55d1c 100644..100755 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h index 1526e6ac3c..1526e6ac3c 100644..100755 --- a/indra/llcommon/llmd5.h +++ b/indra/llcommon/llmd5.h diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 70ad10ad55..70ad10ad55 100644..100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index e725bdd9fa..61e30f11cc 100644..100755 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -36,19 +36,68 @@ class LLMutex ; #define LL_CHECK_MEMORY #endif +LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); + +#ifdef SHOW_ASSERT +#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment)) +#else +#define ll_assert_aligned(ptr,alignment) +#endif + +#include <xmmintrin.h> + +template <typename T> T* LL_NEXT_ALIGNED_ADDRESS(T* address) +{ + return reinterpret_cast<T*>( + (reinterpret_cast<uintptr_t>(address) + 0xF) & ~0xF); +} + +template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) +{ + return reinterpret_cast<T*>( + (reinterpret_cast<uintptr_t>(address) + 0x3F) & ~0x3F); +} + +#if LL_LINUX || LL_DARWIN + +#define LL_ALIGN_PREFIX(x) +#define LL_ALIGN_POSTFIX(x) __attribute__((aligned(x))) + +#elif LL_WINDOWS + +#define LL_ALIGN_PREFIX(x) __declspec(align(x)) +#define LL_ALIGN_POSTFIX(x) + +#else +#error "LL_ALIGN_PREFIX and LL_ALIGN_POSTFIX undefined" +#endif + +#define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16) + inline void* ll_aligned_malloc( size_t size, int align ) { +#if defined(LL_WINDOWS) + return _aligned_malloc(size, align); +#else void* mem = malloc( size + (align - 1) + sizeof(void*) ); char* aligned = ((char*)mem) + sizeof(void*); aligned += align - ((uintptr_t)aligned & (align - 1)); ((void**)aligned)[-1] = mem; return aligned; +#endif } inline void ll_aligned_free( void* ptr ) { - free( ((void**)ptr)[-1] ); +#if defined(LL_WINDOWS) + _aligned_free(ptr); +#else + if (ptr) + { + free( ((void**)ptr)[-1] ); + } +#endif } #if !LL_USE_TCMALLOC @@ -133,6 +182,78 @@ inline void ll_aligned_free_32(void *p) #endif } + +// Copy words 16-byte blocks from src to dst. Source and destination MUST NOT OVERLAP. +// Source and dest must be 16-byte aligned and size must be multiple of 16. +// +inline void ll_memcpy_nonaliased_aligned_16(char* __restrict dst, const char* __restrict src, size_t bytes) +{ + assert(src != NULL); + assert(dst != NULL); + assert(bytes > 0); + assert((bytes % sizeof(F32))== 0); + ll_assert_aligned(src,16); + ll_assert_aligned(dst,16); + assert((src < dst) ? ((src + bytes) < dst) : ((dst + bytes) < src)); + assert(bytes%16==0); + + char* end = dst + bytes; + + if (bytes > 64) + { + + // Find start of 64b aligned area within block + // + void* begin_64 = LL_NEXT_ALIGNED_ADDRESS_64(dst); + + //at least 64 bytes before the end of the destination, switch to 16 byte copies + void* end_64 = end-64; + + // Prefetch the head of the 64b area now + // + _mm_prefetch((char*)begin_64, _MM_HINT_NTA); + _mm_prefetch((char*)begin_64 + 64, _MM_HINT_NTA); + _mm_prefetch((char*)begin_64 + 128, _MM_HINT_NTA); + _mm_prefetch((char*)begin_64 + 192, _MM_HINT_NTA); + + // Copy 16b chunks until we're 64b aligned + // + while (dst < begin_64) + { + + _mm_store_ps((F32*)dst, _mm_load_ps((F32*)src)); + dst += 16; + src += 16; + } + + // Copy 64b chunks up to your tail + // + // might be good to shmoo the 512b prefetch offset + // (characterize performance for various values) + // + while (dst < end_64) + { + _mm_prefetch((char*)src + 512, _MM_HINT_NTA); + _mm_prefetch((char*)dst + 512, _MM_HINT_NTA); + _mm_store_ps((F32*)dst, _mm_load_ps((F32*)src)); + _mm_store_ps((F32*)(dst + 16), _mm_load_ps((F32*)(src + 16))); + _mm_store_ps((F32*)(dst + 32), _mm_load_ps((F32*)(src + 32))); + _mm_store_ps((F32*)(dst + 48), _mm_load_ps((F32*)(src + 48))); + dst += 64; + src += 64; + } + } + + // Copy remainder 16b tail chunks (or ALL 16b chunks for sub-64b copies) + // + while (dst < end) + { + _mm_store_ps((F32*)dst, _mm_load_ps((F32*)src)); + dst += 16; + src += 16; + } +} + #ifndef __DEBUG_PRIVATE_MEM__ #define __DEBUG_PRIVATE_MEM__ 0 #endif @@ -541,13 +662,7 @@ void LLPrivateMemoryPoolTester::operator delete[](void* addr) // LLSingleton moved to llsingleton.h -LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); -#ifdef SHOW_ASSERT -#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment)) -#else -#define ll_assert_aligned(ptr,alignment) -#endif #endif diff --git a/indra/llcommon/llmemorystream.cpp b/indra/llcommon/llmemorystream.cpp index 723d94f025..723d94f025 100644..100755 --- a/indra/llcommon/llmemorystream.cpp +++ b/indra/llcommon/llmemorystream.cpp diff --git a/indra/llcommon/llmemorystream.h b/indra/llcommon/llmemorystream.h index e28f012192..e28f012192 100644..100755 --- a/indra/llcommon/llmemorystream.h +++ b/indra/llcommon/llmemorystream.h diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 731e58bd20..731e58bd20 100644..100755 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 1a18cdf36f..1a18cdf36f 100644..100755 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h diff --git a/indra/llcommon/llmetrics.cpp b/indra/llcommon/llmetrics.cpp index 3078139f43..3078139f43 100644..100755 --- a/indra/llcommon/llmetrics.cpp +++ b/indra/llcommon/llmetrics.cpp diff --git a/indra/llcommon/llmetrics.h b/indra/llcommon/llmetrics.h index 4f0ae56338..4f0ae56338 100644..100755 --- a/indra/llcommon/llmetrics.h +++ b/indra/llcommon/llmetrics.h diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp index 287f096eae..287f096eae 100644..100755 --- a/indra/llcommon/llmortician.cpp +++ b/indra/llcommon/llmortician.cpp diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h index 319955ef93..319955ef93 100644..100755 --- a/indra/llcommon/llmortician.h +++ b/indra/llcommon/llmortician.h diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h index d3283543f3..d3283543f3 100644..100755 --- a/indra/llcommon/llnametable.h +++ b/indra/llcommon/llnametable.h diff --git a/indra/llcommon/lloptioninterface.cpp b/indra/llcommon/lloptioninterface.cpp index 23fae76dc0..23fae76dc0 100644..100755 --- a/indra/llcommon/lloptioninterface.cpp +++ b/indra/llcommon/lloptioninterface.cpp diff --git a/indra/llcommon/lloptioninterface.h b/indra/llcommon/lloptioninterface.h index 93b465db32..93b465db32 100644..100755 --- a/indra/llcommon/lloptioninterface.h +++ b/indra/llcommon/lloptioninterface.h diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 88c09c8dca..88c09c8dca 100644..100755 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 7fdb537ab5..7fdb537ab5 100644..100755 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h diff --git a/indra/llcommon/llpriqueuemap.h b/indra/llcommon/llpriqueuemap.h index da997c7b04..da997c7b04 100644..100755 --- a/indra/llcommon/llpriqueuemap.h +++ b/indra/llcommon/llpriqueuemap.h diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 715df36f39..715df36f39 100644..100755 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index d711ce2f74..d711ce2f74 100644..100755 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index fd8f603d21..fd8f603d21 100644..100755 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp diff --git a/indra/llcommon/llprocessor.h b/indra/llcommon/llprocessor.h index 6364d3c8bb..6364d3c8bb 100644..100755 --- a/indra/llcommon/llprocessor.h +++ b/indra/llcommon/llprocessor.h diff --git a/indra/llcommon/llptrskiplist.h b/indra/llcommon/llptrskiplist.h index 67c7cde352..67c7cde352 100644..100755 --- a/indra/llcommon/llptrskiplist.h +++ b/indra/llcommon/llptrskiplist.h diff --git a/indra/llcommon/llptrskipmap.h b/indra/llcommon/llptrskipmap.h index 94bc71ec55..94bc71ec55 100644..100755 --- a/indra/llcommon/llptrskipmap.h +++ b/indra/llcommon/llptrskipmap.h diff --git a/indra/llcommon/llptrto.cpp b/indra/llcommon/llptrto.cpp index b270291bd6..b270291bd6 100644..100755 --- a/indra/llcommon/llptrto.cpp +++ b/indra/llcommon/llptrto.cpp diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h index 7091d36f6b..7091d36f6b 100644..100755 --- a/indra/llcommon/llptrto.h +++ b/indra/llcommon/llptrto.h diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index abf47a0f57..abf47a0f57 100644..100755 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index d3704b0fe2..d3704b0fe2 100644..100755 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h diff --git a/indra/llcommon/llrand.cpp b/indra/llcommon/llrand.cpp index cb28a8f5c3..cb28a8f5c3 100644..100755 --- a/indra/llcommon/llrand.cpp +++ b/indra/llcommon/llrand.cpp diff --git a/indra/llcommon/llrand.h b/indra/llcommon/llrand.h index ad317d5bf7..ad317d5bf7 100644..100755 --- a/indra/llcommon/llrand.h +++ b/indra/llcommon/llrand.h diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index e1876599fc..e1876599fc 100644..100755 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 32ae15435a..32ae15435a 100644..100755 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index bb0d60247e..bb0d60247e 100644..100755 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h diff --git a/indra/llcommon/llrun.cpp b/indra/llcommon/llrun.cpp index f5d3f302fa..f5d3f302fa 100644..100755 --- a/indra/llcommon/llrun.cpp +++ b/indra/llcommon/llrun.cpp diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h index a117405366..a117405366 100644..100755 --- a/indra/llcommon/llrun.h +++ b/indra/llcommon/llrun.h diff --git a/indra/llcommon/llsafehandle.h b/indra/llcommon/llsafehandle.h index 8d52d9bb15..8d52d9bb15 100644..100755 --- a/indra/llcommon/llsafehandle.h +++ b/indra/llcommon/llsafehandle.h diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 8276ec836a..8276ec836a 100644..100755 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 5eb69059ac..5eb69059ac 100644..100755 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 9f4460a988..9f4460a988 100644..100755 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 6ef5debd7b..6ef5debd7b 100644..100755 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index ad4fce6f35..ad4fce6f35 100644..100755 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index e7a5507385..e7a5507385 100644..100755 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index cef743a7be..cef743a7be 100644..100755 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp diff --git a/indra/llcommon/llsdserialize_xml.h b/indra/llcommon/llsdserialize_xml.h index dcc5f3d3c7..dcc5f3d3c7 100644..100755 --- a/indra/llcommon/llsdserialize_xml.h +++ b/indra/llcommon/llsdserialize_xml.h diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 803417d368..803417d368 100644..100755 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 532d3f9341..532d3f9341 100644..100755 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h diff --git a/indra/llcommon/llsecondlifeurls.cpp b/indra/llcommon/llsecondlifeurls.cpp index 9154e05e43..9154e05e43 100644..100755 --- a/indra/llcommon/llsecondlifeurls.cpp +++ b/indra/llcommon/llsecondlifeurls.cpp diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h index 62f357ffed..62f357ffed 100644..100755 --- a/indra/llcommon/llsecondlifeurls.h +++ b/indra/llcommon/llsecondlifeurls.h diff --git a/indra/llcommon/llsimplehash.h b/indra/llcommon/llsimplehash.h index 727b4568d8..727b4568d8 100644..100755 --- a/indra/llcommon/llsimplehash.h +++ b/indra/llcommon/llsimplehash.h diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index eb8e2c9456..9b49e52377 100644..100755 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -28,5 +28,4 @@ #include "llsingleton.h" -std::map<std::string, void *> * LLSingletonRegistry::sSingletonMap = NULL; diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 49d99f2cd0..40002313f1 100644..100755 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -30,38 +30,6 @@ #include <typeinfo> #include <boost/noncopyable.hpp> -/// @brief A global registry of all singletons to prevent duplicate allocations -/// across shared library boundaries -class LL_COMMON_API LLSingletonRegistry { - private: - typedef std::map<std::string, void *> TypeMap; - static TypeMap * sSingletonMap; - - static void checkInit() - { - if(sSingletonMap == NULL) - { - sSingletonMap = new TypeMap(); - } - } - - public: - template<typename T> static void * & get() - { - std::string name(typeid(T).name()); - - checkInit(); - - // the first entry of the pair returned by insert will be either the existing - // iterator matching our key, or the newly inserted NULL initialized entry - // see "Insert element" in http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html - TypeMap::iterator result = - sSingletonMap->insert(std::make_pair(name, (void*)NULL)).first; - - return result->second; - } -}; - // LLSingleton implements the getInstance() method part of the Singleton // pattern. It can't make the derived class constructors protected, though, so // you have to do that yourself. @@ -101,20 +69,23 @@ private: } EInitState; // stores pointer to singleton instance - // and tracks initialization state of singleton - struct SingletonInstanceData + struct SingletonLifetimeManager { - EInitState mInitState; - DERIVED_TYPE* mSingletonInstance; - - SingletonInstanceData() - : mSingletonInstance(NULL), - mInitState(UNINITIALIZED) - {} - - ~SingletonInstanceData() + SingletonLifetimeManager() + { + construct(); + } + + static void construct() { - if (mInitState != DELETED) + sData.mInitState = CONSTRUCTING; + sData.mInstance = new DERIVED_TYPE(); + sData.mInitState = INITIALIZING; + } + + ~SingletonLifetimeManager() + { + if (sData.mInitState != DELETED) { deleteSingleton(); } @@ -124,9 +95,8 @@ private: public: virtual ~LLSingleton() { - SingletonInstanceData& data = getData(); - data.mSingletonInstance = NULL; - data.mInitState = DELETED; + sData.mInstance = NULL; + sData.mInitState = DELETED; } /** @@ -151,50 +121,46 @@ public: */ static void deleteSingleton() { - delete getData().mSingletonInstance; - getData().mSingletonInstance = NULL; - getData().mInitState = DELETED; + delete sData.mInstance; + sData.mInstance = NULL; + sData.mInitState = DELETED; } - static SingletonInstanceData& getData() - { - // this is static to cache the lookup results - static void * & registry = LLSingletonRegistry::get<DERIVED_TYPE>(); - - // *TODO - look into making this threadsafe - if(NULL == registry) - { - static SingletonInstanceData data; - registry = &data; - } - - return *static_cast<SingletonInstanceData *>(registry); - } static DERIVED_TYPE* getInstance() { - SingletonInstanceData& data = getData(); + static SingletonLifetimeManager sLifeTimeMgr; - if (data.mInitState == CONSTRUCTING) + switch (sData.mInitState) { + case UNINITIALIZED: + // should never be uninitialized at this point + llassert(false); + return NULL; + case CONSTRUCTING: llerrs << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << llendl; - } - - if (data.mInitState == DELETED) - { + return NULL; + case INITIALIZING: + // go ahead and flag ourselves as initialized so we can be reentrant during initialization + sData.mInitState = INITIALIZED; + sData.mInstance->initSingleton(); + return sData.mInstance; + case INITIALIZED: + return sData.mInstance; + case DELETED: llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << llendl; + SingletonLifetimeManager::construct(); + sData.mInitState = INITIALIZED; + sData.mInstance->initSingleton(); + return sData.mInstance; } - - if (!data.mSingletonInstance) - { - data.mInitState = CONSTRUCTING; - data.mSingletonInstance = new DERIVED_TYPE(); - data.mInitState = INITIALIZING; - data.mSingletonInstance->initSingleton(); - data.mInitState = INITIALIZED; - } - - return data.mSingletonInstance; + + return NULL; + } + + static DERIVED_TYPE* getIfExists() + { + return sData.mInstance; } // Reference version of getInstance() @@ -208,18 +174,29 @@ public: // Use this to avoid accessing singletons before the can safely be constructed static bool instanceExists() { - return getData().mInitState == INITIALIZED; + return sData.mInitState == INITIALIZED; } // Has this singleton already been deleted? // Use this to avoid accessing singletons from a static object's destructor static bool destroyed() { - return getData().mInitState == DELETED; + return sData.mInitState == DELETED; } private: + virtual void initSingleton() {} + + struct SingletonData + { + EInitState mInitState; + DERIVED_TYPE* mInstance; + }; + static SingletonData sData; }; +template<typename T> +typename LLSingleton<T>::SingletonData LLSingleton<T>::sData; + #endif diff --git a/indra/llcommon/llskiplist.h b/indra/llcommon/llskiplist.h index ed132381f9..ed132381f9 100644..100755 --- a/indra/llcommon/llskiplist.h +++ b/indra/llcommon/llskiplist.h diff --git a/indra/llcommon/llskipmap.h b/indra/llcommon/llskipmap.h index 49ff2928d1..49ff2928d1 100644..100755 --- a/indra/llcommon/llskipmap.h +++ b/indra/llcommon/llskipmap.h diff --git a/indra/llcommon/llsmoothstep.h b/indra/llcommon/llsmoothstep.h index 1f97a3ec89..1f97a3ec89 100644..100755 --- a/indra/llcommon/llsmoothstep.h +++ b/indra/llcommon/llsmoothstep.h diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h index 391b82ee44..391b82ee44 100644..100755 --- a/indra/llcommon/llsortedvector.h +++ b/indra/llcommon/llsortedvector.h diff --git a/indra/llcommon/llstack.h b/indra/llcommon/llstack.h index 315de6ba2d..315de6ba2d 100644..100755 --- a/indra/llcommon/llstack.h +++ b/indra/llcommon/llstack.h diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index ccd7ef91c2..ccd7ef91c2 100644..100755 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp diff --git a/indra/llcommon/llstacktrace.h b/indra/llcommon/llstacktrace.h index ca72c64c5d..ca72c64c5d 100644..100755 --- a/indra/llcommon/llstacktrace.h +++ b/indra/llcommon/llstacktrace.h diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp index 3678c8e1c1..3678c8e1c1 100644..100755 --- a/indra/llcommon/llstat.cpp +++ b/indra/llcommon/llstat.cpp diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h index 38377a010b..38377a010b 100644..100755 --- a/indra/llcommon/llstat.h +++ b/indra/llcommon/llstat.h diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h index 81c4085d16..81c4085d16 100644..100755 --- a/indra/llcommon/llstatenums.h +++ b/indra/llcommon/llstatenums.h diff --git a/indra/llcommon/llstaticstringtable.h b/indra/llcommon/llstaticstringtable.h new file mode 100644 index 0000000000..d7e0e8a08d --- /dev/null +++ b/indra/llcommon/llstaticstringtable.h @@ -0,0 +1,82 @@ +/** + * @file llstringtable.h + * @brief The LLStringTable class provides a _fast_ method for finding + * unique copies of strings. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_STATIC_STRING_TABLE_H +#define LL_STATIC_STRING_TABLE_H + +#include "lldefs.h" +#include <boost/unordered_map.hpp> +#include "llstl.h" + +class LLStaticHashedString +{ +public: + + LLStaticHashedString(const std::string& s) + { + string_hash = makehash(s); + string = s; + } + + const std::string& String() const { return string; } + size_t Hash() const { return string_hash; } + + bool operator==(const LLStaticHashedString& b) const { return Hash() == b.Hash(); } + +protected: + + size_t makehash(const std::string& s) + { + size_t len = s.size(); + const char* c = s.c_str(); + size_t hashval = 0; + for (size_t i=0; i<len; i++) + { + hashval = ((hashval<<5) + hashval) + *c++; + } + return hashval; + } + + std::string string; + size_t string_hash; +}; + +struct LLStaticStringHasher +{ + enum { bucket_size = 8 }; + size_t operator()(const LLStaticHashedString& key_value) const { return key_value.Hash(); } + bool operator()(const LLStaticHashedString& left, const LLStaticHashedString& right) const { return left.Hash() < right.Hash(); } +}; + +template< typename MappedObject > +class LL_COMMON_API LLStaticStringTable + : public boost::unordered_map< LLStaticHashedString, MappedObject, LLStaticStringHasher > +{ +}; + +#endif + diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index d3941e1bc9..d3941e1bc9 100644..100755 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h diff --git a/indra/llcommon/llstreamqueue.cpp b/indra/llcommon/llstreamqueue.cpp index 1116a2b6a2..1116a2b6a2 100644..100755 --- a/indra/llcommon/llstreamqueue.cpp +++ b/indra/llcommon/llstreamqueue.cpp diff --git a/indra/llcommon/llstreamqueue.h b/indra/llcommon/llstreamqueue.h index 0726bad175..0726bad175 100644..100755 --- a/indra/llcommon/llstreamqueue.h +++ b/indra/llcommon/llstreamqueue.h diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index d7a6f47932..d7a6f47932 100644..100755 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h index 1b04bf91d7..1b04bf91d7 100644..100755 --- a/indra/llcommon/llstreamtools.h +++ b/indra/llcommon/llstreamtools.h diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h index ed9284d2c5..ed9284d2c5 100644..100755 --- a/indra/llcommon/llstrider.h +++ b/indra/llcommon/llstrider.h diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 0c32679744..0c32679744 100644..100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 119efc7957..119efc7957 100644..100755 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h diff --git a/indra/llcommon/llstringtable.cpp b/indra/llcommon/llstringtable.cpp index 7ad3805351..7ad3805351 100644..100755 --- a/indra/llcommon/llstringtable.cpp +++ b/indra/llcommon/llstringtable.cpp diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h index 59d7372ed4..ff09e71677 100644..100755 --- a/indra/llcommon/llstringtable.h +++ b/indra/llcommon/llstringtable.h @@ -42,14 +42,6 @@ //# define STRING_TABLE_HASH_MAP 1 #endif -#if STRING_TABLE_HASH_MAP -# if LL_WINDOWS -# include <hash_map> -# else -# include <ext/hash_map> -# endif -#endif - const U32 MAX_STRINGS_LENGTH = 256; class LL_COMMON_API LLStringTableEntry diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index c96f2191f3..57a6de9060 100644..100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -80,6 +80,7 @@ using namespace llsd; # include <sys/sysinfo.h> # include <stdexcept> const char MEMINFO_FILE[] = "/proc/meminfo"; +# include <gnu/libc-version.h> #elif LL_SOLARIS # include <stdio.h> # include <unistd.h> @@ -175,8 +176,41 @@ bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number) } #endif // LL_WINDOWS +// Wrap boost::regex_match() with a function that doesn't throw. +template <typename S, typename M, typename R> +static bool regex_match_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_match(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + +// Wrap boost::regex_search() with a function that doesn't throw. +template <typename S, typename M, typename R> +static bool regex_search_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_search(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + + LLOSInfo::LLOSInfo() : - mMajorVer(0), mMinorVer(0), mBuild(0) + mMajorVer(0), mMinorVer(0), mBuild(0), mOSVersionString("") { #if LL_WINDOWS @@ -412,6 +446,102 @@ LLOSInfo::LLOSInfo() : mOSString = mOSStringSimple; } +#elif LL_LINUX + + struct utsname un; + if(uname(&un) != -1) + { + mOSStringSimple.append(un.sysname); + mOSStringSimple.append(" "); + mOSStringSimple.append(un.release); + + mOSString = mOSStringSimple; + mOSString.append(" "); + mOSString.append(un.version); + mOSString.append(" "); + mOSString.append(un.machine); + + // Simplify 'Simple' + std::string ostype = mOSStringSimple.substr(0, mOSStringSimple.find_first_of(" ", 0)); + if (ostype == "Linux") + { + // Only care about major and minor Linux versions, truncate at second '.' + std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0); + std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos; + std::string simple = mOSStringSimple.substr(0, idx2); + if (simple.length() > 0) + mOSStringSimple = simple; + } + } + else + { + mOSStringSimple.append("Unable to collect OS info"); + mOSString = mOSStringSimple; + } + + const char OS_VERSION_MATCH_EXPRESSION[] = "([0-9]+)\\.([0-9]+)(\\.([0-9]+))?"; + boost::regex os_version_parse(OS_VERSION_MATCH_EXPRESSION); + boost::smatch matched; + + std::string glibc_version(gnu_get_libc_version()); + if ( regex_match_no_exc(glibc_version, matched, os_version_parse) ) + { + LL_INFOS("AppInit") << "Using glibc version '" << glibc_version << "' as OS version" << LL_ENDL; + + std::string version_value; + + if ( matched[1].matched ) // Major version + { + version_value.assign(matched[1].first, matched[1].second); + if (sscanf(version_value.c_str(), "%d", &mMajorVer) != 1) + { + LL_WARNS("AppInit") << "failed to parse major version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_ERRS("AppInit") + << "OS version regex '" << OS_VERSION_MATCH_EXPRESSION + << "' returned true, but major version [1] did not match" + << LL_ENDL; + } + + if ( matched[2].matched ) // Minor version + { + version_value.assign(matched[2].first, matched[2].second); + if (sscanf(version_value.c_str(), "%d", &mMinorVer) != 1) + { + LL_ERRS("AppInit") << "failed to parse minor version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_ERRS("AppInit") + << "OS version regex '" << OS_VERSION_MATCH_EXPRESSION + << "' returned true, but minor version [1] did not match" + << LL_ENDL; + } + + if ( matched[4].matched ) // Build version (optional) - note that [3] includes the '.' + { + version_value.assign(matched[4].first, matched[4].second); + if (sscanf(version_value.c_str(), "%d", &mBuild) != 1) + { + LL_ERRS("AppInit") << "failed to parse build version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_INFOS("AppInit") + << "OS build version not provided; using zero" + << LL_ENDL; + } + } + else + { + LL_WARNS("AppInit") << "glibc version '" << glibc_version << "' cannot be parsed to three numbers; using all zeros" << LL_ENDL; + } + #else struct utsname un; @@ -444,8 +574,13 @@ LLOSInfo::LLOSInfo() : mOSStringSimple.append("Unable to collect OS info"); mOSString = mOSStringSimple; } + #endif + std::stringstream dotted_version_string; + dotted_version_string << mMajorVer << "." << mMinorVer << "." << mBuild; + mOSVersionString.append(dotted_version_string.str()); + } #ifndef LL_WINDOWS @@ -496,6 +631,11 @@ const std::string& LLOSInfo::getOSStringSimple() const return mOSStringSimple; } +const std::string& LLOSInfo::getOSVersionString() const +{ + return mOSVersionString; +} + const S32 STATUS_SIZE = 8192; //static @@ -687,38 +827,6 @@ private: LLSD mStats; }; -// Wrap boost::regex_match() with a function that doesn't throw. -template <typename S, typename M, typename R> -static bool regex_match_no_exc(const S& string, M& match, const R& regex) -{ - try - { - return boost::regex_match(string, match, regex); - } - catch (const std::runtime_error& e) - { - LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " - << e.what() << ":\n'" << string << "'" << LL_ENDL; - return false; - } -} - -// Wrap boost::regex_search() with a function that doesn't throw. -template <typename S, typename M, typename R> -static bool regex_search_no_exc(const S& string, M& match, const R& regex) -{ - try - { - return boost::regex_search(string, match, regex); - } - catch (const std::runtime_error& e) - { - LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " - << e.what() << ":\n'" << string << "'" << LL_ENDL; - return false; - } -} - LLMemoryInfo::LLMemoryInfo() { refresh(); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 739e795d3a..cfed0fff17 100644..100755 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -49,6 +49,8 @@ public: const std::string& getOSString() const; const std::string& getOSStringSimple() const; + const std::string& getOSVersionString() const; + S32 mMajorVer; S32 mMinorVer; S32 mBuild; @@ -62,6 +64,7 @@ public: private: std::string mOSString; std::string mOSStringSimple; + std::string mOSVersionString; }; diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 1d56a52c32..60adeeaeb7 100644..100755 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -67,7 +67,8 @@ LL_COMMON_API void assert_main_thread() static U32 s_thread_id = LLThread::currentID(); if (LLThread::currentID() != s_thread_id) { - llerrs << "Illegal execution outside main thread." << llendl; + llwarns << "Illegal execution from thread id " << (S32) LLThread::currentID() + << " outside main thread " << (S32) s_thread_id << llendl; } } @@ -495,15 +496,7 @@ LLThreadSafeRefCount::LLThreadSafeRefCount() : LLThreadSafeRefCount::LLThreadSafeRefCount(const LLThreadSafeRefCount& src) { - if (sMutex) - { - sMutex->lock(); - } mRef = 0; - if (sMutex) - { - sMutex->unlock(); - } } LLThreadSafeRefCount::~LLThreadSafeRefCount() diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 0fb89c5613..f51d985b5f 100644..100755 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -242,49 +242,39 @@ public: LLThreadSafeRefCount(const LLThreadSafeRefCount&); LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) { - if (sMutex) - { - sMutex->lock(); - } mRef = 0; - if (sMutex) - { - sMutex->unlock(); - } return *this; } - - void ref() { - if (sMutex) sMutex->lock(); mRef++; - if (sMutex) sMutex->unlock(); } - S32 unref() + void unref() { llassert(mRef >= 1); - if (sMutex) sMutex->lock(); - S32 res = --mRef; - if (sMutex) sMutex->unlock(); - if (0 == res) - { - delete this; - return 0; + if ((--mRef) == 0) // See note in llapr.h on atomic decrement operator return value. + { + // If we hit zero, the caller should be the only smart pointer owning the object and we can delete it. + // It is technically possible for a vanilla pointer to mess this up, or another thread to + // jump in, find this object, create another smart pointer and end up dangling, but if + // the code is that bad and not thread-safe, it's trouble already. + delete this; } - return res; - } + } + S32 getNumRefs() const { - return mRef; + const S32 currentVal = mRef.CurrentValue(); + return currentVal; } private: - S32 mRef; + LLAtomic32< S32 > mRef; }; + /** * intrusive pointer support for LLThreadSafeRefCount * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type @@ -315,4 +305,6 @@ public: //============================================================================ +extern LL_COMMON_API void assert_main_thread(); + #endif // LL_LLTHREAD_H diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp index 8a73e632a9..8a73e632a9 100644..100755 --- a/indra/llcommon/llthreadsafequeue.cpp +++ b/indra/llcommon/llthreadsafequeue.cpp diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 58cac38769..58cac38769 100644..100755 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 9ebc6de7f4..9ebc6de7f4 100644..100755 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 513de0605d..513de0605d 100644..100755 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index ba861ae70b..ba861ae70b 100644..100755 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h diff --git a/indra/llcommon/lltypeinfolookup.h b/indra/llcommon/lltypeinfolookup.h index 0b6862444e..0b6862444e 100644..100755 --- a/indra/llcommon/lltypeinfolookup.h +++ b/indra/llcommon/lltypeinfolookup.h diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 21456a599b..21456a599b 100644..100755 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index c82a666e48..c82a666e48 100644..100755 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 0aaa50d231..0aaa50d231 100644..100755 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 7889828c85..7889828c85 100644..100755 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h diff --git a/indra/llcommon/lluuidhashmap.h b/indra/llcommon/lluuidhashmap.h index e294670030..e294670030 100644..100755 --- a/indra/llcommon/lluuidhashmap.h +++ b/indra/llcommon/lluuidhashmap.h diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index ef68a0eaf5..ef68a0eaf5 100644..100755 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h deleted file mode 100644 index ae5e3ecade..0000000000 --- a/indra/llcommon/llversionviewer.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llversionviewer.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONVIEWER_H -#define LL_LLVERSIONVIEWER_H - -const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 5; -const S32 LL_VERSION_PATCH = 1; -const S32 LL_VERSION_BUILD = 264760; - -const char * const LL_CHANNEL = "Second Life Developer"; - -#if LL_DARWIN -const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer"; -#endif - -#endif diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 3d05a30ac2..3d05a30ac2 100644..100755 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index be46394d6e..be46394d6e 100644..100755 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h diff --git a/indra/llcommon/metaclass.cpp b/indra/llcommon/metaclass.cpp index 5e403511cf..5e403511cf 100644..100755 --- a/indra/llcommon/metaclass.cpp +++ b/indra/llcommon/metaclass.cpp diff --git a/indra/llcommon/metaclass.h b/indra/llcommon/metaclass.h index 626757d58d..626757d58d 100644..100755 --- a/indra/llcommon/metaclass.h +++ b/indra/llcommon/metaclass.h diff --git a/indra/llcommon/metaclasst.h b/indra/llcommon/metaclasst.h index b9a7ae219d..b9a7ae219d 100644..100755 --- a/indra/llcommon/metaclasst.h +++ b/indra/llcommon/metaclasst.h diff --git a/indra/llcommon/metaproperty.cpp b/indra/llcommon/metaproperty.cpp index 98d850bf1e..98d850bf1e 100644..100755 --- a/indra/llcommon/metaproperty.cpp +++ b/indra/llcommon/metaproperty.cpp diff --git a/indra/llcommon/metaproperty.h b/indra/llcommon/metaproperty.h index bd5bb1a30f..bd5bb1a30f 100644..100755 --- a/indra/llcommon/metaproperty.h +++ b/indra/llcommon/metaproperty.h diff --git a/indra/llcommon/metapropertyt.h b/indra/llcommon/metapropertyt.h index 7a36c161da..7a36c161da 100644..100755 --- a/indra/llcommon/metapropertyt.h +++ b/indra/llcommon/metapropertyt.h diff --git a/indra/llcommon/reflective.cpp b/indra/llcommon/reflective.cpp index 2cc0e7e1f2..2cc0e7e1f2 100644..100755 --- a/indra/llcommon/reflective.cpp +++ b/indra/llcommon/reflective.cpp diff --git a/indra/llcommon/reflective.h b/indra/llcommon/reflective.h index da5c5a2630..da5c5a2630 100644..100755 --- a/indra/llcommon/reflective.h +++ b/indra/llcommon/reflective.h diff --git a/indra/llcommon/reflectivet.h b/indra/llcommon/reflectivet.h index 958921f23e..958921f23e 100644..100755 --- a/indra/llcommon/reflectivet.h +++ b/indra/llcommon/reflectivet.h diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h index effd15ea72..effd15ea72 100644..100755 --- a/indra/llcommon/roles_constants.h +++ b/indra/llcommon/roles_constants.h diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index efcbe76795..efcbe76795 100644..100755 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index bf3f3f9ee8..bf3f3f9ee8 100644..100755 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h index fe6416fb50..fe6416fb50 100644..100755 --- a/indra/llcommon/string_table.h +++ b/indra/llcommon/string_table.h diff --git a/indra/llcommon/stringize.h b/indra/llcommon/stringize.h index 72f2e58ce1..72f2e58ce1 100644..100755 --- a/indra/llcommon/stringize.h +++ b/indra/llcommon/stringize.h diff --git a/indra/llcommon/tests/StringVec.h b/indra/llcommon/tests/StringVec.h index a380b00a05..a380b00a05 100644..100755 --- a/indra/llcommon/tests/StringVec.h +++ b/indra/llcommon/tests/StringVec.h diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp index afc0c18cd0..afc0c18cd0 100644..100755 --- a/indra/llcommon/tests/bitpack_test.cpp +++ b/indra/llcommon/tests/bitpack_test.cpp diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index b115c153c1..b115c153c1 100644..100755 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp diff --git a/indra/llcommon/tests/listener.h b/indra/llcommon/tests/listener.h index 9c5c18a150..9c5c18a150 100644..100755 --- a/indra/llcommon/tests/listener.h +++ b/indra/llcommon/tests/listener.h diff --git a/indra/llcommon/tests/llallocator_heap_profile_test.cpp b/indra/llcommon/tests/llallocator_heap_profile_test.cpp index 44a9705803..44a9705803 100644..100755 --- a/indra/llcommon/tests/llallocator_heap_profile_test.cpp +++ b/indra/llcommon/tests/llallocator_heap_profile_test.cpp diff --git a/indra/llcommon/tests/llallocator_test.cpp b/indra/llcommon/tests/llallocator_test.cpp index 4e62eaee67..4e62eaee67 100644..100755 --- a/indra/llcommon/tests/llallocator_test.cpp +++ b/indra/llcommon/tests/llallocator_test.cpp diff --git a/indra/llcommon/tests/llbase64_test.cpp b/indra/llcommon/tests/llbase64_test.cpp index d0394150fa..d0394150fa 100644..100755 --- a/indra/llcommon/tests/llbase64_test.cpp +++ b/indra/llcommon/tests/llbase64_test.cpp diff --git a/indra/llcommon/tests/lldate_test.cpp b/indra/llcommon/tests/lldate_test.cpp index 7c95ccb91f..7c95ccb91f 100644..100755 --- a/indra/llcommon/tests/lldate_test.cpp +++ b/indra/llcommon/tests/lldate_test.cpp diff --git a/indra/llcommon/tests/lldependencies_test.cpp b/indra/llcommon/tests/lldependencies_test.cpp index 5395d785b6..5395d785b6 100644..100755 --- a/indra/llcommon/tests/lldependencies_test.cpp +++ b/indra/llcommon/tests/lldependencies_test.cpp diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 279a90e51b..279a90e51b 100644..100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 901ba35b2f..8d12529613 100644..100755 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -64,10 +64,10 @@ // Boost.Coroutine #include is the *first* #include of the platform header. // That means that client code must generally #include Boost.Coroutine headers // before anything else. -#include <boost/coroutine/coroutine.hpp> +#include <boost/dcoroutine/coroutine.hpp> // Normally, lleventcoro.h obviates future.hpp. We only include this because // we implement a "by hand" test of future functionality. -#include <boost/coroutine/future.hpp> +#include <boost/dcoroutine/future.hpp> #include <boost/bind.hpp> #include <boost/range.hpp> @@ -87,7 +87,7 @@ /***************************************************************************** * from the banana.cpp example program borrowed for test<1>() *****************************************************************************/ -namespace coroutines = boost::coroutines; +namespace coroutines = boost::dcoroutines; using coroutines::coroutine; template<typename Iter> @@ -122,7 +122,7 @@ typedef coroutine<std::string::iterator(void)> match_coroutine_type; * Test helpers *****************************************************************************/ // I suspect this will be typical of coroutines used in Linden software -typedef boost::coroutines::coroutine<void()> coroutine_type; +typedef boost::dcoroutines::coroutine<void()> coroutine_type; /// Simulate an event API whose response is immediate: sent on receipt of the /// initial request, rather than after some delay. This is the case that @@ -173,10 +173,10 @@ namespace tut // ... do whatever preliminary stuff must happen ... // declare the future - boost::coroutines::future<LLSD> future(self); + boost::dcoroutines::future<LLSD> future(self); // tell the future what to wait for LLTempBoundListener connection( - LLEventPumps::instance().obtain("source").listen("coro", voidlistener(boost::coroutines::make_callback(future)))); + LLEventPumps::instance().obtain("source").listen("coro", voidlistener(boost::dcoroutines::make_callback(future)))); ensure("Not yet", ! future); // attempting to dereference ("resolve") the future causes the calling // coroutine to wait for it diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 263c9b171f..263c9b171f 100644..100755 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp diff --git a/indra/llcommon/tests/lleventfilter_test.cpp b/indra/llcommon/tests/lleventfilter_test.cpp index ca05ef62a9..ca05ef62a9 100644..100755 --- a/indra/llcommon/tests/lleventfilter_test.cpp +++ b/indra/llcommon/tests/lleventfilter_test.cpp diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 8ac1c91a3a..8ac1c91a3a 100644..100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index e769c3e22c..e769c3e22c 100644..100755 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp diff --git a/indra/llcommon/tests/lllazy_test.cpp b/indra/llcommon/tests/lllazy_test.cpp index 32a717f4fc..32a717f4fc 100644..100755 --- a/indra/llcommon/tests/lllazy_test.cpp +++ b/indra/llcommon/tests/lllazy_test.cpp diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9b755e9ca5..29060d4ef5 100644..100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -122,13 +122,10 @@ namespace tut // finding indra/lib/python. Use our __FILE__, with // raw-string syntax to deal with Windows pathnames. "mydir = os.path.dirname(r'" << __FILE__ << "')\n" - "try:\n" - " from llbase import llsd\n" - "except ImportError:\n" // We expect mydir to be .../indra/llcommon/tests. - " sys.path.insert(0,\n" - " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" - " from indra.base import llsd\n" + "sys.path.insert(0,\n" + " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" + "from indra.base import llsd\n" "\n" "class ProtocolError(Exception):\n" " def __init__(self, msg, data):\n" diff --git a/indra/llcommon/tests/llmemtype_test.cpp b/indra/llcommon/tests/llmemtype_test.cpp index 1f050d6dc7..1f050d6dc7 100644..100755 --- a/indra/llcommon/tests/llmemtype_test.cpp +++ b/indra/llcommon/tests/llmemtype_test.cpp diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 99186ed434..6f1e7d46b8 100644..100755 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -608,6 +608,9 @@ namespace tut void object::test<5>() { set_test_name("exit(2)"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(2)\n"); @@ -620,6 +623,9 @@ namespace tut void object::test<6>() { set_test_name("syntax_error:"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "syntax_error:\n"); py.mParams.files.add(LLProcess::FileParam()); // inherit stdin @@ -641,6 +647,9 @@ namespace tut void object::test<7>() { set_test_name("explicit kill()"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys, time\n" @@ -685,6 +694,9 @@ namespace tut void object::test<8>() { set_test_name("implicit kill()"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif NamedTempFile out("out", "not started"); LLProcess::handle phandle(0); { diff --git a/indra/llcommon/tests/llprocessor_test.cpp b/indra/llcommon/tests/llprocessor_test.cpp index 884e1b5e5b..884e1b5e5b 100644..100755 --- a/indra/llcommon/tests/llprocessor_test.cpp +++ b/indra/llcommon/tests/llprocessor_test.cpp diff --git a/indra/llcommon/tests/llrand_test.cpp b/indra/llcommon/tests/llrand_test.cpp index 383e6f9e0a..383e6f9e0a 100644..100755 --- a/indra/llcommon/tests/llrand_test.cpp +++ b/indra/llcommon/tests/llrand_test.cpp diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index e625545763..4d436e8897 100644..100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1523,10 +1523,7 @@ namespace tut "sys.path.insert(0,\n" " os.path.join(os.path.dirname(r'" __FILE__ "'),\n" " os.pardir, os.pardir, 'lib', 'python'))\n" - "try:\n" - " from llbase import llsd\n" - "except ImportError:\n" - " from indra.base import llsd\n") + "from indra.base import llsd\n") {} ~TestPythonCompatible() {} diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp index 385289aefe..385289aefe 100644..100755 --- a/indra/llcommon/tests/llsingleton_test.cpp +++ b/indra/llcommon/tests/llsingleton_test.cpp diff --git a/indra/llcommon/tests/llstreamqueue_test.cpp b/indra/llcommon/tests/llstreamqueue_test.cpp index 050ad5c5bf..050ad5c5bf 100644..100755 --- a/indra/llcommon/tests/llstreamqueue_test.cpp +++ b/indra/llcommon/tests/llstreamqueue_test.cpp diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 93d3968dbf..93d3968dbf 100644..100755 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 1d619867d4..1d619867d4 100644..100755 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp diff --git a/indra/llcommon/tests/lluri_test.cpp b/indra/llcommon/tests/lluri_test.cpp index 4c64f15ca7..4c64f15ca7 100644..100755 --- a/indra/llcommon/tests/lluri_test.cpp +++ b/indra/llcommon/tests/lluri_test.cpp diff --git a/indra/llcommon/tests/reflection_test.cpp b/indra/llcommon/tests/reflection_test.cpp index 8980ebb1f1..8980ebb1f1 100644..100755 --- a/indra/llcommon/tests/reflection_test.cpp +++ b/indra/llcommon/tests/reflection_test.cpp diff --git a/indra/llcommon/tests/stringize_test.cpp b/indra/llcommon/tests/stringize_test.cpp index 3d34f23998..3d34f23998 100644..100755 --- a/indra/llcommon/tests/stringize_test.cpp +++ b/indra/llcommon/tests/stringize_test.cpp diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index a4d3a4e026..a4d3a4e026 100644..100755 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h diff --git a/indra/llcommon/timer.h b/indra/llcommon/timer.h index 82d19c2d32..82d19c2d32 100644..100755 --- a/indra/llcommon/timer.h +++ b/indra/llcommon/timer.h diff --git a/indra/llcommon/timing.cpp b/indra/llcommon/timing.cpp index c2dc695ef3..c2dc695ef3 100644..100755 --- a/indra/llcommon/timing.cpp +++ b/indra/llcommon/timing.cpp diff --git a/indra/llcommon/timing.h b/indra/llcommon/timing.h index c408d4c446..c408d4c446 100644..100755 --- a/indra/llcommon/timing.h +++ b/indra/llcommon/timing.h diff --git a/indra/llcommon/u64.cpp b/indra/llcommon/u64.cpp index eea16c5036..eea16c5036 100644..100755 --- a/indra/llcommon/u64.cpp +++ b/indra/llcommon/u64.cpp diff --git a/indra/llcommon/u64.h b/indra/llcommon/u64.h index 75c8a59136..75c8a59136 100644..100755 --- a/indra/llcommon/u64.h +++ b/indra/llcommon/u64.h |