Skip to content

Commit b870090

Browse files
Auto-format: cargo fmt --all
1 parent 5ac7f95 commit b870090

1 file changed

Lines changed: 22 additions & 32 deletions

File tree

crates/vm/src/frame.rs

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::{
66
TryFromObject, VirtualMachine,
77
builtins::{
88
PyBaseException, PyBaseExceptionRef, PyBaseObject, PyCode, PyCoroutine, PyDict, PyDictRef,
9-
PyFloat, PyGenerator, PyInt, PyInterpolation, PyList, PyModule, PyProperty, PySet, PySlice, PyStr,
10-
PyStrInterned, PyTemplate, PyTraceback, PyType, PyUtf8Str,
9+
PyFloat, PyGenerator, PyInt, PyInterpolation, PyList, PyModule, PyProperty, PySet, PySlice,
10+
PyStr, PyStrInterned, PyTemplate, PyTraceback, PyType, PyUtf8Str,
1111
asyncgenerator::PyAsyncGenWrappedValue,
1212
builtin_func::PyNativeFunction,
1313
descriptor::{MemberGetter, PyMemberDescriptor, PyMethodDescriptor},
@@ -2793,9 +2793,12 @@ impl ExecutingFrame<'_> {
27932793
let instr_idx = self.lasti() as usize - 1;
27942794
let cache_base = instr_idx + 1;
27952795
unsafe {
2796-
self.code
2797-
.instructions
2798-
.replace_op(instr_idx, Instruction::Send { target: Arg::marker() });
2796+
self.code.instructions.replace_op(
2797+
instr_idx,
2798+
Instruction::Send {
2799+
target: Arg::marker(),
2800+
},
2801+
);
27992802
self.code
28002803
.instructions
28012804
.write_adaptive_counter(cache_base, ADAPTIVE_BACKOFF_VALUE);
@@ -3159,8 +3162,7 @@ impl ExecutingFrame<'_> {
31593162
let owner = self.top_value();
31603163
let type_version = self.code.instructions.read_cache_u32(cache_base + 1);
31613164

3162-
if type_version != 0 && owner.class().tp_version_tag.load(Acquire) == type_version
3163-
{
3165+
if type_version != 0 && owner.class().tp_version_tag.load(Acquire) == type_version {
31643166
let slot_offset =
31653167
self.code.instructions.read_cache_u32(cache_base + 3) as usize;
31663168
if let Some(value) = owner.get_slot(slot_offset) {
@@ -3193,12 +3195,10 @@ impl ExecutingFrame<'_> {
31933195
let owner = self.top_value();
31943196
let type_version = self.code.instructions.read_cache_u32(cache_base + 1);
31953197

3196-
if type_version != 0 && owner.class().tp_version_tag.load(Acquire) == type_version
3197-
{
3198+
if type_version != 0 && owner.class().tp_version_tag.load(Acquire) == type_version {
31983199
let descr_ptr = self.code.instructions.read_cache_u64(cache_base + 5);
31993200
if descr_ptr != 0 {
3200-
let descr =
3201-
unsafe { &*(descr_ptr as *const PyObject) };
3201+
let descr = unsafe { &*(descr_ptr as *const PyObject) };
32023202
if let Some(prop) = descr.downcast_ref::<PyProperty>() {
32033203
let owner = self.pop_value();
32043204
if let Some(getter) = prop.get_fget() {
@@ -3991,9 +3991,7 @@ impl ExecutingFrame<'_> {
39913991
let nargs: u32 = arg.into();
39923992
let callable = self.nth_value(nargs + 1);
39933993
let callable_tag = callable as *const PyObject as u32;
3994-
if cached_tag == callable_tag
3995-
&& callable.downcast_ref::<PyType>().is_some()
3996-
{
3994+
if cached_tag == callable_tag && callable.downcast_ref::<PyType>().is_some() {
39973995
let args = self.collect_positional_args(nargs);
39983996
let self_or_null = self.pop_value_opt();
39993997
let callable = self.pop_value();
@@ -4224,9 +4222,7 @@ impl ExecutingFrame<'_> {
42244222
unsafe {
42254223
self.code.instructions.replace_op(
42264224
self.lasti() as usize - 1,
4227-
Instruction::LoadSuperAttr {
4228-
arg: Arg::marker(),
4229-
},
4225+
Instruction::LoadSuperAttr { arg: Arg::marker() },
42304226
);
42314227
let cache_base = self.lasti() as usize;
42324228
self.code
@@ -4297,9 +4293,7 @@ impl ExecutingFrame<'_> {
42974293
unsafe {
42984294
self.code.instructions.replace_op(
42994295
self.lasti() as usize - 1,
4300-
Instruction::LoadSuperAttr {
4301-
arg: Arg::marker(),
4302-
},
4296+
Instruction::LoadSuperAttr { arg: Arg::marker() },
43034297
);
43044298
let cache_base = self.lasti() as usize;
43054299
self.code
@@ -6306,9 +6300,9 @@ impl ExecutingFrame<'_> {
63066300
descr_cls.slots.descr_get.load().is_some()
63076301
&& descr_cls.slots.descr_set.load().is_some()
63086302
});
6309-
let has_descr_get = cls_attr.as_ref().is_some_and(|descr| {
6310-
descr.class().slots.descr_get.load().is_some()
6311-
});
6303+
let has_descr_get = cls_attr
6304+
.as_ref()
6305+
.is_some_and(|descr| descr.class().slots.descr_get.load().is_some());
63126306

63136307
if has_data_descr {
63146308
// Check for member descriptor (slot access)
@@ -6368,10 +6362,9 @@ impl ExecutingFrame<'_> {
63686362
self.code
63696363
.instructions
63706364
.write_cache_u64(cache_base + 5, descr_ptr);
6371-
self.code.instructions.replace_op(
6372-
instr_idx,
6373-
Instruction::LoadAttrNondescriptorWithValues,
6374-
);
6365+
self.code
6366+
.instructions
6367+
.replace_op(instr_idx, Instruction::LoadAttrNondescriptorWithValues);
63756368
}
63766369
} else {
63776370
// No class attr, must be in instance dict
@@ -6675,9 +6668,7 @@ impl ExecutingFrame<'_> {
66756668
}
66766669

66776670
// Try to specialize method descriptor calls
6678-
if self_or_null_is_some
6679-
&& callable.downcast_ref::<PyMethodDescriptor>().is_some()
6680-
{
6671+
if self_or_null_is_some && callable.downcast_ref::<PyMethodDescriptor>().is_some() {
66816672
let callable_tag = callable as *const PyObject as u32;
66826673
let new_op = match nargs {
66836674
0 => Instruction::CallMethodDescriptorNoargs,
@@ -7301,8 +7292,7 @@ impl ExecutingFrame<'_> {
73017292
let cls_attr = cls.get_attr(attr_name);
73027293
let has_data_descr = cls_attr.as_ref().is_some_and(|descr| {
73037294
let descr_cls = descr.class();
7304-
descr_cls.slots.descr_get.load().is_some()
7305-
&& descr_cls.slots.descr_set.load().is_some()
7295+
descr_cls.slots.descr_get.load().is_some() && descr_cls.slots.descr_set.load().is_some()
73067296
});
73077297

73087298
if has_data_descr {

0 commit comments

Comments
 (0)