pub fn mark_static_initialized(
        &mut self,
        alloc_id: AllocId,
        mutability: Mutability,
    ) -> EvalResult<'tcx> {
        trace!(
            "mark_static_initialized {:?}, mutability: {:?}",
            alloc_id,
            mutability
        );
        // The machine handled it
        if M::mark_static_initialized(self, alloc_id, mutability)? {
            return Ok(())
        }
        let alloc = self.alloc_map.remove(&alloc_id);
        match self.alloc_kind.remove(&alloc_id) {
            None => {},
            Some(MemoryKind::Machine(_)) => bug!("machine didn't handle machine alloc"),
            Some(MemoryKind::Stack) => {},
        }
        if let Some(mut alloc) = alloc {
            // ensure llvm knows not to put this into immutable memroy
            alloc.runtime_mutability = mutability;
            let alloc = self.tcx.intern_const_alloc(alloc);
            self.tcx.alloc_map.lock().set_id_memory(alloc_id, alloc);
            // recurse into inner allocations
            for &alloc in alloc.relocations.values() {
                self.mark_inner_allocation_initialized(alloc, mutability)?;
            }
        } else {
            bug!("no allocation found for {:?}", alloc_id);
        }
        Ok(())
    }
/// mark an allocation as static and initialized, either mutable or not
mark an allocation as static and initialized, either mutable or not
mark an allocation as static and initialized either mutable or not
pub fn mark_static_initialized(
        &mut self,
        alloc_id: AllocId,
        mutability: Mutability,
    ) -> EvalResult<'tcx> {
        trace!(
            "mark_static_initialized {:?}, mutability: {:?}",
            alloc_id,
            mutability
        );
        // The machine handled it
        if M::mark_static_initialized(self, alloc_id, mutability)? {
            return Ok(())
        }
        let alloc = self.alloc_map.remove(&alloc_id);
        match self.alloc_kind.remove(&alloc_id) {
            None => {},
            Some(MemoryKind::Machine(_)) => bug!("machine didn't handle machine alloc"),
            Some(MemoryKind::Stack) => {},
        }
        if let Some(mut alloc) = alloc {
            // ensure llvm knows not to put this into immutable memroy
            alloc.runtime_mutability = mutability;
            let alloc = self.tcx.intern_const_alloc(alloc);
            self.tcx.alloc_map.lock().set_id_memory(alloc_id, alloc);
            // recurse into inner allocations
            for &alloc in alloc.relocations.values() {
                self.mark_inner_allocation_initialized(alloc, mutability)?;
            }
        } else {
            bug!("no allocation found for {:?}", alloc_id);
        }
        Ok(())
    }
pub fn mark_static_initialized ( & mut self , alloc_id : AllocId , mutability : Mutability , ) -> EvalResult < ' tcx > { trace ! ( " " alloc_id mutability ) ; // The machine handled it if M :: mark_static_initialized ( self , alloc_id , mutability ) ? { return Ok ( ( ) ) } let alloc = self . alloc_map . remove ( & alloc_id ) ; match self . alloc_kind . remove ( & alloc_id ) { None => { } , Some ( MemoryKind :: Machine ( _ ) ) => bug ! ( " " ) , Some ( MemoryKind :: Stack ) => { } , } if let Some ( mut alloc ) = alloc { // ensure llvm knows not to put this into immutable memroy alloc . runtime_mutability = mutability ; let alloc = self . tcx . intern_const_alloc ( alloc ) ; self . tcx . alloc_map . lock ( ) . set_id_memory ( alloc_id , alloc ) ; // recurse into inner allocations for & alloc in alloc . relocations . values ( ) { self . mark_inner_allocation_initialized ( alloc , mutability ) ? ; } } else { bug ! ( " " alloc_id ) ; } Ok ( ( ) ) }
mark an allocation as static and initialized, either mutable or not
mark an allocation as static and initialized either mutable or not
&mut self
alloc_id
AllocId
mutability
Mutability