+1
-2
Cargo.toml
+1
-2
Cargo.toml
+2
-13
src/main.rs
+2
-13
src/main.rs
···
50
50
program_counter: Platter,
51
51
registers: [Platter; 8],
52
52
memory: Vec<SmallVec<[Platter; SMALLVEC_SIZE]>>,
53
-
#[cfg(feature = "reclaim-memory")]
54
53
free_blocks: Vec<Platter>,
55
54
ops: Vec<Operation>,
56
55
stdin: Option<&'a mut dyn Read>,
···
269
268
&self.memory[0]
270
269
}
271
270
272
-
#[cfg(not(feature = "reclaim-memory"))]
273
-
fn allocate_memory(&mut self, length: Platter) -> Platter {
274
-
self.memory.push(Self::new_block(length.into_index()));
275
-
(self.memory.len() - 1) as Platter
276
-
}
277
-
278
-
#[cfg(feature = "reclaim-memory")]
279
271
fn allocate_memory(&mut self, length: Platter) -> Platter {
280
272
if let Some(index) = self.free_blocks.pop() {
281
273
self.memory[index.into_index()] = Self::new_block(length.into_index());
···
288
280
289
281
fn free_memory(&mut self, block: Platter) {
290
282
assert!(block.into_index() < self.memory.len());
291
-
#[cfg(feature = "reclaim-memory")]
292
-
{
293
-
self.free_blocks.push(block);
294
-
self.memory[block.into_index()] = Self::new_block(0);
295
-
}
283
+
self.free_blocks.push(block);
284
+
self.memory[block.into_index()] = Self::new_block(0);
296
285
}
297
286
298
287
fn new_block(len: usize) -> SmallVec<[Platter; SMALLVEC_SIZE]> {