From a30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Sun, 29 Dec 2019 21:13:12 -0800 Subject: Move Type-related functions into Type class (NFC) (#2556) 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`. --- src/passes/SafeHeap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/passes/SafeHeap.cpp') diff --git a/src/passes/SafeHeap.cpp b/src/passes/SafeHeap.cpp index 37610a90b..fc6706f3e 100644 --- a/src/passes/SafeHeap.cpp +++ b/src/passes/SafeHeap.cpp @@ -176,7 +176,7 @@ struct SafeHeap : public Pass { load.type = type; for (Index bytes : {1, 2, 4, 8, 16}) { load.bytes = bytes; - if (bytes > getTypeSize(type) || (type == f32 && bytes != 4) || + if (bytes > type.getByteSize() || (type == f32 && bytes != 4) || (type == f64 && bytes != 8) || (type == v128 && bytes != 16)) { continue; } @@ -212,7 +212,7 @@ struct SafeHeap : public Pass { store.type = none; for (Index bytes : {1, 2, 4, 8, 16}) { store.bytes = bytes; - if (bytes > getTypeSize(valueType) || + if (bytes > valueType.getByteSize() || (valueType == f32 && bytes != 4) || (valueType == f64 && bytes != 8) || (valueType == v128 && bytes != 16)) { -- cgit v1.2.3