MCPcopy Index your code
hub / github.com/RustPython/RustPython / unfreeze

Method unfreeze

crates/vm/src/gc_state.rs:811–826  ·  view source on GitHub ↗

Unfreeze all objects (move from permanent to gen2). Lock order: generation_lists[2] → permanent_list (consistent with freeze).

(&self)

Source from the content-addressed store, hash-verified

809 /// Unfreeze all objects (move from permanent to gen2).
810 /// Lock order: generation_lists[2] → permanent_list (consistent with freeze).
811 pub fn unfreeze(&self) {
812 let mut count = 0usize;
813
814 {
815 let mut gen2 = self.generation_lists[2].write();
816 let mut perm_list = self.permanent_list.write();
817 while let Some(ptr) = perm_list.pop_front() {
818 gen2.push_front(ptr);
819 unsafe { ptr.as_ref().set_gc_generation(2) };
820 count += 1;
821 }
822 self.permanent.count.store(0, Ordering::SeqCst);
823 }
824
825 self.generations[2].count.fetch_add(count, Ordering::SeqCst);
826 }
827
828 /// Reset all locks to unlocked state after fork().
829 ///

Callers 3

test_freezeMethod · 0.80
unfreezeFunction · 0.80

Calls 6

pop_frontMethod · 0.80
push_frontMethod · 0.80
set_gc_generationMethod · 0.80
writeMethod · 0.45
as_refMethod · 0.45
storeMethod · 0.45

Tested by 2

test_freezeMethod · 0.64