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

Should swappedInSpace->Contains(object) in line 1036 of function GcRecordFree be !swappedInSpace->Contains(object)? #3

Open
dpinthinker opened this issue Dec 15, 2023 · 2 comments

Comments

@dpinthinker
Copy link

void GcRecordFree(Thread * self, mirror::Object * object) {
if (!swapEnabled) {
return;
}
/*
* The correctness of this check depends on upon several assumptions:
* 1) Only the garbage collectors and my swapping code call Free() on the
* RosAlloc space and large object space.
* 2) The garbage collectors never run concurrently with any swapping
* methods that free objects or stubs as part of swapping (currently,
* the only such method is SwapObjectsOut()).
*/
if (creatingStubs) {
return;
}
if (swappedInSpace->Contains(object)) {
return;
}

I think it may be missing a ! in front of swappedInSpace->Contains(object) in line 1036

@nlebeck
Copy link
Collaborator

nlebeck commented Dec 15, 2023

My memory's quite hazy, but I think that check might be WAI. If object is a stub, we want to process it in this method, but if object is an object in the swap space pointed to by a stub, we don't want to process it here. (We'll take care of it when processing its stub.)

@dpinthinker
Copy link
Author

dpinthinker commented Dec 15, 2023

I may got it. If the object is in SwappedInSpace, it means the object is swaped-in on demand. So don't need to handle it here and should leave it to SwappedInSpace to free it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants