Skip to content

Remove Space/PageResource/Allocator type parameters#108

Merged
qinsoon merged 6 commits intomasterfrom
remove-space-type-params
Jun 25, 2020
Merged

Remove Space/PageResource/Allocator type parameters#108
qinsoon merged 6 commits intomasterfrom
remove-space-type-params

Conversation

@qinsoon
Copy link
Copy Markdown
Member

@qinsoon qinsoon commented Jun 22, 2020

Types with unnecessary type parameters such as Space<VM, PR>, PageResource<VM, Space>, Allocator<VM, PR> make it impossible to write polymorphic code. This PR removes unnecessary type parameters, and use trait objects for those types wherever possible.

Changes:

  • Space<VM, PR> -> Space<VM>
  • PageResource<VM, Space> -> PageResource<VM>
  • Allocator<VM, PR> -> Allocator<VM>
  • A few functions no longer take type parameters, instead they use trait objects.
  • Move the field pr from CommonSpace to each specific space so that each space implementation still knows the type of page resource to call methods specific to the page resource.

This PR should fix most of issue #60, however, we should discuss separately. This PR also solves #19.

@qinsoon qinsoon marked this pull request as ready for review June 22, 2020 06:56
@qinsoon qinsoon added the PR-ready-for-review Pull request ready for review label Jun 22, 2020
Comment thread src/util/heap/freelistpageresource.rs
Copy link
Copy Markdown
Member

@caizixian caizixian left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread src/util/heap/freelistpageresource.rs
Comment thread src/util/alloc/large_object_allocator.rs
Copy link
Copy Markdown
Contributor

@steveblackburn steveblackburn left a comment

Choose a reason for hiding this comment

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

LGTM

This is good cleanup/refactoring.

Comment thread src/policy/space.rs
Comment thread src/util/alloc/bumpallocator.rs
Comment thread src/policy/space.rs Outdated
This was referenced Jun 24, 2020
@caizixian caizixian added PR-ready-to-merge PR-approved Pull request approved and removed PR-ready-for-review Pull request ready for review PR-ready-to-merge labels Jun 25, 2020
@caizixian
Copy link
Copy Markdown
Member

Bindings need to be fixed

@qinsoon
Copy link
Copy Markdown
Member Author

qinsoon commented Jun 25, 2020

Bindings need to be fixed

We need to merge the binding first, as the checks only check against the master of the binding. I will do this.

@qinsoon
Copy link
Copy Markdown
Member Author

qinsoon commented Jun 25, 2020

I will merge this as the correctness test passed. The performance comparison failed due to this issue #95.

@qinsoon qinsoon merged commit 66edca5 into master Jun 25, 2020
@qinsoon qinsoon deleted the remove-space-type-params branch June 25, 2020 08:49
wenyuzhao added a commit to wenyuzhao/mmtk-core that referenced this pull request Sep 14, 2021
* Update to mmtk-core PR mmtk#108

* Fix MMTk mutator struct layout due to the use of trait objects

_Note: Force merge this PR. CI tests failed because the mmtk-core dependency still points to master instead of the pr#108 branch. This is expected to be fixed automatically after the mmtk-core-pr-108 is merged._

Co-authored-by: Wenyu Zhao <[email protected]>
qinsoon pushed a commit to qinsoon/mmtk-core that referenced this pull request Mar 28, 2023
Previously the MMTk coordinator thread pretents to be the VM thread and
calls SafepointSynchronize::begin() directly.  This makes it race with
the real VM thread.

This commit introduces a dedicated "VM companion thread". The companion
therad requests the VM thread to execute a stop-the-world VM operation
(a VMOp_ThirdPartyHeapOperation), and the VM operation waits for the
stop-the-world GC to finish and lets the VM thread start the world
again.  This ensures the real VM thread is the only thread that calls
SafepointSynchronize::begin().  The MMTk binding initiates stack
scanning during stop-the-world.

Also made minor fixes to MMTKCollectorThread and MMTKContextThread

-   Removed is_VM_thread and is_GC_thread methods.
    -   It is not the VM thread.
    -   The `is_GC_thread` method is never used in the real VM thread,
        and is removed in the upstream in a later revision.
-   Initialize their native thread names on start.
    -   The native names are visible in GDB when debugging.
    -   Prepended  "MMTk" to their names to make them more obvious.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-approved Pull request approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants