Skip to content

Conversation

qinsoon
Copy link
Member

@qinsoon qinsoon commented Jul 10, 2024

This PR adds internal pointer support. It supersedes #1155 which provides a simple but inefficient implementation for internal pointers. This PR is based on #1159 which adds requirements for object reference alignment.

This PR

  • adds memory_manager::find_object_from_internal_pointer
    • The call is dispatched using SFT to each space.
    • Large object space only checks the first word in VO bit for every page.
    • Mark sweep and immix space only searches for the max object size for those spaces.
  • Allow iterating side metadata bits.
  • Allow loading raw byte/word in side metadata.

}
});

c.bench_function("internal pointer - normal objects", |_b| {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some data for this micro benchmark.

The naive implementation (find_prev_non_zero_value_simple, similar to #1155): check every aligned data address until we find the object.

internal pointer - normal objects
                        time:   [12.910 µs 12.911 µs 12.912 µs]

internal pointer - large objects
                        time:   [53.164 ns 53.486 ns 53.939 ns]

Check every byte in side metadata until we find VO bit, and compute it back to the VO address

internal pointer - normal objects
                        time:   [1.5500 µs 1.5504 µs 1.5509 µs]
                        change: [-88.001% -87.997% -87.994%] (p = 0.00 < 0.05)
                        Performance has improved.

internal pointer - large objects
                        time:   [58.115 ns 58.137 ns 58.161 ns]
                        change: [+8.0877% +8.6753% +9.1317%] (p = 0.00 < 0.05)
                        Performance has regressed.

Check every word in side metadata until we find VO bit, and compute it back to the VO address

internal pointer - normal objects
                        time:   [311.28 ns 312.38 ns 313.51 ns]
                        change: [-79.856% -79.804% -79.741%] (p = 0.00 < 0.05)
                        Performance has improved.

internal pointer - large objects
                        time:   [57.582 ns 57.607 ns 57.635 ns]
                        change: [-0.9006% -0.8311% -0.7566%] (p = 0.00 < 0.05)
                        Change within noise threshold.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After applying the suggestion in #1165 (comment), we only check if the metadata address is mapped for every chunk. The performance is further improved.

internal pointer - normal objects
                        time:   [139.48 ns 139.65 ns 139.82 ns]
                        change: [-55.524% -55.388% -55.250%] (p = 0.00 < 0.05)
                        Performance has improved.

internal pointer - large objects
                        time:   [49.300 ns 49.361 ns 49.462 ns]
                        change: [-14.459% -14.367% -14.263%] (p = 0.00 < 0.05)
                        Performance has improved.

@qinsoon qinsoon marked this pull request as ready for review July 10, 2024 05:38
@qinsoon qinsoon requested a review from wks July 10, 2024 05:38
@qinsoon
Copy link
Member Author

qinsoon commented Jul 12, 2024

binding-refs
RUBY_BINDING_REPO=qinsoon/mmtk-ruby
RUBY_BINDING_REF=update-mmtk-core-pr-1165

qinsoon added 2 commits July 18, 2024 00:42
find_object_from_internal_pointer to the is_mmtk_object module
Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinsoon qinsoon added the PR-extended-testing Run extended tests for the pull request label Jul 18, 2024
@qinsoon qinsoon added this pull request to the merge queue Jul 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 19, 2024
@qinsoon qinsoon added this pull request to the merge queue Jul 19, 2024
Merged via the queue into mmtk:master with commit 5edfd85 Jul 19, 2024
30 of 31 checks passed
@qinsoon qinsoon deleted the feature/internal-pointer-fast branch July 19, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-extended-testing Run extended tests for the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants