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
//! Raw `EventPtr` table representation.
//!
//! This module provides the [`crate::metadata::tables::eventptr::raw::EventPtrRaw`] struct
//! for low-level access to `EventPtr` metadata table data with unresolved indexes.
//! This represents the binary format of `EventPtr` records as they appear in the metadata
//! tables stream, providing indirection for event table access and requiring resolution
//! to create usable data structures.
//!
//! # `EventPtr` Table Format
//!
//! The `EventPtr` table (0x13) provides event indirection with this field:
//! - **Event** (2/4 bytes): Event table index pointing to the actual event
//!
//! `EventPtr` tables serve as an indirection layer for event access, primarily used
//! in edit-and-continue scenarios where the original event table ordering may have
//! been disrupted. The table maps logical event positions to physical event locations.
//!
//! # Indirection Mechanism
//!
//! When `EventPtr` is present:
//! 1. Event references resolve through `EventPtr` first
//! 2. `EventPtr` entries map logical indexes to actual Event table positions
//! 3. If `EventPtr` is absent, direct Event table indexing is used
//! 4. Enables non-sequential event ordering while maintaining logical consistency
//!
//! # Edit-and-Continue Support
//!
//! `EventPtr` tables are commonly found in assemblies that have undergone edit-and-continue
//! operations, where code modifications may require event relocation while preserving
//! existing metadata references.
//!
//! # Reference
//! - [ECMA-335 II.22.14](https://ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_2012.pdf) - `EventPtr` table specification
use Arc;
use crate::;
/// Raw `EventPtr` table row with unresolved event index
///
/// Represents the binary format of an `EventPtr` metadata table entry (table ID 0x13) as stored
/// in the metadata tables stream. `EventPtr` entries provide indirection for event table access,
/// primarily used in edit-and-continue scenarios where event ordering has been modified.
///
/// The `EventPtr` table serves as a mapping layer between logical event positions and physical
/// event locations in the Event table, enabling non-contiguous event arrangements while
/// maintaining consistent logical references.
///
/// # Indirection Logic
///
/// `EventPtr` provides the following indirection pattern:
/// - **Logical Index**: Position in `EventPtr` table (used by referencing metadata)
/// - **Physical Index**: Value stored in `EventPtr` entry (actual Event table position)
/// - **Resolution**: Logical → `EventPtr[Logical]` → `Event[Physical]`
///
/// # Edit-and-Continue Context
///
/// `EventPtr` tables are typically present only when needed for edit-and-continue scenarios:
/// - Original event ordering disrupted by code modifications
/// - Logical event references must remain stable across edit sessions
/// - Physical event locations may change but logical access remains consistent
///
/// # Reference
/// - [ECMA-335 II.22.14](https://ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_2012.pdf) - `EventPtr` table specification