Commit Graph

35977 Commits (1cadeb40df15c1eaef3410064f9a2b8e4489082d)

Author SHA1 Message Date
Nat Goodspeed 1cadeb40df MAINT-5232: Prevent runaway LLSingletonBase::MasterList growth.
Until we reimplement LLCoros on Boost.Fiber, we must hand-implement
coroutine-local data. That presently takes the form of a map keyed on
llcoro::id, whose values are the stacks of currently-initializing LLSingleton
instances.

But since the viewer launches an open-ended number of coroutines, we could end
up with an open-ended number of map entries unless we intentionally prune the
map. So every time we pop the stack to empty, remove that map entry.

This could result in thrashing, a given coroutine's 'initializing' stack being
created and deleted for almost every LLSingleton instantiated by that
coroutine -- but the number of different LLSingletons is necessarily static,
and the lifespan of each is the entire rest of the process. Even a couple
dozen LLSingletons won't thrash that badly.
2016-09-06 21:25:57 -04:00
Nat Goodspeed 90f424980a MAINT-5232: Make LLSingleton's 'initializing' stack coro-specific.
The stack we maintain of which LLSingletons are currently initializing only
makes sense when associated with a particular C++ call stack. But each
coroutine introduces another C++ call stack!

Move the initializing stack from function-static storage to
LLSingletonBase::MasterList. Make it a map keyed by llcoro::id. Each coro then
has a stack of its own.

This introduces more dependencies on the MasterList singleton, requiring
additional LLSingleton_manage_master workarounds.
2016-09-06 21:07:38 -04:00
Nat Goodspeed a601c559e8 MAINT-5232: Ensure that llcoro::get_id() returns distinct values.
Until now, the "main coroutine" (the initial context) of each thread left
LLCoros::Current() NULL. The trouble with that is that llcoro::get_id()
returns that CoroData* as an opaque token, and we want distinct values for
every stack in the process. That would not be true if the "main coroutine" on
thread A returned the same value (NULL) as the "main coroutine" on thread B,
and so forth. Give each thread's "main coroutine" a dummy heap CoroData
instance of its own.
2016-09-06 12:08:38 -04:00
Nat Goodspeed 976f4b6252 MAINT-5232: Break out LLCoros::get_id() into its own header file.
We need LLSingleton machinery to be able to reference get_id() without also
depending on all the rest of LLCoros -- since LLCoros isa LLSingleton.
2016-09-03 12:04:36 -04:00
Nat Goodspeed f931f6ef52 MAINT-5232: Add LLCoros::get_id() to identify the running coroutine.
Change the module-static thread_specific_ptr to a function-static
thread_specific_ptr so it will be initialized on demand -- since LLSingleton
will need to rely on get_id(). Note that since LLCoros isa LLSingleton, we
must take great care to avoid circularity.

Introduce a private helper class LLCoros::Current to obtain and bind that
thread_specific_ptr. Change all existing internal references from the static
thread_specific_ptr to the new Current helper class.
2016-09-03 11:39:17 -04:00
Nat Goodspeed c71e622229 MAINT-5232: Add DEBUG logging to LLSingleton dependency tracking.
Specifically, add DEBUG logging to the code that maintains the stack of
LLSingletons currently being initialized. This involves passing
LLSingletonBase's constructor the name of LLSingleton's template parameter
subclass, since during that constructor typeid(*this).name() will only produce
"LLSingletonBase".

Also add logdebugs() and oktolog() helper functions.
2016-09-03 11:30:53 -04:00
Nat Goodspeed 4af7e496b4 MAINT-5232: Make LLError::is_available() depend on both LLSingletons.
LLError machinery depends on two different LLSingletons. Its is_available()
function is primarily for LLSingleton itself to determine whether it is, or is
not, safe to log. Until both of LLError's LLSingletons have been constructed,
attempting to log LLSingleton operations could produce infinite recursion.
2016-09-03 11:22:54 -04:00
Nat Goodspeed a05ee7324d MAINT-5232: Abbreviate __FILE__ path in log_subsystem_cleanup().
LLError::abbreviateFile() is specifically to avoid cluttering log output with
the prefix of an absolute file path on the original build system, pointless
for anyone trying to read the log.
2016-09-02 14:03:28 -04:00
Nat Goodspeed 56a83d2115 MAINT-5011: Use LL_VLOGS() rather than raw lllog() macro.
Raw lllog() doesn't work for varying log level, which is why LL_VLOGS()
exists.
2016-09-01 19:53:56 -04:00
Nat Goodspeed a1741be7f6 Automated merge with file:///Users/nat/linden/viewer-comment-lllog 2016-09-01 19:52:45 -04:00
Nat Goodspeed 9be4e7e448 MAINT-5232: Introduce LL_VLOGS() macro: log call with variable level.
In some places we want to log the same information but with different severity
depending on specifics. In other cases we need to test the availability of the
logging subsystem before engaging it. LL_VLOGS() accepts an LLError::ELevel
argument that can differ with each call, while retaining the desirable feature
of deciding only once for each level.
2016-09-01 19:32:31 -04:00
Nat Goodspeed 3a2383dc0d Automated merge with file:///Users/nat/linden/viewer-comment-lllog 2016-09-01 18:29:17 -04:00
Nat Goodspeed 31d3d654f1 MAINT-5011: Advise against lllog() instead of (e.g.) LL_INFOS(). 2016-09-01 15:21:54 -04:00
Nat Goodspeed 959edebeca MAINT-5232: Add LLSingletonBase::cleanupAll() and deleteAll() calls
near the end of LLAppViewer::cleanup() so every LLSingleton class that hasn't
already been explicitly cleaned up gets a chance to perform its own cleanup.
2016-08-31 16:20:10 -04:00
Nat Goodspeed 334eb89d8e MAINT-5232: Add a tag to LLSingleton log messages. 2016-08-31 16:17:50 -04:00
Nat Goodspeed 3e1589709f MAINT-5232: LLMetricPerformanceTesterBasic::cleanClass->cleanupClass
for consistency with everything else, so we can use SUBSYSTEM_CLEANUP() macro
to call it.
2016-08-31 14:46:03 -04:00
Nat Goodspeed f5ccfff542 MAINT-5232: Add DEBUG logging to LLSingleton operations.
Specifically, log as LLSingleton captures inter-Singleton dependencies. Also
log cleanupAll() calls to cleanupSingleton() and deleteAll() calls to
deleteSingleton(), since they happen in an implicitly-determined order. But do
not log anything during the implicit LLSingletonBase::deleteAll() call
triggered by the runtime destroying the last LLSingleton's static data. That's
too late in the run; even std::cerr might already have been destroyed!
2016-08-31 14:25:55 -04:00
Nat Goodspeed 37d3993a59 MAINT-5232: Consolidate special LLSingletonBase logging logic. 2016-08-30 16:42:24 -04:00
Nat Goodspeed dcdccb3ef1 MAINT-5232: Move "llerror.h" out of llcleanup.h, llinitdestroyclass.h
Introduce corresponding llcleanup.cpp, llinitdestroyclass.cpp modules to
contain code that performs logging calls.

Track class::method names for LLInitClass<T> and LLDestroyClass<T> subclasses,
and log them when called. The order in which these calls occur could be
relevant to bugs, and could surface the need to convert to LLSingleton
dependencies.
2016-08-30 16:28:21 -04:00
Nat Goodspeed e934e867bd MAINT-5232: LLGlobalEconomy is now an LLSingleton.
It used to contain an LLSingleton called Singleton, requiring
LLGlobalEconomy::Singleton::instance() to access it rather than the
conventional LLGlobalEconomy::instance(). This has been fixed, so normalize
references accordingly.
2016-08-30 14:16:09 -04:00
Nat Goodspeed 57ecedb469 MAINT-5232: Change getIfExists() call to instanceExists().
LLSingleton::getIfExists() has been eliminated. The only remaining way to
detect whether a given LLSingleton has been instantiated is to call
instanceExists(). But the relevant cleanup code should be refactored to
cleanupSingleton() anyway, which would make this specific call moot.
2016-08-30 14:12:52 -04:00
Nat Goodspeed 82e71849a9 MAINT-5232: Remove unreferenced mInFlightCounter.
This fixes fatal warnings.
2016-08-30 14:09:58 -04:00
Nat Goodspeed eddce74206 MAINT-5232: Do less work inside typeid() calls.
clang gets nervous about expressions that call functions inside typeid(), even
though these particular typeid() calls are runtime expressions on runtime
values. Extract the offending calls to a previous statement.
2016-08-30 14:08:32 -04:00
Nat Goodspeed c92eb7e591 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2016-08-30 11:36:06 -04:00
Oz Linden 4fb100ac7a increment viewer version to 4.0.8 2016-08-11 15:31:41 -04:00
Oz Linden e4a1b2c940 Added tag 4.0.7-release for changeset 33981d8130f0 2016-08-11 15:31:41 -04:00
AndreyL ProductEngine ec4f5ade76 Merged in oz_linden/viewer-build 2016-08-05 01:02:33 +03:00
Andrey Lihatskiy 8ba372c886 Merged andreyl_productengine/viewer-427 into default 2016-08-05 00:50:53 +03:00
AndreyL ProductEngine f459c67fae Buildfix: brought back LINDEN_J2C_COMMENT_PREFIX 2016-08-05 00:58:09 +03:00
Nat Goodspeed 2ce38c3c98 MAINT-6584: Comment out completely unused LLImageJ2CKDU code.
The only call to the findDiscardLevelsBoundaries() method was commented out
inside initDecode(), with a comment:
        // Merov : Test!! DO NOT COMMIT!!

This was the only caller of copy_tile(), which was the only caller of
copy_block(). Commented out all three of these (biggish!) functions, since I
have no idea what any of them were supposed to do or when it might be useful
to call them. In other words, I can't yet rule out the possibility that I
might have to uncomment them.
2016-08-04 16:20:39 -04:00
AndreyL ProductEngine 6de8631327 Merged in lindenlab/viewer-lynx 2016-08-04 21:11:32 +03:00
andreykproductengine ce36584552 MAINT-6460 getMeshSize crash 2016-08-01 18:58:41 +03:00
andreykproductengine 9b07078b47 MAINT-6460 Crash calculating mesh complexity 2016-08-01 18:00:54 +03:00
andreykproductengine 13f19b1634 Backed out changeset: c21a7e6d9796 2016-08-01 17:25:20 +03:00
AndreyL ProductEngine 974e5e5868 MAINT-6511 Replaced c-style casts with dynamic_cast in llfloater.cpp 2016-07-28 00:15:49 +03:00
AndreyL ProductEngine 2339e759fc MAINT-4327/MAINT-6584 Supress the crash on memory allocation error when decoding J2C images 2016-07-27 05:49:07 +03:00
Nat Goodspeed 03bff896bd MAINT-6584: Use RAII classes to manage helper object lifespans.
Use boost::scoped_ptr instead of raw pointers to LLKDUMemSource,
LLKDUDecodeState, kdu_coords and kdu_dims so cleanup is simpler, and automated
on destruction of LLImageJ2CKDU.

Replace pointer to kdu_codestream with a custom RAII class. kdu_codestream is
itself an opaque handle, so we don't need to add another layer of indirection.
Just wrap it to ensure its destroy() method is reliably called when needed.

Make static instances of LLKDUMessageWarning and LLKDUMessageError
self-register, eliminating the companion static bool and explicit checks in
code.
2016-08-03 20:40:03 -04:00
Oz Linden b779ca0aed fail build on a failed configure 2016-07-26 17:43:39 -04:00
andreykproductengine 1b1f4252e3 MAINT-6460 Crash calculating mesh complexity 2016-07-25 23:43:37 +03:00
Nat Goodspeed acdb050ce5 MAINT-6584: Convert LLImage class hierarchy to standard 'bool'
instead of legacy BOOL.
2016-07-22 11:35:23 -04:00
Nat Goodspeed ab07b1a461 MAINT-6584: Rationalize custom KDU error/warning message classes.
Derive them both from a common base class that does the message logging,
instead of having each handler class log redundantly -- especially since the
put_text() override accepting const kdu_uint16* was simply streaming the
kdu_uint16 pointer to the log file, which would log the hex value of the
pointer.

Although we want a static instance of each of these handler classes, pull it
out rather than nesting the instance within the class itself.
2016-07-22 10:32:53 -04:00
Nat Goodspeed 71b593e88b MAINT-6584: Streamline static LLImageJ2C implementation API.
Specifically, remove unused function pointer types CreateLLImageJ2CFunction,
DestroyLLImageJ2CFunction and EngineInfoLLImageJ2CFunction.

Also eliminate static fallbackDestroyLLImageJ2CImpl() and
fallbackEngineInfoLLImageJ2CImpl(), leaving only static
fallbackCreateLLImageJ2CImpl().

We do need a factory function to instantiate the appropriate LLImageJ2CImpl
subclass, so leave the fallbackCreateLLImageJ2CImpl() link seam in place.

However, given that every known LLImageJ2CImpl subclass is cheap to
instantiate, make getEngineInfo() a pure virtual method on that subclass: the
static LLImageJ2C::getEngineInfo() method can temporarily construct an
instance to query. While we're at it, make getEngineInfo() return std::string
like LLImageJ2C::getEngineInfo(). It's ridiculous that
fallbackEngineInfoLLImageJ2CImpl() implementations constructed a static
std::string and returned its c_str(), only to have LLImageJ2C::getEngineInfo()
construct ANOTHER std::string from the returned const char*.

fallbackDestroyLLImageJ2CImpl() never did anything useful: it merely deleted
the passed LLImageJ2CImpl subclass pointer as the specific subclass type. But
since LLImageJ2CImpl's destructor is virtual, LLImageJ2C's destructor could
simply delete the stored LLImageJ2CImpl*. In fact, make mImpl a
boost::scoped_ptr<LLImageJ2CImpl> so we don't even have to delete it manually.
2016-07-21 16:49:02 -04:00
Nat Goodspeed f09a92f1f3 DRTVWR-427: Remove engineInfoLLImageJ2CKDU(), createLLImageJ2CKDU(),
destroyLLImageJ2CKDU().

These were apparently intended as simple C-style DLL entry points. But as
nobody calls them, and as we decided against building the viewer from DLLs,
they only clutter the code.
2016-07-21 14:29:29 -04:00
Oz Linden 0db98a6308 merge changes for STORM-2133 2016-07-14 11:35:14 -04:00
andreykproductengine 00a193e740 MAINT-6460 Crash calculating mesh complexity 2016-07-14 15:21:39 +03:00
Ansariel d2cf09e7d2 STORM-2133: VOICE-36 prevents proper shutdown of connector 2016-07-14 10:28:54 +02:00
andreykproductengine b06d5aeec8 MAINT-6460 Crash calculating mesh complexity 2016-07-12 21:37:45 +03:00
Rider Linden 85c0bec92c Merge 2016-07-12 12:11:01 -07:00
Rider Linden c0407af8ab STORM-2132: Remove obsoleted unique_ptr.hpp, use make_shared for pointer allocation. 2016-07-12 11:07:05 -07:00
Rider Linden c1c9b3d74e MAINT-6565: Grab a shared pointer and encapsulate it into the bind call in place of this. Ensures that the impl is not deleted while the coroutine is active. 2016-07-11 16:33:11 -07:00