summaryrefslogtreecommitdiff
path: root/indra/llcommon
AgeCommit message (Collapse)Author
2024-09-05Fix a few trailing whitespaces.Nat Goodspeed
2024-09-05Merge branch 'release/luau-scripting' into lua-resultsetNat Goodspeed
2024-09-04Windows build fixesNat Goodspeed
2024-09-04Extract coroutine-aware synchronization primitives to new header.Nat Goodspeed
Changes on new main and changes on Lua project branch combined into a header circularity. Resolved by hoisting coroutine-aware synchronization primitives out to a new llcoromutex.h file in the `llcoro` namespace, rather than being literally members of the `LLCoros` class. But retained `using` declarations in `LLCoros` for backwards compatibility.
2024-09-04Merge branch 'develop' into marchcat/b-developAndrey Lihatskiy
# Conflicts: # indra/llcommon/llerror.h
2024-09-03Fix a bug in ResultSet::getSliceStart().Nat Goodspeed
When asked to retrieve a slice starting at an `index > 0`, `getSliceStart()` was returning an LLSD array whose first `index` entries were `isUndefined()`, followed by the desired data. Fix to omit those undefined entries.
2024-09-03Add Lua traceback to errors from calling lluau::expr().Nat Goodspeed
That includes scripts run by LLLUAmanager::runScriptFile(), runScriptLine() et al.
2024-09-03Break out llinventorylistener.cpp's InvResultSet as LL::ResultSet.Nat Goodspeed
We may well want to leverage that API for additional queries that could potentially return large datasets.
2024-09-03In lua_what() and lua_stack(), try to report a function's name.Nat Goodspeed
2024-09-02Make `pairs()`, `ipairs()` forward to original funcs if no metamethods.Nat Goodspeed
That is, our replacement `pairs()` forwards the call to built-in `pairs()` when the passed object has no `__iter()` metamethod. Similarly, our replacement `ipairs()` forwards to built-in `ipairs()` when the passed object has no `__index()` metamethod. This allows for the possibility that the built-in `pairs()` and `ipairs()` functions engage more efficient implementations than the obvious ones.
2024-08-31Make global pairs(), ipairs() honor metamethods.Nat Goodspeed
Specifically, make pairs(obj) honor obj's __iter() metamethod if any. Make ipairs(obj) honor obj's __index() metamethod, if any. Given the semantics of the __index() metamethod, though, this only works for a proxy table if the proxy has no array entries (int keys) of its own.
2024-08-30Add LLIntTracker<T>, an LLInstanceTracker<T, int> with generated keys.Nat Goodspeed
The point of LLIntTracker is to generate its keys implicitly, so that its int getKey() can be treated more or less like an instance pointer, with the added bonus that the key can be passed around via LLSD. LLIntTracker generates random int keys to try to make it a little harder for one script to mess with an LLIntTracker instance belonging to another.
2024-08-30Change LLInstanceTracker::destruct() to erase().Nat Goodspeed
One could argue that LLInstanceTracker is a container of sorts, and erase() is more conventional. This affects no other code, as destruct() is not currently referenced.
2024-08-29Support next(), pairs(), ipairs() for LL.setdtor() table proxies.Nat Goodspeed
Replace the global next(), pairs() and ipairs() functions with a C++ function that drills down through layers of setdtor() proxy objects and then forwards the updated arguments to the original global function. Add a Luau __iter() metamethod to setdtor() proxy objects that, like other proxy metamethods, drills down to the underlying _target object. __iter() recognizes the case of a _target table which itself has a __iter() metamethod. Also add __idiv() metamethod to support integer division. Add tests for proxy // division, next(proxy), next(proxy, key), pairs(proxy), ipairs(proxy) and 'for k, v in proxy'. Also test the case where the table wrapped in the proxy has an __iter() metamethod of its own.
2024-08-29Add Lua script name to log messages.Nat Goodspeed
2024-08-29Merge branch 'develop' into marchcat/b-developAndrey Lihatskiy
2024-08-28Ditch trailing spaces.Nat Goodspeed
2024-08-28Merge branch 'main' into release/luau-scripting.Nat Goodspeed
2024-08-28Prevent erroneous assignment to LL.setdtor() proxy._target field.Nat Goodspeed
Trim redundant output from test_setdtor.lua.
2024-08-28Attempt to get better file/line info for LL_ERRS crahses in bugsplat. (#2447)Brad Linden
secondlife/viewer#2445
2024-08-28Add `LL.setdtor()` function to add a "destructor" to any Lua object.Nat Goodspeed
`setdtor('description', object, function)` returns a proxy userdata object referencing object and function. When the proxy is garbage-collected, or at the end of the script, its destructor calls `function(object)`. The original object may be retrieved as `proxy._target`, e.g. to pass it to the `table` library. The proxy also has a metatable with metamethods supporting arithmetic operations, string concatenation, length and table indexing. For other operations, retrieve `proxy._target`. (But don't assign to `proxy._target`. It will appear to work, in that subsequent references to `proxy._target` will retrieve the replacement object -- however, the destructor will still call `function(original object)`.) Fix bugs in `lua_setfieldv()`, `lua_rawgetfield()` and `lua_rawsetfield()`. Add C++ functions `lua_destroyuserdata()` to explicitly destroy a `lua_emplace<T>()` userdata object, plus `lua_destroybounduserdata()`. The latter can bind such a userdata object as an upvalue to pass to `LL.atexit()`. Make `LL.help()` and `LL.leaphelp()` help text include the `LL.` prefix.
2024-08-28Remove obsolete, unreferenced DESTRINGIZE(), DEWSTRINGIZE() macros.Nat Goodspeed
2024-08-27code clean upMnikolenko Productengine
2024-08-26Improve safety of macOS available RAM calcuations at suggestion of Ansariel ↵Brad Linden
and Beq (#2423)
2024-08-26secondlife/viewer#2391: Remove avatar rigging "callstack" loggingCosmic Linden
2024-08-26Remove or suppress left over debug messages in hot paths (#2392)Rye Mutt
2024-08-21Merge branch 'release/luau-scripting' into lua-inventoryMaxim Nikolenko
2024-08-21Merge branch 'develop' into marchcat/b-developAndrey Lihatskiy
# Conflicts: # indra/newview/llvoicewebrtc.cpp
2024-08-21Improve diagnostic output for Lua atexit() functions.Nat Goodspeed
2024-08-21Suppress ~LuaStackDelta() verification during stack unwinding.Nat Goodspeed
Otherwise, an exception raised in the block containing a LuaStackDelta instance -- that might be caught -- would result in an LL_ERRS() crash. We can't expect a block exited via exception to keep its contract wrt the Lua data stack.
2024-08-20Fix for #2237: intermittent Lua data stack overflow.Nat Goodspeed
Use a static unordered_map to allow a function receiving (lua_State* L) to look up the LuaState instance managing that lua_State. We've thought about this from time to time already. LuaState's constructor creates the map entry; its destructor removes it; the new static getParent(lua_State* L) method performs the lookup. Migrate lluau::set_interrupts_counter() and check_interrupts_counter() into LuaState member functions. Add a new mInterrupts counter for them. Importantly, LuaState::check_interrupts_counter(), which is indirectly called by a lua_callbacks().interrupt function, no longer performs any Lua stack operations. Empirically, it seems the Lua engine is capable of interrupting itself at a moment when re-entry confuses it. Change previous lluau::set_interrupts_counter(L, 0) calls to LuaState::getParent(L).set_interrupts_counter(0). Also add LuaStackDelta class, and a lua_checkdelta() helper macro, to verify that the Lua data stack depth on exit from a block differs from the depth on entry by exactly the expected amount. Sprinkle lua_checkdelta() macros in likely places.
2024-08-20Fix TempSet to use type VAR to store mOldValue.Nat Goodspeed
In fact we set mOldValue from mVar, and restore mVar from mOldValue, so the VAR type makes the most sense. The previous way, you'd get actual errors if you tried to use TempSet(pointervar, nullptr): that declared mOldValue to be nullptr_t, which you can't initialize from mVar.
2024-08-20Add LL::scope_exitNat Goodspeed
2024-08-20Add collectDescendentsIf api for LuaMnikolenko Productengine
2024-08-20include <memory> for dstd::unique_ptr templateNicky
2024-08-20Merge remote-tracking branch 'origin/release/2024.06-atlasaurus' into developBrad Linden
# Conflicts: # autobuild.xml # indra/newview/llvoicewebrtc.cpp
2024-08-20Clean up boost includes and remove compiler warning pragma for unreachable ↵Ansariel Hiller
code in PCH (#2361)
2024-08-20Post-merge build fix (#2059)Andrey Lihatskiy
2024-08-20Merge branch 'develop' into marchcat/b-developAndrey Lihatskiy
# Conflicts: # .github/workflows/build.yaml # autobuild.xml # indra/cmake/Copy3rdPartyLibs.cmake # indra/cmake/FreeType.cmake # indra/newview/llappviewer.cpp # indra/newview/skins/default/xui/en/floater_fast_timers.xml # indra/newview/viewer_manifest.py # indra/test/test.cpp
2024-08-20Remove orphaned LLAllocator (#2348)Ansariel Hiller
2024-08-19Refactor LLFileSystem for and fix an old issue in LLFile (#2332)Ansariel Hiller
2024-08-15First batch of Inventory api; raise interrupts limitMnikolenko Productengine
2024-08-15Merge remote-tracking branch 'origin/release/webrtc-voice' into ↵Brad Linden
release/2024.06-atlasaurus
2024-08-15BugSplat Crash #1504587: std::vector::empty()Alexander Gavriliuk
2024-08-15Merge branch 'release/luau-scripting' into viewer-lua-2237Nat Goodspeed
2024-08-15Introduce lluau_checkstack(L, n); use instead of luaL_checkstack().Nat Goodspeed
luaL_checkstack() accepts a third parameter which is included in the stack overflow error message. We've been passing nullptr, leading to messages of the form "stack overflow ((null))". lluau_checkstack() implicitly passes __FUNCTION__, so we can distinguish which underlying luaL_checkstack() call encountered the stack overflow condition. Also, when calling each atexit() function, pass Luau's debug.traceback() function as the lua_pcall() error handler. This should help diagnose errors in atexit() functions.
2024-08-14Enable /permissive- on MSVC for better standards conformance (#2251)Rye Mutt
* Enable /permissive- on MSVC for better C++ conformance and fix related errors * Clean up left over warning suppressions from old library or msvc versions
2024-08-13Introduce tracy instrumentation of mutex in LLSingleton, LLInstanceTracker ↵Rye Mutt
and logging
2024-08-13Update tracy integration to 0.11 and rework client library to be ↵Rye Mutt
configurable at build time Also copy tracy profiler client next to windows binary when enabled
2024-08-13Merge pull request #2265 from secondlife/lua-groupchat-throttleMaxim Nikolenko
Add Throttle and LogThrottle classes to manage throttled APIs.