-
-
Save rightfold/dae939d7e69fe2b3e772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::unordered_set<mill::Object*> mill::GC::mark() const { | |
std::unordered_set<Object*> result; | |
auto helper = [&] (auto const& self, auto object) { | |
if (result.count(object)) { | |
return; | |
} | |
result.insert(object); | |
for (auto&& field : object->type->fields()) { | |
if (field->isBoxed) { | |
self(self, field->template get<Object*>(object)); | |
} | |
} | |
}; | |
for (auto&& gcPtr : gcPtrs) { | |
helper(helper, gcPtr->get()); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment