Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create minimal example of nested immutable. #40

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/func/freeze/freeze.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,27 @@ void test_two_rings_2()
snmalloc::debug_check_empty<snmalloc::Alloc::Config>();
}

void test_contains_immutable1()
{
auto& alloc = ThreadAlloc::get();
Symbolic* root = new (RegionType::Trace) Symbolic;

Symbolic* nested = new (RegionType::Trace) Symbolic;
freeze(nested);

// Add to the fields of the object
root->fields.push_back(nested);
// Update the remembered set.
RememberedSet* rs = root->get_region();
rs->insert<YesTransfer>(alloc, nested);

// Freeze the root
freeze(root);

Immutable::release(alloc, root);
snmalloc::debug_check_empty<snmalloc::Alloc::Config>();
}

void test_random(size_t seed = 1, size_t max_edges = 128)
{
snmalloc::debug_check_empty<snmalloc::Alloc::Config>();
Expand Down Expand Up @@ -537,6 +558,7 @@ int main(int, char**)
test_two_rings_1();
test_two_rings_2();
freeze_weird_ring();
test_contains_immutable1();

for (size_t i = 1; i < 10000; i++)
{
Expand Down
Loading