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

Move Type-related functions into Type class (NFC) #2556

Merged
merged 4 commits into from
Dec 30, 2019

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Dec 25, 2019

Several type-related functions currently exist outside of Type
class and thus in the wasm, effectively global, namespace. This moves
these functions into Type class, making them either member functions
or static functions.

Also this renames getSize to getByteSize to make it not to be
confused with size, which returns the number of types in multiple
types. This also reorders the order of functions in wasm-type.cpp to
match that of wasm-type.h.

@aheejin aheejin requested review from kripken and tlively December 25, 2019 05:23
@aheejin aheejin force-pushed the type_method_refactor branch 2 times, most recently from a39dcda to 2be26a2 Compare December 25, 2019 05:30
@aheejin aheejin changed the title Convert Type-related functions to members (NFC) Move Type-related functions into Type class (NFC) Dec 25, 2019
Several type-related functions currently exist outside of `Type`
class and thus in the `wasm`, effectively global, namespace. This moves
these functions into `Type` class, making them either member functions
or static functions.

Also this renames `getSize` to `getByteSize` to make it not to be
confused with `size`, which returns the number of types in multiple
types. This also reorders the order of functions in `wasm-type.cpp` to
match that of `wasm-type.h`.
@aheejin aheejin force-pushed the type_method_refactor branch from 2be26a2 to 944ae89 Compare December 25, 2019 05:55
src/wasm-type.h Outdated

// Reinterpret an integer type to a float type with the same size and vice
// versa. Only single integer and float types are supported.
Type reinterpretType() const;
Copy link
Member

Choose a reason for hiding this comment

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

This can be just reinterpret I think, as that it's on a Type is now implicit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

src/wasm-type.h Outdated
FeatureSet getFeatures() const;

// Returns a type based on its size in bytes and whether it is a float type.
static Type getType(unsigned byteSize, bool float_);
Copy link
Member

Choose a reason for hiding this comment

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

likewise this can be Type::get()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@aheejin aheejin merged commit a30f1df into WebAssembly:master Dec 30, 2019
@aheejin aheejin deleted the type_method_refactor branch December 30, 2019 05:13
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