Skip to content

Commit b62b95e

Browse files
committed
Add PYSLICE to spell-checker ignore in slice.rs
1 parent c579e40 commit b62b95e

5 files changed

Lines changed: 19 additions & 17 deletions

File tree

crates/vm/src/builtins/dict.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ impl fmt::Debug for PyDict {
6262
}
6363
}
6464

65-
// spell-checker:ignore MAXFREELIST
66-
const PYDICT_MAXFREELIST: usize = 80;
67-
6865
thread_local! {
6966
static DICT_FREELIST: Cell<Vec<*mut PyObject>> = const { Cell::new(Vec::new()) };
7067
}
7168

7269
impl PyPayload for PyDict {
70+
// spell-checker:ignore MAXFREELIST
71+
/// PyDict_MAXFREELIST
72+
const MAX_FREELIST: usize = 80;
7373
const HAS_FREELIST: bool = true;
7474

7575
#[inline]
@@ -81,7 +81,7 @@ impl PyPayload for PyDict {
8181
unsafe fn freelist_push(obj: *mut PyObject) -> bool {
8282
DICT_FREELIST.with(|fl| {
8383
let mut list = fl.take();
84-
let stored = if list.len() < PYDICT_MAXFREELIST {
84+
let stored = if list.len() < Self::MAX_FREELIST {
8585
list.push(obj);
8686
true
8787
} else {

crates/vm/src/builtins/float.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ impl PyFloat {
3434
}
3535
}
3636

37-
// spell-checker:ignore MAXFREELIST
38-
const PYFLOAT_MAXFREELIST: usize = 100;
39-
4037
thread_local! {
4138
static FLOAT_FREELIST: Cell<Vec<*mut PyObject>> = const { Cell::new(Vec::new()) };
4239
}
4340

4441
impl PyPayload for PyFloat {
42+
// spell-checker:ignore MAXFREELIST
43+
/// PyFloat_MAXFREELIST
44+
const MAX_FREELIST: usize = 100;
4545
const HAS_FREELIST: bool = true;
4646

4747
#[inline]
@@ -53,7 +53,7 @@ impl PyPayload for PyFloat {
5353
unsafe fn freelist_push(obj: *mut PyObject) -> bool {
5454
FLOAT_FREELIST.with(|fl| {
5555
let mut list = fl.take();
56-
let stored = if list.len() < PYFLOAT_MAXFREELIST {
56+
let stored = if list.len() < Self::MAX_FREELIST {
5757
list.push(obj);
5858
true
5959
} else {

crates/vm/src/builtins/list.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ unsafe impl Traverse for PyList {
7474
}
7575
}
7676

77-
// spell-checker:ignore MAXFREELIST
78-
const PYLIST_MAXFREELIST: usize = 80;
79-
8077
thread_local! {
8178
static LIST_FREELIST: Cell<Vec<*mut PyObject>> = const { Cell::new(Vec::new()) };
8279
}
8380

8481
impl PyPayload for PyList {
82+
// spell-checker:ignore MAXFREELIST
83+
/// PyList_MAXFREELIST
84+
const MAX_FREELIST: usize = 80;
8585
const HAS_FREELIST: bool = true;
8686

8787
#[inline]
@@ -93,7 +93,7 @@ impl PyPayload for PyList {
9393
unsafe fn freelist_push(obj: *mut PyObject) -> bool {
9494
LIST_FREELIST.with(|fl| {
9595
let mut list = fl.take();
96-
let stored = if list.len() < PYLIST_MAXFREELIST {
96+
let stored = if list.len() < Self::MAX_FREELIST {
9797
list.push(obj);
9898
true
9999
} else {

crates/vm/src/builtins/slice.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ pub struct PySlice {
2525
pub step: Option<PyObjectRef>,
2626
}
2727

28-
// spell-checker:ignore MAXFREELIST
29-
// PySlice_MAXFREELIST = 1
30-
const PYSLICE_MAXFREELIST: usize = 1;
31-
3228
thread_local! {
3329
static SLICE_FREELIST: Cell<Vec<*mut PyObject>> = const { Cell::new(Vec::new()) };
3430
}
3531

3632
impl PyPayload for PySlice {
33+
// spell-checker:ignore MAXFREELIST
34+
/// PySlice_MAXFREELIST
35+
const MAX_FREELIST: usize = 1;
3736
const HAS_FREELIST: bool = true;
3837

3938
#[inline]
@@ -45,7 +44,7 @@ impl PyPayload for PySlice {
4544
unsafe fn freelist_push(obj: *mut PyObject) -> bool {
4645
SLICE_FREELIST.with(|fl| {
4746
let mut list = fl.take();
48-
let stored = if list.len() < PYSLICE_MAXFREELIST {
47+
let stored = if list.len() < Self::MAX_FREELIST {
4948
list.push(obj);
5049
true
5150
} else {

crates/vm/src/object/payload.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pub trait PyPayload: MaybeTraverse + PyThreadingConstraint + Sized + 'static {
5252
/// race conditions when the object is reused.
5353
const HAS_FREELIST: bool = false;
5454

55+
/// Maximum number of objects to keep in the freelist.
56+
const MAX_FREELIST: usize = 0;
57+
5558
/// Try to push a dead object onto this type's freelist for reuse.
5659
/// Returns true if the object was stored (caller must NOT free the memory).
5760
///

0 commit comments

Comments
 (0)