We are currently not initializing static values to zero by default.
Consider the following shader:
```hlsl
static float4 va;
float4 main() : sv_target
{
return va;
}
```
we get the following output:
```
ps_5_0
dcl_output o0.xyzw
dcl_temps 2
mov r0.xyzw, r1.xyzw
mov o0.xyzw, r0.xyzw
ret
```
where r1.xyzw is not initialized.
This patch solves this by assigning the static variable the value of an
uint 0, and thus, relying on complex broadcasts.
This seems to be the behaviour of the the native compiler, since it retrieves
the following error on a shader that lacks an initializer on a data type with
object components:
```
error X3017: cannot convert from 'uint' to 'struct <unnamed>'
```
--
v3: vkd3d-shader/hlsl: Allow uninitialized static objects.
vkd3d-shader/hlsl: Validate that non-uniform objects are not referenced.
tests: Add additional object references tests.
vkd3d-shader/hlsl: Initialize static variables to 0 by default.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/54
This implements the _RunAndWait member function and the constructor of the _StructuredTaskCollection, which enables the tests for that class to run.
Also adds a throw of a missing_wait exception to the destructor when chores are scheduled and _RunAndWait was not called.
Remaining stuff after this:
- Task collection cancelling + IsCancelling function (next MR)
- Cancellation token support (requires RE'ing the _CancellationTokenState class, currently in progress)
--
v4: msvcr120: Throw exception in ~_StructuredTaskCollection if _RunAndWait was not called.
msvcr100: Implement missing_wait exception.
msvcr110: Implement _StructuredTaskCollection constructor.
msvcr100: Implement exception passing from chore threads to _RunAndWait.
msvcr100: Factor out EXCEPTION_RECORD to exception_ptr conversion.
msvcr100: Move exception_ptr functions to a separate file.
msvcr100: Implement _StructuredTaskCollection::_RunAndWait.
https://gitlab.winehq.org/wine/wine/-/merge_requests/906
Implement a basic GC based on the mark-and-sweep algorithm, without requiring manually specifying "roots", which vastly simplifies the management. For now, it is triggered every 30 seconds since it last finished, on a new object initialization. Better heuristics could be used in the future.
The comments in the code should hopefully understand the high level logic of this approach without boilerplate details. I've tested it on FFXIV launcher (along with other patches from Proton to have it work) and it stops the massive memory leak successfully by itself, so at least it does its job properly. The last patch in the MR is just an optimization for a *very* common case.
For artificial testing, one could use something like:
```javascript
function leak() {
var a = {}, b = {};
a.b = b;
b.a = a;
}
```
which creates a circular ref and will leak when the function returns.
It also introduces and makes use of a "heap_stack", which prevents stack overflows on long chains.
--
v5: jscript: Create the source function's 'prototype' prop object on demand.
jscript: Run the garbage collector every 30 seconds on a new object
jscript: Implement CollectGarbage().
jscript: Implement a Garbage Collector to deal with circular references.
jscript: Use a jsdisp to hold refs for scopes.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1635
This implements the _RunAndWait member function and the constructor of the _StructuredTaskCollection, which enables the tests for that class to run.
Also adds a throw of a missing_wait exception to the destructor when chores are scheduled and _RunAndWait was not called.
Remaining stuff after this:
- Task collection cancelling + IsCancelling function (next MR)
- Cancellation token support (requires RE'ing the _CancellationTokenState class, currently in progress)
--
v3: msvcr120: Throw exception in _StructuredTaskCollection_dtor if _RunAndWait was not called.
msvcr100: Implement missing_wait exception.
msvcr110: Implement _StructuredTaskCollection constructor.
msvcr100: Implement exception passing from chore threads to _RunAndWait.
msvcr100: Factor out EXCEPTION_RECORD to exception_ptr conversion.
msvcr100: Move exception_ptr functions to a separate file.
msvcr100: Implement _StructuredTaskCollection::_RunAndWait.
https://gitlab.winehq.org/wine/wine/-/merge_requests/906