@@ -28,52 +28,42 @@ pub struct Program<F> {
28
28
deserialize_with = "deserialize_instructions_and_debug_infos"
29
29
) ]
30
30
pub instructions_and_debug_infos : Vec < Option < ( Instruction < F > , Option < DebugInfo > ) > > ,
31
- pub step : u32 ,
32
31
pub pc_base : u32 ,
33
32
}
34
33
35
34
#[ derive( Clone , Debug , Default ) ]
36
35
pub struct ProgramDebugInfo {
37
36
inner : Arc < Vec < Option < DebugInfo > > > ,
38
37
pc_base : u32 ,
39
- step : u32 ,
40
38
}
41
39
42
40
impl < F : Field > Program < F > {
43
- pub fn new_empty ( step : u32 , pc_base : u32 ) -> Self {
41
+ pub fn new_empty ( pc_base : u32 ) -> Self {
44
42
Self {
45
43
instructions_and_debug_infos : vec ! [ ] ,
46
- step,
47
44
pc_base,
48
45
}
49
46
}
50
47
51
- pub fn new_without_debug_infos (
52
- instructions : & [ Instruction < F > ] ,
53
- step : u32 ,
54
- pc_base : u32 ,
55
- ) -> Self {
48
+ pub fn new_without_debug_infos ( instructions : & [ Instruction < F > ] , pc_base : u32 ) -> Self {
56
49
Self {
57
50
instructions_and_debug_infos : instructions
58
51
. iter ( )
59
52
. map ( |instruction| Some ( ( instruction. clone ( ) , None ) ) )
60
53
. collect ( ) ,
61
- step,
62
54
pc_base,
63
55
}
64
56
}
65
57
66
58
pub fn new_without_debug_infos_with_option (
67
59
instructions : & [ Option < Instruction < F > > ] ,
68
- step : u32 ,
69
60
pc_base : u32 ,
70
61
) -> Self {
71
62
Self {
72
63
instructions_and_debug_infos : instructions
73
64
. iter ( )
74
65
. map ( |instruction| instruction. clone ( ) . map ( |instruction| ( instruction, None ) ) )
75
66
. collect ( ) ,
76
- step,
77
67
pc_base,
78
68
}
79
69
}
@@ -90,7 +80,6 @@ impl<F: Field> Program<F> {
90
80
. zip_eq ( debug_infos. iter ( ) )
91
81
. map ( |( instruction, debug_info) | Some ( ( instruction. clone ( ) , debug_info. clone ( ) ) ) )
92
82
. collect ( ) ,
93
- step : DEFAULT_PC_STEP ,
94
83
pc_base : 0 ,
95
84
}
96
85
}
@@ -107,7 +96,7 @@ impl<F: Field> Program<F> {
107
96
}
108
97
109
98
pub fn from_instructions ( instructions : & [ Instruction < F > ] ) -> Self {
110
- Self :: new_without_debug_infos ( instructions, DEFAULT_PC_STEP , 0 )
99
+ Self :: new_without_debug_infos ( instructions, 0 )
111
100
}
112
101
113
102
pub fn len ( & self ) -> usize {
@@ -138,7 +127,7 @@ impl<F: Field> Program<F> {
138
127
. flat_map ( |( index, option) | {
139
128
option. clone ( ) . map ( |( instruction, debug_info) | {
140
129
(
141
- self . pc_base + ( self . step * ( index as u32 ) ) ,
130
+ self . pc_base + ( DEFAULT_PC_STEP * ( index as u32 ) ) ,
142
131
instruction,
143
132
debug_info,
144
133
)
@@ -186,7 +175,6 @@ impl<F> Program<F> {
186
175
ProgramDebugInfo {
187
176
inner : Arc :: new ( debug_infos) ,
188
177
pc_base : self . pc_base ,
189
- step : self . step ,
190
178
}
191
179
}
192
180
}
@@ -218,9 +206,8 @@ impl ProgramDebugInfo {
218
206
/// ## Panics
219
207
/// If `pc` is out of bounds.
220
208
pub fn get ( & self , pc : u32 ) -> & Option < DebugInfo > {
221
- let step = self . step ;
222
209
let pc_base = self . pc_base ;
223
- let pc_idx = ( ( pc - pc_base) / step ) as usize ;
210
+ let pc_idx = ( ( pc - pc_base) / DEFAULT_PC_STEP ) as usize ;
224
211
& self . inner [ pc_idx]
225
212
}
226
213
}
@@ -295,7 +282,7 @@ mod tests {
295
282
296
283
#[ test]
297
284
fn test_program_serde ( ) {
298
- let mut program = Program :: < F > :: new_empty ( 4 , 0 ) ;
285
+ let mut program = Program :: < F > :: new_empty ( 0 ) ;
299
286
program. instructions_and_debug_infos . push ( Some ( (
300
287
Instruction :: from_isize ( VmOpcode :: from_usize ( 113 ) , 1 , 2 , 3 , 4 , 5 ) ,
301
288
None ,
0 commit comments