(self, stored_object, overwrite=False, merge_to_top=False, top=None)
Store a variable into the storage.

        :param StoredObject stored_object: The descriptor describing start address and the variable.
        :param bool overwrite:  Whether existing objects should be overwritten or not. True to make a strong update,
                                False to make a weak update.
        :return: None
Store a variable into the storage.
Store a variable into the storage .
def __store(self, stored_object, overwrite=False, merge_to_top=False, top=None):
        """
        Store a variable into the storage.

        :param StoredObject stored_object: The descriptor describing start address and the variable.
        :param bool overwrite:  Whether existing objects should be overwritten or not. True to make a strong update,
                                False to make a weak update.
        :return: None
        """

        start = stored_object.start
        object_size = self._canonicalize_size(stored_object.size)
        end: int = start + object_size

        # region items in the middle
        overlapping_items = list(self._storage.irange(start, end-1))

        # is there a region item that begins before the start and overlaps with this variable?
        floor_key, floor_item = self._get_container(start)
        if floor_item is not None and floor_key not in overlapping_items:
            # insert it into the beginning
            overlapping_items.insert(0, floor_key)

        # scan through the entire list of region items, split existing regions and insert new regions as needed
        to_update = {start: RegionObject(start, object_size, {stored_object})}
        last_end: int = start

        for floor_key in overlapping_items:
            item: RegionObject = self._storage[floor_key]
            item_end: int = item.start + self._canonicalize_size(item.size)
            if item.start < start:
                # we need to break this item into two
                a, b = item.split(start)
                if overwrite:
                    b.set_object(stored_object)
                else:
                    self._add_object_with_check(b, stored_object, merge_to_top=merge_to_top, top=top)
                to_update[a.start] = a
                to_update[b.start] = b
                last_end = b.start + self._canonicalize_size(b.size)
            elif item.start > last_end:
                # there is a gap between the last item and the current item
                # fill in the gap
                new_item = RegionObject(last_end, item.start - last_end, {stored_object})
                to_update[new_item.start] = new_item
                last_end = new_item.end
            elif item_end > end:
                # we need to split this item into two
                a, b = item.split(end)
                if overwrite:
                    a.set_object(stored_object)
                else:
                    self._add_object_with_check(a, stored_object, merge_to_top=merge_to_top, top=top)
                to_update[a.start] = a
                to_update[b.start] = b
                last_end = b.start + self._canonicalize_size(b.size)
            else:
                if overwrite:
                    item.set_object(stored_object)
                else:
                    self._add_object_with_check(item, stored_object, merge_to_top=merge_to_top, top=top)
                to_update[item.start] = item

        self._storage.update(to_update)
def __store ( self , stored_object , overwrite = False , merge_to_top = False , top = None ) : start = stored_object . start object_size = self . _canonicalize_size ( stored_object . size ) end : int = start + object_size # region items in the middle overlapping_items = list ( self . _storage . irange ( start , end - 1 ) ) # is there a region item that begins before the start and overlaps with this variable? floor_key , floor_item = self . _get_container ( start ) if floor_item is not None and floor_key not in overlapping_items : # insert it into the beginning overlapping_items . insert ( 0 , floor_key ) # scan through the entire list of region items, split existing regions and insert new regions as needed to_update = { start : RegionObject ( start , object_size , { stored_object } ) } last_end : int = start for floor_key in overlapping_items : item : RegionObject = self . _storage [ floor_key ] item_end : int = item . start + self . _canonicalize_size ( item . size ) if item . start < start : # we need to break this item into two a , b = item . split ( start ) if overwrite : b . set_object ( stored_object ) else : self . _add_object_with_check ( b , stored_object , merge_to_top = merge_to_top , top = top ) to_update [ a . start ] = a to_update [ b . start ] = b last_end = b . start + self . _canonicalize_size ( b . size ) elif item . start > last_end : # there is a gap between the last item and the current item # fill in the gap new_item = RegionObject ( last_end , item . start - last_end , { stored_object } ) to_update [ new_item . start ] = new_item last_end = new_item . end elif item_end > end : # we need to split this item into two a , b = item . split ( end ) if overwrite : a . set_object ( stored_object ) else : self . _add_object_with_check ( a , stored_object , merge_to_top = merge_to_top , top = top ) to_update [ a . start ] = a to_update [ b . start ] = b last_end = b . start + self . _canonicalize_size ( b . size ) else : if overwrite : item . set_object ( stored_object ) else : self . _add_object_with_check ( item , stored_object , merge_to_top = merge_to_top , top = top ) to_update [ item . start ] = item self . _storage . update ( to_update )