If we were to add `sixtyfps:🪟:Window` to the re_exports, then
this clashes. We might rename the former, but this is a cleaner naming
in any case.
Relates to #333
On Windows the default stack size is less than on Linux/macOS and
therefore an issues surfaces that is however operating system agnostic:
Due to inlining we generate quite big inner components with many fields.
Their field offsets are accumulated in the separate FIELD_OFFSETS
struct. The access pattern typically looks like this:
Self::FIELD_OFFSETS.some_field.apply_pin(...)
This is destructed into at least two smaller operations, fetching
some_field and then calling apply_pin with that field as self parameter.
In Rust debug builds the first operation, unfortunately, ends up making
a full copy of Self::FIELD_OFFSETS into a temporary variable on the
stack. Unfortunately also that stack space isn't reused, so every access
results in a new stack allocation to hold all of the FIELD_OFFSETS
structure (~5kb in the printer demo).
With so many accesses to that in the generated code, we run out of stack
space already in the new() function, in item_tree() as well as in the
Drop impl that also accesses all field offsets.
This patch applies the following workaround that does the trick. The
above expression is replaced with
{
let field = &Self::FIELD_OFFSETS.some_field;
*field
}.apply_pin(...)
Fixes#133
When images are loaded by the WASM-built interpreter, we do support
loading them asynchronously via the DOM. In that case we have a property
inside the HTMLImage in the GL backend that becomes dirty once loaded
and triggers re-evaluation of depending properties/layouts. However that
only works as long as uses of the image sizes are in property bindings.
BuiltinFunction::ImageSize however is marked as pure in the compiler, so
this may mean that something like this results in an initial assignment
instead of a binding:
Image {
source: ...
height: source.height * 1px;
}
For Rust, etc. that's fine, but when running in the WASM-built
interpreter the expression needs to remain in a binding. Therefore this
hack tries to narrow down this condition to wasm as target.
And do some passes before inlining
We will need the list of components before inlining in order to generate
them if we disable inlining
So we can do some passes on each component before they are inlining
I tried to put the flickable pass in that list, but it did not work
if the Flickable itself is the root of a component
In this case this feels at controversial, but in general I find this
clippy lint pretty helpful: It has caught several copy-paste errors
before.
No behavior change is intended with this patch.
Currently, it is a bit limited in the amount of property that it removes
because it will not remove property that are used by properties being
removed, or will consider setting properties as an usage
The generated code tries to compute the box layout info for an empty
repeater, where we end up calling `&*std::begin(cells)` and MSVC
asserts that this is dereferencing an invalid iterator. As Olivier spotted,
`std::data` comes to the assert-free rescue :-)