Skip to content

Commit

Permalink
Remove finish_global_frame optimization
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Oct 10, 2023
1 parent f3f53e6 commit 0eabe2a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions core/lib/vm/src/old_vm/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,23 @@ impl<H: HistoryMode> Memory for SimpleMemory<H> {

fn finish_global_frame(
&mut self,
_base_page: MemoryPage,
base_page: MemoryPage,
returndata_fat_pointer: FatPointer,
timestamp: Timestamp,
) {
// Safe to unwrap here, since `finish_global_frame` is never called with empty stack
let current_observable_pages = self.observable_pages.inner().current_frame();
let returndata_page = returndata_fat_pointer.memory_page;

self.observable_pages.clear_frame(timestamp);
self.observable_pages.merge_frame(timestamp);

for &page in current_observable_pages {
// If the page's number is greater than or equal to the base_page,
// it means that it was created by the internal calls of this contract.
// We need to add this check as the calldata pointer is also part of the
// observable pages.
if page >= base_page.0 && page != returndata_page {
self.memory.clear_page(page as usize, timestamp);
}
}
self.observable_pages
.push_to_frame(returndata_page, timestamp);
}
Expand Down

0 comments on commit 0eabe2a

Please sign in to comment.