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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
//! `MethodImpl` table loader implementation for .NET metadata processing.
//!
//! This module provides the [`crate::metadata::tables::methodimpl::loader::MethodImplLoader`] responsible for loading and processing
//! `MethodImpl` metadata table entries. The `MethodImpl` table defines method implementation
//! mappings that specify which concrete method implementation provides the behavior
//! for a given method declaration, essential for interface implementation and method
//! overriding in .NET type systems.
//!
//! # Architecture
//!
//! The loader implements a comprehensive method implementation mapping pipeline:
//! - **Parallel Processing**: Uses rayon for concurrent method implementation loading
//! - **Reference Resolution**: Resolves method and type references through coded indices
//! - **Mapping Application**: Applies implementation mappings to target types
//! - **Cross-Reference Building**: Establishes bidirectional implementation relationships
//! - **Validation**: Ensures implementation mappings are consistent and valid
//!
//! # Purpose
//!
//! The `MethodImpl` table is crucial for object-oriented programming and interface contracts:
//! - **Interface Implementation**: Maps interface method declarations to concrete implementations
//! - **Method Overriding**: Specifies which method implementations override base class methods
//! - **Explicit Implementation**: Handles explicit interface member implementation scenarios
//! - **Virtual Dispatch**: Establishes method resolution for polymorphic method calls
//! - **Generic Method Mapping**: Links generic method declarations to specialized implementations
//! - **Inheritance Support**: Enables proper method resolution in class hierarchies
//!
//! # Implementation Mapping Types
//!
//! `MethodImpl` entries support different kinds of method implementation scenarios:
//! - **Interface Implementations**: Concrete class methods implementing interface contracts
//! - **Virtual Method Overrides**: Derived class methods overriding base class virtual methods
//! - **Explicit Implementations**: Methods explicitly implementing specific interface members
//! - **Generic Specializations**: Specialized implementations for generic method instantiations
//! - **P/Invoke Mappings**: Native method implementations for managed method declarations
//! - **Abstract Method Implementations**: Concrete implementations of abstract method declarations
//!
//! # Loading Pipeline
//!
//! 1. **Dependency Validation**: Ensure TypeDef, TypeRef, MethodDef, and MemberRef tables are loaded
//! 2. **Parallel Processing**: Process MethodImpl entries concurrently using rayon
//! 3. **Reference Resolution**: Resolve class and method references through coded indices
//! 4. **Mapping Creation**: Create method implementation mapping objects
//! 5. **Application**: Apply mappings to target types for method resolution
//! 6. **Storage**: Store completed mappings in concurrent map
//!
//! # Table Dependencies
//!
//! - **TypeDef**: Required for resolving class types that contain implementation mappings
//! - **TypeRef**: Required for resolving external class types in inheritance scenarios
//! - **MethodDef**: Required for resolving concrete method implementations and declarations
//! - **MemberRef**: Required for resolving external method references in implementation mappings
//!
//! # Thread Safety
//!
//! All components in this module are designed for safe concurrent access:
//! - [`crate::metadata::tables::methodimpl::loader::MethodImplLoader`] is [`std::marker::Send`] and [`std::marker::Sync`]
//! - Loading operations use parallel processing via rayon for optimal efficiency
//! - Method implementation storage uses thread-safe concurrent data structures
//! - Reference resolution is coordinated safely across multiple threads
//!
//! # Integration
//!
//! This module integrates with:
//! - [`crate::metadata::tables::methodimpl::raw`] - Raw MethodImpl table representation
//! - [`crate::metadata::tables::typedef`] - Type definition table for class resolution
//! - [`crate::metadata::tables::methoddef`] - Method definition table for implementation resolution
//! - [`crate::metadata::loader`] - Metadata loading infrastructure and coordination
//!
//! # ECMA-335 Reference
//!
//! - [ECMA-335 Standard](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/)
//! - Partition II, ยง22.27 for the `MethodImpl` table specification
//! - Table ID: 0x19
//! - Purpose: Define method implementation mappings for interface and virtual method resolution
use crate::;
/// Loader implementation for the `MethodImpl` metadata table.
///
/// This loader processes method implementation mapping metadata, establishing connections
/// between method declarations and their concrete implementations. It handles interface
/// implementation mappings, method overriding relationships, and virtual dispatch
/// resolution for object-oriented programming support.
///
/// # Loading Strategy
///
/// The loader implements a sophisticated processing strategy:
/// - **Concurrent Processing**: Uses parallel iteration for optimal efficiency
/// - **Dependency Management**: Ensures TypeDef, TypeRef, MethodDef, and MemberRef tables are available
/// - **Reference Resolution**: Resolves coded indices to actual method and type references
/// - **Application Logic**: Applies implementation mappings to establish virtual method tables
///
/// # Thread Safety
///
/// [`MethodImplLoader`] is [`std::marker::Send`] and [`std::marker::Sync`], enabling safe concurrent use.
/// All operations are thread-safe and can be called from multiple threads simultaneously.
pub ;