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
//! `MethodDef` table loader implementation for .NET metadata processing.
//!
//! This module provides the [`crate::metadata::tables::methoddef::loader::MethodDefLoader`] responsible for loading and processing
//! `MethodDef` metadata table entries. The `MethodDef` table defines method implementations
//! within types, including method signatures, implementation details, and parameter
//! information essential for method invocation and reflection in .NET applications.
//!
//! # Architecture
//!
//! The loader implements a comprehensive method processing pipeline:
//! - **Parallel Processing**: Uses rayon for concurrent method definition loading
//! - **Parameter Resolution**: Resolves method parameters through Param and ParamPtr tables
//! - **Signature Parsing**: Parses method signatures from blob heap for type information
//! - **Name Resolution**: Resolves method names and parameter names from strings heap
//! - **Ownership Management**: Converts raw entries to owned structures for runtime use
//!
//! # Purpose
//!
//! The `MethodDef` table is fundamental to type system implementation and method execution:
//! - **Method Implementation**: Concrete method definitions with IL code or native implementations
//! - **Signature Information**: Method parameters, return types, and calling conventions
//! - **Access Control**: Method visibility and security attributes
//! - **Virtual Dispatch**: Method overriding and interface implementation support
//! - **Reflection Support**: Runtime method discovery and dynamic invocation
//! - **P/Invoke Integration**: Platform invocation service for external library calls
//!
//! # Method Implementation Types
//!
//! `MethodDef` entries support different implementation patterns:
//! - **IL Methods**: Managed code with Common Intermediate Language implementation
//! - **Native Methods**: Platform-specific native code implementations
//! - **Abstract Methods**: Interface or abstract class method declarations
//! - **P/Invoke Methods**: Platform invocation service for external library calls
//! - **Runtime Methods**: Special methods implemented by the runtime system
//! - **Constructor Methods**: Instance and static constructor implementations
//! - **Property Accessors**: Getter, setter, and other property-related methods
//! - **Event Handlers**: Add, remove, and fire methods for event implementations
//!
//! # Loading Pipeline
//!
//! 1. **Dependency Validation**: Ensure Param and ParamPtr tables are loaded
//! 2. **Parallel Processing**: Process MethodDef entries concurrently using rayon
//! 3. **Parameter Resolution**: Resolve parameter information for each method
//! 4. **Signature Parsing**: Parse method signatures from blob heap
//! 5. **Name Resolution**: Resolve method and parameter names from strings heap
//! 6. **Storage**: Store completed method definitions in concurrent map
//!
//! # Table Dependencies
//!
//! - **Param**: Required for resolving method parameter metadata and names
//! - **ParamPtr**: Required for parameter pointer indirection (if present)
//!
//! # Thread Safety
//!
//! All components in this module are designed for safe concurrent access:
//! - [`crate::metadata::tables::methoddef::loader::MethodDefLoader`] is [`std::marker::Send`] and [`std::marker::Sync`]
//! - Loading operations use parallel processing via rayon for optimal performance
//! - Method definition storage uses thread-safe concurrent data structures
//! - Parameter resolution is coordinated safely across multiple threads
//!
//! # Integration
//!
//! This module integrates with:
//! - [`crate::metadata::tables::methoddef::raw`] - Raw MethodDef table representation
//! - [`crate::metadata::tables::param`] - Parameter table for method parameters
//! - [`crate::metadata::method`] - Method definition types and containers
//! - [`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.26 for the `MethodDef` table specification
//! - Table ID: 0x06
//! - Purpose: Define method implementations within types
use crate::;
/// Loader implementation for the `MethodDef` metadata table.
///
/// This loader processes method definition metadata, establishing complete method
/// implementations with parameter information and signature details. It handles
/// parameter resolution, signature parsing, and creates comprehensive method
/// definition objects for type system integration.
///
/// # Loading Strategy
///
/// The loader implements a sophisticated processing strategy:
/// - **Concurrent Processing**: Uses parallel iteration for optimal performance
/// - **Dependency Management**: Ensures Param and ParamPtr tables are available
/// - **Memory Efficiency**: Converts raw entries to owned structures only when needed
/// - **Error Handling**: Provides detailed error information for troubleshooting
///
/// # Thread Safety
///
/// [`MethodDefLoader`] 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 ;