Skip to content

Commit 1ef94b6

Browse files
authored
Remove dead field in VMMap (#1320)
1 parent 0790db6 commit 1ef94b6

File tree

4 files changed

+1
-35
lines changed

4 files changed

+1
-35
lines changed

src/util/heap/layout/map.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,4 @@ pub trait VMMap: Sync {
8484
/// Get the space descriptor for the given address. Return SpaceDescriptor::UNINITIALIZED if the
8585
/// address is not within the MMTk heap range, or not within MMTk spaces.
8686
fn get_descriptor_for_address(&self, address: Address) -> SpaceDescriptor;
87-
88-
fn add_to_cumulative_committed_pages(&self, pages: usize);
8987
}

src/util/heap/layout/map32.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::util::heap::space_descriptor::SpaceDescriptor;
99
use crate::util::int_array_freelist::IntArrayFreeList;
1010
use crate::util::Address;
1111
use std::cell::UnsafeCell;
12-
use std::sync::atomic::{AtomicUsize, Ordering};
1312
use std::sync::{Mutex, MutexGuard};
1413

1514
pub struct Map32 {
@@ -27,12 +26,6 @@ pub struct Map32Inner {
2726
total_available_discontiguous_chunks: usize,
2827
finalized: bool,
2928
descriptor_map: Vec<SpaceDescriptor>,
30-
31-
// TODO: Is this the right place for this field?
32-
// This used to be a global variable. When we remove global states, this needs to be put somewhere.
33-
// Currently I am putting it here, as for where this variable is used, we already have
34-
// references to vm_map - so it is convenient to put it here.
35-
cumulative_committed_pages: AtomicUsize,
3629
}
3730

3831
unsafe impl Send for Map32 {}
@@ -51,7 +44,6 @@ impl Map32 {
5144
total_available_discontiguous_chunks: 0,
5245
finalized: false,
5346
descriptor_map: vec![SpaceDescriptor::UNINITIALIZED; max_chunks],
54-
cumulative_committed_pages: AtomicUsize::new(0),
5547
}),
5648
sync: Mutex::new(()),
5749
}
@@ -260,11 +252,6 @@ impl VMMap for Map32 {
260252
.copied()
261253
.unwrap_or(SpaceDescriptor::UNINITIALIZED)
262254
}
263-
264-
fn add_to_cumulative_committed_pages(&self, pages: usize) {
265-
self.cumulative_committed_pages
266-
.fetch_add(pages, Ordering::Relaxed);
267-
}
268255
}
269256

270257
impl Map32 {

src/util/heap/layout/map64.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::util::memory::MmapStrategy;
1010
use crate::util::raw_memory_freelist::RawMemoryFreeList;
1111
use crate::util::Address;
1212
use std::cell::UnsafeCell;
13-
use std::sync::atomic::{AtomicUsize, Ordering};
1413

1514
const NON_MAP_FRACTION: f64 = 1.0 - 8.0 / 4096.0;
1615

@@ -23,12 +22,6 @@ struct Map64Inner {
2322
descriptor_map: Vec<SpaceDescriptor>,
2423
base_address: Vec<Address>,
2524
high_water: Vec<Address>,
26-
27-
// TODO: Is this the right place for this field?
28-
// This used to be a global variable. When we remove global states, this needs to be put somewhere.
29-
// Currently I am putting it here, as for where this variable is used, we already have
30-
// references to vm_map - so it is convenient to put it here.
31-
cumulative_committed_pages: AtomicUsize,
3225
}
3326

3427
unsafe impl Send for Map64 {}
@@ -53,7 +46,6 @@ impl Map64 {
5346
high_water,
5447
base_address,
5548
finalized: false,
56-
cumulative_committed_pages: AtomicUsize::new(0),
5749
}),
5850
}
5951
}
@@ -212,12 +204,6 @@ impl VMMap for Map64 {
212204
SpaceDescriptor::UNINITIALIZED
213205
}
214206
}
215-
216-
fn add_to_cumulative_committed_pages(&self, pages: usize) {
217-
self.inner()
218-
.cumulative_committed_pages
219-
.fetch_add(pages, Ordering::Relaxed);
220-
}
221207
}
222208

223209
impl Map64 {

src/util/heap/pageresource.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::util::address::Address;
22
use crate::util::conversions;
33
use crate::util::freelist::FreeList;
44
use crate::util::opaque_pointer::*;
5-
use crate::vm::ActivePlan;
65
use std::sync::Mutex;
76

87
use super::layout::VMMap;
@@ -70,14 +69,10 @@ pub trait PageResource<VM: VMBinding>: 'static {
7069
* This *MUST* be called by each PageResource during the
7170
* allocPages, and the caller must hold the lock.
7271
*/
73-
fn commit_pages(&self, reserved_pages: usize, actual_pages: usize, tls: VMThread) {
72+
fn commit_pages(&self, reserved_pages: usize, actual_pages: usize, _tls: VMThread) {
7473
let delta = actual_pages - reserved_pages;
7574
self.common().accounting.reserve(delta);
7675
self.common().accounting.commit(actual_pages);
77-
if VM::VMActivePlan::is_mutator(tls) {
78-
self.vm_map()
79-
.add_to_cumulative_committed_pages(actual_pages);
80-
}
8176
}
8277

8378
fn reserved_pages(&self) -> usize {

0 commit comments

Comments
 (0)