зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824904 - part 3: add some division markers to WasmTypeDef.h. r=rhunt.
WasmTypeDef.h contains all the key data types for the wasm-gc extension. These are arranged more or less in a def-before-use ordering, which is good. But the file is still a bit hard to navigate. This patch adds dividing comments, and a few in WasmTypeDef.cpp too. No functional change. Differential Revision: https://phabricator.services.mozilla.com/D174062
This commit is contained in:
Родитель
adc407f8e4
Коммит
87829e0bc7
|
@ -70,6 +70,9 @@ using mozilla::IsPowerOfTwo;
|
||||||
// to the pointer representation.
|
// to the pointer representation.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// ImmediateType
|
||||||
|
|
||||||
// ImmediateType is 32-bits to ensure it's easy to materialize the constant
|
// ImmediateType is 32-bits to ensure it's easy to materialize the constant
|
||||||
// on all platforms.
|
// on all platforms.
|
||||||
using ImmediateType = uint32_t;
|
using ImmediateType = uint32_t;
|
||||||
|
@ -212,6 +215,9 @@ static ImmediateType EncodeImmediateFuncType(const FuncType& funcType) {
|
||||||
return immediate;
|
return immediate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// FuncType
|
||||||
|
|
||||||
void FuncType::initImmediateTypeId() {
|
void FuncType::initImmediateTypeId() {
|
||||||
if (!IsImmediateFuncType(*this)) {
|
if (!IsImmediateFuncType(*this)) {
|
||||||
immediateTypeId_ = NO_IMMEDIATE_TYPE_ID;
|
immediateTypeId_ = NO_IMMEDIATE_TYPE_ID;
|
||||||
|
@ -237,6 +243,9 @@ size_t FuncType::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const {
|
||||||
return args_.sizeOfExcludingThis(mallocSizeOf);
|
return args_.sizeOfExcludingThis(mallocSizeOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// StructType and StructLayout
|
||||||
|
|
||||||
static inline CheckedInt32 RoundUpToAlignment(CheckedInt32 address,
|
static inline CheckedInt32 RoundUpToAlignment(CheckedInt32 address,
|
||||||
uint32_t align) {
|
uint32_t align) {
|
||||||
MOZ_ASSERT(IsPowerOfTwo(align));
|
MOZ_ASSERT(IsPowerOfTwo(align));
|
||||||
|
@ -352,6 +361,9 @@ size_t TypeDef::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// SuperTypeVector
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
size_t SuperTypeVector::offsetOfTypeDefInVector(uint32_t typeDefDepth) {
|
size_t SuperTypeVector::offsetOfTypeDefInVector(uint32_t typeDefDepth) {
|
||||||
return offsetof(SuperTypeVector, types_) + sizeof(void*) * typeDefDepth;
|
return offsetof(SuperTypeVector, types_) + sizeof(void*) * typeDefDepth;
|
||||||
|
@ -439,6 +451,9 @@ const SuperTypeVector* SuperTypeVector::createMultipleForRecGroup(
|
||||||
return firstVector;
|
return firstVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// TypeIdSet and TypeContext
|
||||||
|
|
||||||
struct RecGroupHashPolicy {
|
struct RecGroupHashPolicy {
|
||||||
using Lookup = const SharedRecGroup&;
|
using Lookup = const SharedRecGroup&;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,9 @@ using mozilla::MallocSizeOf;
|
||||||
|
|
||||||
class RecGroup;
|
class RecGroup;
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// Function types
|
||||||
|
|
||||||
// The FuncType class represents a WebAssembly function signature which takes a
|
// The FuncType class represents a WebAssembly function signature which takes a
|
||||||
// list of value types and returns an expression type. The engine uses two
|
// list of value types and returns an expression type. The engine uses two
|
||||||
// in-memory representations of the argument Vector's memory (when elements do
|
// in-memory representations of the argument Vector's memory (when elements do
|
||||||
|
@ -220,8 +223,9 @@ class FuncType {
|
||||||
WASM_DECLARE_FRIEND_SERIALIZE(FuncType);
|
WASM_DECLARE_FRIEND_SERIALIZE(FuncType);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Structure type.
|
//=========================================================================
|
||||||
//
|
// Structure types
|
||||||
|
|
||||||
// The Module owns a dense array of StructType values that represent the
|
// The Module owns a dense array of StructType values that represent the
|
||||||
// structure types that the module knows about. It is created from the sparse
|
// structure types that the module knows about. It is created from the sparse
|
||||||
// array of types in the ModuleEnvironment when the Module is created.
|
// array of types in the ModuleEnvironment when the Module is created.
|
||||||
|
@ -377,7 +381,8 @@ class StructLayout {
|
||||||
CheckedInt32 close();
|
CheckedInt32 close();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Array type
|
//=========================================================================
|
||||||
|
// Array types
|
||||||
|
|
||||||
class ArrayType {
|
class ArrayType {
|
||||||
public:
|
public:
|
||||||
|
@ -446,6 +451,9 @@ WASM_DECLARE_CACHEABLE_POD(ArrayType);
|
||||||
|
|
||||||
using ArrayTypeVector = Vector<ArrayType, 0, SystemAllocPolicy>;
|
using ArrayTypeVector = Vector<ArrayType, 0, SystemAllocPolicy>;
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// SuperTypeVector
|
||||||
|
|
||||||
// [SMDOC] Super type vector
|
// [SMDOC] Super type vector
|
||||||
//
|
//
|
||||||
// A super type vector is a vector representation of the linked list of super
|
// A super type vector is a vector representation of the linked list of super
|
||||||
|
@ -552,6 +560,9 @@ class SuperTypeVector {
|
||||||
// `types_[0]`.
|
// `types_[0]`.
|
||||||
static_assert(offsetof(SuperTypeVector, types_) == sizeof(SuperTypeVector));
|
static_assert(offsetof(SuperTypeVector, types_) == sizeof(SuperTypeVector));
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// TypeDef and supporting types
|
||||||
|
|
||||||
// A tagged container for the various types that can be present in a wasm
|
// A tagged container for the various types that can be present in a wasm
|
||||||
// module's type section.
|
// module's type section.
|
||||||
|
|
||||||
|
@ -827,6 +838,9 @@ using TypeDefPtrToIndexMap =
|
||||||
HashMap<const TypeDef*, uint32_t, PointerHasher<const TypeDef*>,
|
HashMap<const TypeDef*, uint32_t, PointerHasher<const TypeDef*>,
|
||||||
SystemAllocPolicy>;
|
SystemAllocPolicy>;
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// RecGroup
|
||||||
|
|
||||||
// A recursion group is a set of type definitions that may refer to each other
|
// A recursion group is a set of type definitions that may refer to each other
|
||||||
// or to type definitions in another recursion group. There is an ordering
|
// or to type definitions in another recursion group. There is an ordering
|
||||||
// restriction on type references such that references across recursion groups
|
// restriction on type references such that references across recursion groups
|
||||||
|
@ -1032,6 +1046,9 @@ using SharedRecGroup = RefPtr<const RecGroup>;
|
||||||
using MutableRecGroup = RefPtr<RecGroup>;
|
using MutableRecGroup = RefPtr<RecGroup>;
|
||||||
using SharedRecGroupVector = Vector<SharedRecGroup, 0, SystemAllocPolicy>;
|
using SharedRecGroupVector = Vector<SharedRecGroup, 0, SystemAllocPolicy>;
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// TypeContext
|
||||||
|
|
||||||
// A type context holds the recursion groups and corresponding type definitions
|
// A type context holds the recursion groups and corresponding type definitions
|
||||||
// defined in a module.
|
// defined in a module.
|
||||||
class TypeContext : public AtomicRefCounted<TypeContext> {
|
class TypeContext : public AtomicRefCounted<TypeContext> {
|
||||||
|
@ -1167,6 +1184,9 @@ class TypeContext : public AtomicRefCounted<TypeContext> {
|
||||||
using SharedTypeContext = RefPtr<const TypeContext>;
|
using SharedTypeContext = RefPtr<const TypeContext>;
|
||||||
using MutableTypeContext = RefPtr<TypeContext>;
|
using MutableTypeContext = RefPtr<TypeContext>;
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// TypeHandle
|
||||||
|
|
||||||
// An unambiguous strong reference to a type definition in a specific type
|
// An unambiguous strong reference to a type definition in a specific type
|
||||||
// context.
|
// context.
|
||||||
class TypeHandle {
|
class TypeHandle {
|
||||||
|
@ -1190,6 +1210,9 @@ class TypeHandle {
|
||||||
const TypeDef& def() const { return context_->type(index_); }
|
const TypeDef& def() const { return context_->type(index_); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// misc
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
inline uintptr_t TypeDef::forMatch(const TypeDef* typeDef,
|
inline uintptr_t TypeDef::forMatch(const TypeDef* typeDef,
|
||||||
const RecGroup* recGroup) {
|
const RecGroup* recGroup) {
|
||||||
|
@ -1274,6 +1297,7 @@ inline bool RefType::isSubTypeOf(RefType subType, RefType superType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
// [SMDOC] Signatures and runtime types
|
// [SMDOC] Signatures and runtime types
|
||||||
//
|
//
|
||||||
// TypeIdDesc describes the runtime representation of a TypeDef suitable for
|
// TypeIdDesc describes the runtime representation of a TypeDef suitable for
|
||||||
|
|
Загрузка…
Ссылка в новой задаче