Skip to content

Commit 410d17f

Browse files
wksmmtkgc-bot
andauthored
Remove coordinator thread (#159)
Upstream PR: mmtk/mmtk-core#1067 --------- Co-authored-by: mmtkgc-bot <mmtkgc.bot@gmail.com>
1 parent 5766c8f commit 410d17f

File tree

7 files changed

+15
-44
lines changed

7 files changed

+15
-44
lines changed

jikesrvm/rvm/src/org/jikesrvm/mm/mminterface/CollectorThread.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ public final class CollectorThread extends SystemThread {
4040

4141
@Entrypoint
4242
private Address workerInstance = Address.zero();
43-
private boolean isController;
4443

45-
public void setWorker(Address worker, boolean isController) {
44+
public void setWorker(Address worker) {
4645
rvmThread.assertIsRustMMTkCollector();
4746
this.workerInstance = worker;
48-
this.isController = isController;
4947
}
5048

5149
/** used by collector threads to hold state during stack scanning */
@@ -99,11 +97,7 @@ public CollectorThread(byte[] stack, CollectorContext context) {
9997
@Unpreemptible
10098
public void run() {
10199
if (VM.BuildWithRustMMTk) {
102-
if (this.isController) {
103-
sysCall.sysStartControlCollector(Magic.objectAsAddress(rvmThread), workerInstance);
104-
} else {
105-
sysCall.sysStartWorker(Magic.objectAsAddress(rvmThread), workerInstance);
106-
}
100+
sysCall.sysStartWorker(Magic.objectAsAddress(rvmThread), workerInstance);
107101
} else {
108102
rvmThread.collectorContext.run();
109103
}

jikesrvm/rvm/src/org/jikesrvm/runtime/Entrypoints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public class Entrypoints {
168168
"(Lorg/vmmagic/unboxed/ObjectReference;)V");
169169
public static final NormalMethod spawnCollectorThreadMethod =
170170
getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class, "spawnCollectorThread",
171-
"(Lorg/vmmagic/unboxed/Address;Z)V");
171+
"(Lorg/vmmagic/unboxed/Address;)V");
172172
public static final NormalMethod outOfMemoryMethod =
173173
getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class, "outOfMemory",
174174
"()V");

mmtk/Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mmtk/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lto = true
1616
[package.metadata.jikesrvm]
1717
# Our CI matches the following line and extract mmtk/jikesrvm. If this line is updated, please check ci yaml files and make sure it works.
1818
jikesrvm_repo = "https://github.com/mmtk/jikesrvm.git"
19-
jikesrvm_version = "259ffacf23d414686bae3ecf843e65d25dfc376e"
19+
jikesrvm_version = "a43efe4f33a6a69aabeb03e5c5e2e8880f96f047"
2020

2121
[dependencies]
2222
libc = "0.2"
@@ -28,7 +28,7 @@ log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"]
2828
# - change branch/rev
2929
# - change repo name
3030
# But other changes including adding/removing whitespaces in commented lines may break the CI.
31-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "86518d2ebc34b443c312de017dc81c7b097e3b10" }
31+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "5ab62f96c006475285b00b6d20a8b1bf83b74a4d" }
3232
# Uncomment the following to build locally - if you change the path locally, do not commit the change in a PR
3333
# mmtk = { path = "../repos/mmtk-core" }
3434

mmtk/api/mmtk.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ extern bool process(char* name, char* value);
4444
extern void scan_region();
4545
extern void handle_user_collection_request(void *tls);
4646

47-
extern void start_control_collector(void *tls, void* controller);
4847
extern void start_worker(void *tls, void* worker);
4948

5049
extern void release_buffer(void* buffer);
@@ -113,4 +112,4 @@ extern void harness_end();
113112
}
114113
#endif
115114

116-
#endif // MMTK_H
115+
#endif // MMTK_H

mmtk/src/api.rs

+2-18
Original file line numberDiff line numberDiff line change
@@ -119,32 +119,16 @@ pub extern "C" fn will_never_move(object: ObjectReference) -> i32 {
119119
!object.is_movable() as i32
120120
}
121121

122-
#[no_mangle]
123-
// We trust the gc_collector pointer is valid.
124-
#[allow(clippy::not_unsafe_ptr_arg_deref)]
125-
pub extern "C" fn start_control_collector(
126-
tls: VMWorkerThread,
127-
gc_controller: *mut GCController<JikesRVM>,
128-
) {
129-
let mut gc_controller = unsafe { Box::from_raw(gc_controller) };
130-
let cstr = std::ffi::CString::new("MMTkController").unwrap();
131-
unsafe {
132-
libc::pthread_setname_np(libc::pthread_self(), cstr.as_ptr());
133-
}
134-
135-
memory_manager::start_control_collector(&SINGLETON, tls, &mut gc_controller);
136-
}
137-
138122
#[no_mangle]
139123
// We trust the worker pointer is valid.
140124
#[allow(clippy::not_unsafe_ptr_arg_deref)]
141125
pub extern "C" fn start_worker(tls: VMWorkerThread, worker: *mut GCWorker<JikesRVM>) {
142-
let mut worker = unsafe { Box::from_raw(worker) };
126+
let worker = unsafe { Box::from_raw(worker) };
143127
let cstr = std::ffi::CString::new(format!("MMTkWorker{}", worker.ordinal)).unwrap();
144128
unsafe {
145129
libc::pthread_setname_np(libc::pthread_self(), cstr.as_ptr());
146130
}
147-
memory_manager::start_worker::<JikesRVM>(&SINGLETON, tls, &mut worker)
131+
memory_manager::start_worker::<JikesRVM>(&SINGLETON, tls, worker)
148132
}
149133

150134
#[no_mangle]

mmtk/src/collection.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,11 @@ impl Collection<JikesRVM> for VMCollection {
5656
}
5757

5858
fn spawn_gc_thread(tls: VMThread, ctx: GCThreadContext<JikesRVM>) {
59-
let (ctx_ptr, is_controller) = match ctx {
60-
GCThreadContext::Controller(c) => (Box::into_raw(c) as *mut libc::c_void, 1),
61-
GCThreadContext::Worker(c) => (Box::into_raw(c) as *mut libc::c_void, 0),
59+
let ctx_ptr = match ctx {
60+
GCThreadContext::Worker(c) => Box::into_raw(c),
6261
};
6362
unsafe {
64-
jtoc_call!(
65-
SPAWN_COLLECTOR_THREAD_METHOD_OFFSET,
66-
tls,
67-
ctx_ptr,
68-
is_controller
69-
);
63+
jtoc_call!(SPAWN_COLLECTOR_THREAD_METHOD_OFFSET, tls, ctx_ptr);
7064
}
7165
}
7266

0 commit comments

Comments
 (0)