Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Apr 12, 2024

  • struct.new with default values can be struct.new_default.
  • array.new with default values can be array.new_default.
  • array.new of size 1 should be array.new_fixed (saves the Const).
  • array.new_fixed with default values can be array.new_default.
  • array.new_fixed with equal but non-default values can be array.new
    (basically use a Const to say how many copies we want, rather than copy).

@kripken kripken requested a review from tlively April 12, 2024 00:00
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@kripken kripken merged commit fb5608a into WebAssembly:main Apr 15, 2024
@kripken kripken deleted the new.def branch April 15, 2024 22:32
kripken added a commit that referenced this pull request Apr 23, 2024
…w_with_default (#6523)

Before we preferred not to add default values, as that increases code size. But since
#6495 we turn more things into struct.new_with default, so it is important to handle
this. It seems likely that in most cases the code size downside of adding default
values is offset by avoiding a local.set later, so always do this (rather than add some
kind of heuristic).
kripken added a commit that referenced this pull request May 15, 2024
…quality test (#6596)

This existed before #6495 but became noticeable there. We only looked at
the fallthrough values in the later part of areConsecutiveInputsEqual, but
there can be invalidation due to the non-fallthrough part:

(i32.add
  (local.get $x)
  (block
    (local.set $x ..)
    (local.get $x)
  )
)

The set can cause the local.get to differ the second time. To fix this,
check if the non-fallthrough part invalidates the fallthrough (but only
on the right hand side).

Fixes #6593
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants