1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! `ClassLayout` table module.
//!
//! This module provides complete support for the ECMA-335 `ClassLayout` metadata table (0x0F),
//! which contains explicit memory layout information for types that require specific field
//! positioning and packing. It includes raw table access, resolved data structures, collection
//! types, and integration with the broader type system.
//!
//! # Architecture
//!
//! The `ClassLayout` module follows the standard dual variant pattern with raw and owned
//! representations. Raw entries contain unresolved table indexes, while owned entries
//! provide fully resolved references integrated with type definition data.
//!
//! # Key Components
//!
//! - [`crate::metadata::tables::classlayout::raw::ClassLayoutRaw`] - Raw table structure with unresolved indexes
//! - [`crate::metadata::tables::classlayout::owned::ClassLayout`] - Owned variant with resolved references
//! - [`crate::metadata::tables::classlayout::loader::ClassLayoutLoader`] - Internal loader for processing table data
//! - [`crate::metadata::tables::classlayout::ClassLayoutMap`] - Token-based lookup map
//! - [`crate::metadata::tables::classlayout::ClassLayoutList`] - Collection type
//! - [`crate::metadata::tables::classlayout::ClassLayoutRc`] - Reference-counted pointer
//!
//! # `ClassLayout` Table Structure
//!
//! The `ClassLayout` table contains zero or more rows with these fields:
//! - **`PackingSize`**: Byte boundary alignment for fields (powers of 2: 1, 2, 4, 8, 16, etc.)
//! - **`ClassSize`**: Total size of the type in bytes (0 indicates automatic sizing)
//! - **Parent**: Reference to the corresponding `TypeDef` table entry
//!
//! # Usage Context
//!
//! `ClassLayout` is used for types that require explicit memory layout control:
//! - **Interop scenarios**: Types that need to match native C/C++ struct layouts
//! - **Performance optimization**: Cache-friendly field alignment and padding
//! - **Platform marshalling**: Ensuring consistent layout across platforms
//! - **Sequential layout**: Enforcing field order for binary compatibility
//! - **Explicit layout**: Supporting [StructLayout(LayoutKind.Explicit)] attributes
//!
//! # Memory Layout Types
//!
//! `ClassLayout` supports three primary layout strategies:
//! - **Auto**: Runtime determines optimal field arrangement for performance
//! - **Sequential**: Fields are laid out in declaration order with automatic padding
//! - **Explicit**: Each field has an explicitly specified byte offset
//!
//! # Integration
//!
//! This module integrates with:
//! - [`crate::metadata::tables::typedef`] - Type definition table entries
//! - [`crate::metadata::tables`] - Core metadata table infrastructure
//! - [`crate::metadata::token`] - Token-based metadata references
//! - [`crate::metadata::loader`] - Metadata loading system
//!
//! # References
//!
//! - [ECMA-335 II.22.8](https://ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_2012.pdf) - `ClassLayout` table specification
use SkipMap;
use Arc;
use crateToken;
pub use *;
pub use *;
pub use *;
pub use *;
/// Thread-safe map that holds the mapping of [`crate::metadata::token::Token`] to parsed [`crate::metadata::tables::classlayout::ClassLayout`] instances
///
/// Concurrent skip list-based map providing efficient lookups and insertions for
/// `ClassLayout` entries indexed by their metadata tokens.
pub type ClassLayoutMap = ;
/// Thread-safe vector that holds a list of [`crate::metadata::tables::classlayout::ClassLayout`] references for efficient access
///
/// Append-only vector using atomic operations for lock-free concurrent access,
/// optimized for scenarios with frequent reads of `ClassLayout` collections.
pub type ClassLayoutList = ;
/// Reference-counted smart pointer to a [`crate::metadata::tables::classlayout::ClassLayout`] instance for shared ownership
///
/// Provides shared ownership and automatic memory management for `ClassLayout` instances,
/// enabling safe sharing across multiple threads and contexts.
pub type ClassLayoutRc = ;