Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] Move enough of wasm-type.cpp into wasm-type.h to inline core is*() methods #6936

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

kripken
Copy link
Member

@kripken kripken commented Sep 12, 2024

This just moves code around. As a result, isRef() vanishes entirely from the
profiling traces in #6931, since now the core isRef/Tuple/etc. methods are
all inlineable.

This also required some reordering of wasm-type.h, namely to move HeapType
up front. No changes to that class otherwise.

TypeInfo is now in the header. getTypeInfo is now a static method on Type.

This has the downside of moving internal details into the header, but it
doesn't seem that dangerous to me. Another downside is that it will add to
compile times of Binaryen itself. But this makes the --precompute benchmark
from #6931 significantly faster, 33%, so I think it is worth it.

Comment on lines +264 to +265
// Internal only.
struct TypeInfo {
Copy link
Member

Choose a reason for hiding this comment

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

Can we put this and the method implementations that use it into a separate wasm-type-impl.h?

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting idea! It sounds like it would require at least 3 headers, though:

  1. One header for HeapType.
  2. One header for TypeInfo, which depends on HeapType (even a forward declaration is insufficient).
  3. One header for the rest of wasm-type.h

I'm not sure if that much splitting is worth it?

Copy link
Member

Choose a reason for hiding this comment

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

oof, nope. Scratch that idea.

@kripken kripken merged commit ed19e3f into WebAssembly:main Sep 16, 2024
13 checks passed
@kripken kripken deleted the type.nonBasic branch September 16, 2024 22:37
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