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

Remove the coordinator thread #82

Merged
merged 2 commits into from
Apr 9, 2024
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
119 changes: 43 additions & 76 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 @@ -27,7 +27,7 @@ log = "*"
# - 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 = "57af17fbfd94ff0df2cd3b1e504abe299ce4f0ab" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev="5ab62f96c006475285b00b6d20a8b1bf83b74a4d" }
# Uncomment the following and fix the path to mmtk-core to build locally
# mmtk = { path = "../repos/mmtk-core" }

Expand Down
18 changes: 3 additions & 15 deletions mmtk/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use libc::c_char;
use libc::c_void;
use mmtk::memory_manager;
use mmtk::scheduler::{GCController, GCWorker};
use mmtk::scheduler::GCWorker;
use mmtk::util::opaque_pointer::*;
use mmtk::util::{Address, ObjectReference};
use mmtk::AllocationSemantics;
Expand Down Expand Up @@ -97,18 +97,6 @@ pub extern "C" fn will_never_move(object: ObjectReference) -> bool {
!object.is_movable()
}

#[no_mangle]
// We trust the worker pointer is valid.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub extern "C" fn start_control_collector(
mmtk: &'static mut MMTK<V8>,
tls: VMWorkerThread,
gc_controller: *mut GCController<V8>,
) {
let mut gc_controller = unsafe { Box::from_raw(gc_controller) };
memory_manager::start_control_collector(&*mmtk, tls, &mut gc_controller);
}

#[no_mangle]
// We trust the worker pointer is valid.
#[allow(clippy::not_unsafe_ptr_arg_deref)]
Expand All @@ -117,8 +105,8 @@ pub extern "C" fn start_worker(
tls: VMWorkerThread,
worker: *mut GCWorker<V8>,
) {
let mut worker = unsafe { Box::from_raw(worker) };
memory_manager::start_worker::<V8>(mmtk, tls, &mut worker);
let worker = unsafe { Box::from_raw(worker) };
memory_manager::start_worker::<V8>(mmtk, tls, worker);
}

#[no_mangle]
Expand Down
5 changes: 0 additions & 5 deletions mmtk/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use mmtk::Mutator;
use UPCALLS;
use V8;

const GC_THREAD_KIND_CONTROLLER: libc::c_int = 0;
const GC_THREAD_KIND_WORKER: libc::c_int = 1;

pub struct VMCollection {}
Expand Down Expand Up @@ -34,10 +33,6 @@ impl Collection<V8> for VMCollection {

fn spawn_gc_thread(tls: VMThread, ctx: GCThreadContext<V8>) {
let (ctx_ptr, kind) = match ctx {
GCThreadContext::Controller(b) => (
Box::into_raw(b) as *mut libc::c_void,
GC_THREAD_KIND_CONTROLLER,
),
GCThreadContext::Worker(b) => {
(Box::into_raw(b) as *mut libc::c_void, GC_THREAD_KIND_WORKER)
}
Expand Down
1 change: 0 additions & 1 deletion v8/third_party/heap/mmtk/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ extern bool process(void* builder, char* name, char* value);
extern void scan_region(void *mmtk);
extern void handle_user_collection_request(void *mmtk, void *tls);

extern void start_control_collector(void *tls, void* controller);
extern void start_worker(void *tls, void* worker);

/**
Expand Down
Loading