Skip to content

Commit

Permalink
Small bug fix for GC (#1022)
Browse files Browse the repository at this point in the history
This PR fixes a bug in GC discovered while testing KEVM with the
Ethereum test suite.

Specifically we want to make sure that the affected operations invoke
move constructors rather than copy constructors.
  • Loading branch information
theo25 authored Apr 8, 2024
1 parent 29463bd commit 2c4eb2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/collect/collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ bool store_map_for_gc(void **roots, map *ptr) {
std::string name = get_raw_symbol_name(kllvm::sort_category::Map) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
auto *child = (map *)(hdr + 1);
*child = *ptr;
*child = std::move(*ptr);
*roots = mem;
return true;
}
Expand All @@ -364,7 +364,7 @@ bool store_set_for_gc(void **roots, set *ptr) {
std::string name = get_raw_symbol_name(kllvm::sort_category::Set) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
auto *child = (set *)(hdr + 1);
*child = *ptr;
*child = std::move(*ptr);
*roots = mem;
return true;
}
Expand All @@ -379,7 +379,7 @@ bool store_list_for_gc(void **roots, list *ptr) {
std::string name = get_raw_symbol_name(kllvm::sort_category::List) + "{}";
*hdr = get_block_header_for_symbol(get_tag_for_symbol_name(name.c_str()));
auto *child = (list *)(hdr + 1);
*child = *ptr;
*child = std::move(*ptr);
*roots = mem;
return true;
}
Expand Down

0 comments on commit 2c4eb2f

Please sign in to comment.