Skip to content

SFT map entries are not set for malloc marksweep #473

@qinsoon

Description

@qinsoon

Currently our malloc space does not set SFT entry in the SFT map. If we ask the SFT map about which space a malloc'd object is in, it will return an empty space. That means we cannot call object.is_live(), object.is_reachable(), etc, for (malloc) marksweep. If we have plan neutral code that uses those methods, that will be wrong.

I tried to set SFT entry for the malloc marksweep space. Though the SFT entry is per chunk, I thought it might be fine - as long as we have malloc results in that chunk, we won't use the same chunk for other spaces. However, that triggers a failed assertion in OpenJDK. OpenJDK may do malloc itself, and they will assert that the malloc'd object is not in the heap (when using MMTk, it will check with third party heap). If their malloc result happens to be in the same chunk that we allocate with the malloc allocator, and we set SFT entry for the chunk, then the assertion will fail, as we will tell that the chunk belongs to our malloc marksweep space thus in our heap.

Known issues from this:

  • We cannot run finalization for malloc marksweep (which uses object.is_live()). We can disable finalization for marksweep for now.
  • SFTMap.is_in_space() has a special check to see if the object is malloc'd or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-spaceArea: Space/PageResourceC-bugCategory: BugC-wontfixCategory: Won't fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions