Invalidate this type's version tag and cascade to all subclasses.
(&self)
| 489 | |
| 490 | /// Invalidate this type's version tag and cascade to all subclasses. |
| 491 | pub fn modified(&self) { |
| 492 | if let Some(ext) = self.heaptype_ext.as_ref() { |
| 493 | ext.specialization_cache.invalidate_for_type_modified(); |
| 494 | } |
| 495 | // If already invalidated, all subclasses must also be invalidated |
| 496 | // (guaranteed by the MRO invariant in assign_version_tag). |
| 497 | let old_version = self.tp_version_tag.load(Ordering::Acquire); |
| 498 | if old_version == 0 { |
| 499 | return; |
| 500 | } |
| 501 | self.tp_version_tag.store(0, Ordering::SeqCst); |
| 502 | // Nullify borrowed pointers in cache entries for this version |
| 503 | // so they don't dangle after the dict is modified. |
| 504 | type_cache_clear_version(old_version); |
| 505 | let subclasses = self.subclasses.read(); |
| 506 | for weak_ref in subclasses.iter() { |
| 507 | if let Some(sub) = weak_ref.upgrade() { |
| 508 | sub.downcast_ref::<PyType>().unwrap().modified(); |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | pub fn new_simple_heap( |
| 514 | name: &str, |
no test coverage detected