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

Implement weak reference processing and finalisation in mmtk-openjdk #204

Open
wks opened this issue Mar 18, 2023 · 0 comments
Open

Implement weak reference processing and finalisation in mmtk-openjdk #204

wks opened this issue Mar 18, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@wks
Copy link
Contributor

wks commented Mar 18, 2023

Parent issue: mmtk/mmtk-core#694

Previously, mmtk-core includes an implementation of weak reference processor and a finaliser processor from JikesRVM. mmtk-openjdk, the OpenJDK binding, also used that framework. That approach is problematic. (See mmtk/mmtk-core#694)

With the generalised language-neutral weak reference processing API introduced in mmtk-core (See: mmtk/mmtk-core#700), we should implement the reference/finalisation processors in mmtk-openjdk in an OpenJDK-specific manner.

Related work:

  1. https://github.com/wks/mmtk-openjdk/tree/gen-weakref-api
    It was my experiment. I copied and pasted the ReferenceProcessor and FinalizableProcessor to mmtk-openjdk with minimal modification, and use the new API to communicate with mmtk-core. This shows the new API works, but the ReferenceProcessor and FinalizableProcessor are still implemented in the JikesRVM style.
  2. https://github.com/wenyuzhao/mmtk-openjdk/tree/lxr
    This branch is mainly for the LXR GC algorithm, but it also includes a new implementation of reference/finalisation processor that is more closely integrated with OpenJDK. However, this implementation depends on a modified version of mmtk-core that contains an extended but still Java-specific weak reference processing API.

We should implement reference/finalisation processing in mmtk-openjdk in a way closely related to OpenJDK's own reference/finalisation processing mechanism, but we should use the new language-neutral API.

Key to using the new API is handling the multiple strengths of references. By using the return value of the Scanning::process_weak_refs function, the VM binding can build a state machine to handle soft/weak/final/phantom references while expanding the transitive closure multiple times. (See: https://github.com/wks/mmtk-openjdk/blob/gen-weakref-api/mmtk/src/weak_processor/mod.rs)

@wks wks added the help wanted Extra attention is needed label Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant