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
//! Owned `FieldRva` structures for the `FieldRva` metadata table.
//!
//! This module provides the [`FieldRva`] struct which represents field RVA
//! definitions with resolved references and owned data. Field RVAs specify
//! Relative Virtual Addresses for fields that have initial data stored in
//! the PE file.
//!
//! # Purpose
//! The `FieldRva` table enables static field initialization and data embedding:
//! - **Static field initialization**: Pre-computed initial values for static fields
//! - **Constant data**: Read-only data embedded directly in the PE file
//! - **Global variables**: Module-level data with specific initial states
//! - **Interop data**: Native data structures for P/Invoke operations
//! - **Resource embedding**: Binary resources accessible through field references
//!
//! # RVA Context
//! RVAs provide data location information:
//! - **PE file integration**: Data stored within PE file sections
//! - **Memory mapping**: Direct access to data when PE is memory-mapped
//! - **File offset calculation**: RVA + section base → file offset
//! - **Type-safe access**: Field type determines data interpretation
//!
//! # ECMA-335 Reference
//! See ECMA-335, Partition II, §22.19 for the `FieldRva` table specification.
use crate::;
/// Represents a field RVA definition with resolved references and owned data.
///
/// A field RVA specifies the Relative Virtual Address of initial data for a field
/// within the PE file. This enables static field initialization with pre-computed
/// values and embedding of constant data directly in the assembly.
///
/// # RVA Usage
/// Field RVAs are used in various scenarios:
/// - **Static arrays**: Pre-initialized array data for static fields
/// - **Constant strings**: String literals embedded in the PE file
/// - **Numeric constants**: Pre-computed values for mathematical constants
/// - **Lookup tables**: Read-only data tables for algorithms
/// - **Configuration data**: Default settings and application parameters
///
/// # Data Access
/// The RVA enables direct access to field data:
/// ```text
/// 1. RVA points to data location in PE file
/// 2. Field type determines data size and interpretation
/// 3. Runtime loads data from RVA location
/// 4. Data becomes field's initial value
/// ```
///
/// # PE File Integration
/// Field RVAs integrate with PE file structure:
/// - **Section placement**: Data positioned in appropriate PE sections
/// - **Memory alignment**: Data aligned for efficient access
/// - **Protection flags**: Sections marked with correct read/write permissions
/// - **Relocation handling**: RVAs adjusted during PE loading
///
/// # ECMA-335 Reference
/// See ECMA-335, Partition II, §22.19 for the complete `FieldRva` table specification.