Skip to content

Update to MMTk core PR #875 #225

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

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 100 additions & 26 deletions mmtk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ once_cell = "1.10.0"
# - change branch
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI.
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "f1a0bb7fbec97dd84e35a40e8be01cf5018f2f9e" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "04a47feb4598b2120598453c2cceec83986c2122" }
# Uncomment the following to build locally
# mmtk = { path = "../repos/mmtk-core" }

Expand Down
16 changes: 2 additions & 14 deletions mmtk/src/collection.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use mmtk::util::alloc::AllocationError;
use mmtk::util::opaque_pointer::*;
use mmtk::vm::{Collection, GCThreadContext, Scanning, VMBinding};
use mmtk::{Mutator, MutatorContext};
use mmtk::vm::{Collection, GCThreadContext};
use mmtk::Mutator;

use crate::UPCALLS;
use crate::{MutatorClosure, OpenJDK};
Expand All @@ -16,13 +16,9 @@ impl Collection<OpenJDK> for VMCollection {
where
F: FnMut(&'static mut Mutator<OpenJDK>),
{
let scan_mutators_in_safepoint =
<OpenJDK as VMBinding>::VMScanning::SCAN_MUTATORS_IN_SAFEPOINT;

unsafe {
((*UPCALLS).stop_all_mutators)(
tls,
scan_mutators_in_safepoint,
MutatorClosure::from_rust_closure(&mut mutator_visitor),
);
}
Expand Down Expand Up @@ -55,14 +51,6 @@ impl Collection<OpenJDK> for VMCollection {
}
}

fn prepare_mutator<T: MutatorContext<OpenJDK>>(
_tls_w: VMWorkerThread,
_tls_m: VMMutatorThread,
_m: &T,
) {
// unimplemented!()
}

fn out_of_memory(tls: VMThread, err_kind: AllocationError) {
unsafe {
((*UPCALLS).out_of_memory)(tls, err_kind);
Expand Down
6 changes: 1 addition & 5 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ pub struct EdgesClosure {

#[repr(C)]
pub struct OpenJDK_Upcalls {
pub stop_all_mutators: extern "C" fn(
tls: VMWorkerThread,
scan_mutators_in_safepoint: bool,
closure: MutatorClosure,
),
pub stop_all_mutators: extern "C" fn(tls: VMWorkerThread, closure: MutatorClosure),
pub resume_mutators: extern "C" fn(tls: VMWorkerThread),
pub spawn_gc_thread: extern "C" fn(tls: VMThread, kind: libc::c_int, ctx: *mut libc::c_void),
pub block_for_gc: extern "C" fn(),
Expand Down
20 changes: 1 addition & 19 deletions mmtk/src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ pub(crate) fn to_edges_closure<F: RootsWorkFactory<OpenJDKEdge>>(factory: &mut F
}

impl Scanning<OpenJDK> for VMScanning {
const SCAN_MUTATORS_IN_SAFEPOINT: bool = false;
const SINGLE_THREAD_MUTATOR_SCANNING: bool = false;

fn scan_object<EV: EdgeVisitor<OpenJDKEdge>>(
tls: VMWorkerThread,
object: ObjectReference,
Expand All @@ -58,15 +55,6 @@ impl Scanning<OpenJDK> for VMScanning {
// TODO
}

fn scan_roots_in_all_mutator_threads(
_tls: VMWorkerThread,
mut factory: impl RootsWorkFactory<OpenJDKEdge>,
) {
unsafe {
((*UPCALLS).scan_roots_in_all_mutator_threads)(to_edges_closure(&mut factory));
}
}

fn scan_roots_in_mutator_thread(
_tls: VMWorkerThread,
mutator: &'static mut Mutator<OpenJDK>,
Expand Down Expand Up @@ -94,15 +82,9 @@ impl Scanning<OpenJDK> for VMScanning {
Box::new(ScanStringTableRoots::new(factory.clone())) as _,
Box::new(ScanClassLoaderDataGraphRoots::new(factory.clone())) as _,
Box::new(ScanWeakProcessorRoots::new(factory.clone())) as _,
Box::new(ScanVMThreadRoots::new(factory)) as _,
],
);
if !(Self::SCAN_MUTATORS_IN_SAFEPOINT && Self::SINGLE_THREAD_MUTATOR_SCANNING) {
memory_manager::add_work_packet(
&SINGLETON,
WorkBucketStage::Prepare,
ScanVMThreadRoots::new(factory),
);
}
}

fn supports_return_barrier() -> bool {
Expand Down
2 changes: 1 addition & 1 deletion openjdk/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct EdgesClosure {
* OpenJDK-specific
*/
typedef struct {
void (*stop_all_mutators) (void *tls, bool scan_mutators_in_safepoint, MutatorClosure closure);
void (*stop_all_mutators) (void *tls, MutatorClosure closure);
void (*resume_mutators) (void *tls);
void (*spawn_gc_thread) (void *tls, int kind, void *ctx);
void (*block_for_gc) ();
Expand Down
Loading