The 'prototype' prop of a source function is, by default, an empty object with
a 'constructor' prop pointing back to the function. Currently, every source
function is created in this fashion, which makes it a circular reference
and thus prevents it from being freed until the Garbage Collector kicks in.
The performance impact comes from the function keeping a ref to the
enclosing scope, and since the scope is being held by it, the engine will
detach the scope, believing it to be used for the time being (until the
GC cleans it). This can cause substantial performance issues for such a
common case. The FFXIV Launcher, for example, leaks a large amount of such
short-lived functions and the enclosing scopes.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Implement a basic GC based on the mark-and-sweep algorithm, without requiring
manually specifying "roots", which vastly simplifies the code.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
On Windows processes sometimes start during test_services_exe() so that
the size returned by the first NtQuerySystemInformation() is no longer
sufficient for the second call.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54094
It looks like there was a change on the websocket test server that causes our
send operations to block. Reducing the size of the send buffer works around the
test failures. The tests still succeed on Windows, which suggests that native
sends large buffers in smaller chunks.
This fixes GCC12 warnings about accessing a too small object.
wine/dlls/msvcrt/tests/cpp.c: In function 'test_rtti':
wine/dlls/msvcrt/tests/cpp.c:1036:45: warning: array subscript 2 is outside array bounds of 'void[4]' [-Warray-bounds]
1036 | ok (casted == (char*)&child_class_sig0+8, "failed cast to simple_class (%p %p)\n", casted, &child_class_sig0);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~
Signed-off-by: Piotr Caban <piotr.caban@codeweavers.com>
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
GCC 12 complains about accessing a too small object.
In function 'test__AdjustPointer',
inlined from 'func_msvcr90' at wine/dlls/msvcr90/tests/msvcr90.c:2515:5:
wine/dlls/msvcr90/tests/msvcr90.c:1556:30: warning: array subscript 30 is outside array bounds of 'void[8]' [-Warray-bounds]
1556 | {&obj1, (char*)&obj1 + obj.off, {0, 0, 0}},
| ~~~~~~~~~~~~~^~~~~~~~~
Since we're only checking the addresses and not the underlying objects,
use uintptr_t instead of pointers.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>