Skip to content

Concurrent Immix #311

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

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ab6f615
WIP
tianleq Jul 25, 2025
b7cdf24
Merge branch 'master' of github.com:tianleq/mmtk-openjdk into concurr…
tianleq Jul 28, 2025
b6a589f
Update mmtk-core dep, add tests
qinsoon Jul 29, 2025
22fbc69
Run ConcurrentImmix without compressed pointer.
qinsoon Jul 29, 2025
5018b70
Run ConcurrentImmix with larger heap
qinsoon Jul 30, 2025
ded5dcb
Add heap factor to artifact name
qinsoon Jul 30, 2025
2c739a1
Update mmtk-core. Run conix with 6x heap.
qinsoon Jul 31, 2025
15ca15c
Fix metadata shifting.
wks Jul 31, 2025
772bb1a
Rename CI jobs
qinsoon Jul 31, 2025
f8be111
Update mmtk-core (schedule_concurrent_packets before resuming mutators)
qinsoon Jul 31, 2025
5aa00cd
CI: Use 7x min heap. Use compressed pointer.
qinsoon Jul 31, 2025
cae60f1
mmtk-core renamed load_reference to load_weak_reference
wks Aug 1, 2025
6b04936
Update mmtk-core, fix style check
qinsoon Aug 5, 2025
5657658
Merge branch 'master' into concurrent-immix
qinsoon Aug 5, 2025
b120bae
Run ConcurrentImmix without weak refs
qinsoon Aug 6, 2025
b0109ed
Pass DecoratorSet to MMTk's object_reference_write_pre/post. Skip
qinsoon Aug 6, 2025
803f57b
Revert "Run ConcurrentImmix without weak refs"
qinsoon Aug 6, 2025
69512a0
Revert "Pass DecoratorSet to MMTk's object_reference_write_pre/post. …
qinsoon Aug 6, 2025
0d869df
Update mmtk-core (ref enqueue workaround)
qinsoon Aug 6, 2025
948db29
Update mmtk-core (ConcurrentPlan and trace object refactoring)
qinsoon Aug 13, 2025
3f437d0
Update mmtk-core (minor fix)
qinsoon Aug 14, 2025
d141c5f
Update mmtk-core (wrong assertions)
qinsoon Aug 14, 2025
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
2 changes: 0 additions & 2 deletions mmtk/Cargo.lock

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

4 changes: 2 additions & 2 deletions mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ probe = "0.5"
# - 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 = "c5ead72a87bcc8cc49b5e7a62cf71d848b4b4c9b" }
# mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "c5ead72a87bcc8cc49b5e7a62cf71d848b4b4c9b" }
# Uncomment the following to build locally
# mmtk = { path = "../repos/mmtk-core" }
mmtk = { path = "../../mmtk-core" }

[build-dependencies]
built = { version = "0.7.7", features = ["git2"] }
Expand Down
15 changes: 15 additions & 0 deletions mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ macro_rules! with_mutator {
static NO_BARRIER: sync::Lazy<CString> = sync::Lazy::new(|| CString::new("NoBarrier").unwrap());
static OBJECT_BARRIER: sync::Lazy<CString> =
sync::Lazy::new(|| CString::new("ObjectBarrier").unwrap());
static SATB_BARRIER: sync::Lazy<CString> = sync::Lazy::new(|| CString::new("SATBBarrier").unwrap());

#[no_mangle]
pub extern "C" fn get_mmtk_version() -> *const c_char {
Expand All @@ -59,6 +60,7 @@ pub extern "C" fn mmtk_active_barrier() -> *const c_char {
match singleton.get_plan().constraints().barrier {
BarrierSelector::NoBarrier => NO_BARRIER.as_ptr(),
BarrierSelector::ObjectBarrier => OBJECT_BARRIER.as_ptr(),
BarrierSelector::SATBBarrier => SATB_BARRIER.as_ptr(),
// In case we have more barriers in mmtk-core.
#[allow(unreachable_patterns)]
_ => unimplemented!(),
Expand Down Expand Up @@ -381,6 +383,19 @@ pub extern "C" fn executable() -> bool {
true
}

#[no_mangle]
pub extern "C" fn mmtk_load_reference(mutator: *mut libc::c_void, o: ObjectReference) {
with_mutator!(|mutator| mutator.barrier().load_reference(o))
}

#[no_mangle]
pub extern "C" fn mmtk_object_reference_clone_pre(
mutator: *mut libc::c_void,
obj: ObjectReference,
) {
with_mutator!(|mutator| mutator.barrier().object_reference_clone_pre(obj))
}

/// Full pre barrier
#[no_mangle]
pub extern "C" fn mmtk_object_reference_write_pre(
Expand Down
4 changes: 4 additions & 0 deletions mmtk/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ impl<const COMPRESSED: bool> Collection<OpenJDK<COMPRESSED>> for VMCollection {
((*UPCALLS).schedule_finalizer)();
}
}

fn set_concurrent_marking_state(active: bool) {
unsafe { crate::CONCURRENT_MARKING_ACTIVE = if active { 1 } else { 0 } }
}
}
3 changes: 3 additions & 0 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ pub static VO_BIT_ADDRESS: uintptr_t =
pub static FREE_LIST_ALLOCATOR_SIZE: uintptr_t =
std::mem::size_of::<mmtk::util::alloc::FreeListAllocator<OpenJDK<false>>>();

#[no_mangle]
pub static mut CONCURRENT_MARKING_ACTIVE: u8 = 0;

#[derive(Default)]
pub struct OpenJDK<const COMPRESSED: bool>;

Expand Down
53 changes: 52 additions & 1 deletion openjdk/barriers/mmtkObjectBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,57 @@ void MMTkObjectBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, Dec

#undef __

#define __ sasm->

void MMTkObjectBarrierSetAssembler::generate_c1_post_write_barrier_runtime_stub(StubAssembler* sasm) const {
__ prologue("mmtk_object_barrier", false);

Label done, runtime;

__ push(c_rarg0);
__ push(c_rarg1);
__ push(c_rarg2);
__ push(rax);

__ load_parameter(0, c_rarg0);
__ load_parameter(1, c_rarg1);
__ load_parameter(2, c_rarg2);

__ bind(runtime);

__ save_live_registers_no_oop_map(true);

#if MMTK_ENABLE_BARRIER_FASTPATH
__ call_VM_leaf_base(FN_ADDR(MMTkBarrierSetRuntime::object_reference_write_slow_call), 3);
#else
__ call_VM_leaf_base(FN_ADDR(MMTkBarrierSetRuntime::object_reference_write_post_call), 3);
#endif

__ restore_live_registers(true);

__ bind(done);
__ pop(rax);
__ pop(c_rarg2);
__ pop(c_rarg1);
__ pop(c_rarg0);

__ epilogue();
}

#undef __
#define __ ce->masm()->

void MMTkObjectBarrierSetAssembler::generate_c1_post_write_barrier_stub(LIR_Assembler* ce, MMTkC1PostBarrierStub* stub) const {
MMTkBarrierSetC1* bs = (MMTkBarrierSetC1*) BarrierSet::barrier_set()->barrier_set_c1();
__ bind(*stub->entry());
ce->store_parameter(stub->src->as_pointer_register(), 0);
ce->store_parameter(stub->slot->as_pointer_register(), 1);
ce->store_parameter(stub->new_val->as_pointer_register(), 2);
__ call(RuntimeAddress(bs->post_barrier_c1_runtime_code_blob()->code_begin()));
__ jmp(*stub->continuation());
}
#undef __

#ifdef ASSERT
#define __ gen->lir(__FILE__, __LINE__)->
#else
Expand Down Expand Up @@ -176,7 +227,7 @@ void MMTkObjectBarrierSetC1::object_reference_write_post(LIRAccess& access, LIR_
new_val = new_val_reg;
}
assert(new_val->is_register(), "must be a register at this point");
CodeStub* slow = new MMTkC1BarrierStub(src, slot, new_val);
CodeStub* slow = new MMTkC1PostBarrierStub(src, slot, new_val);

#if MMTK_ENABLE_BARRIER_FASTPATH
LIR_Opr addr = src;
Expand Down
3 changes: 3 additions & 0 deletions openjdk/barriers/mmtkObjectBarrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class MMTkObjectBarrierSetRuntime: public MMTkBarrierSetRuntime {
class MMTkObjectBarrierSetAssembler: public MMTkBarrierSetAssembler {
protected:
virtual void object_reference_write_post(MacroAssembler* masm, DecoratorSet decorators, Address dst, Register val, Register tmp1, Register tmp2, bool compensate_val_reg) const override;
/// Generate C1 write barrier slow-call assembly code
virtual void generate_c1_post_write_barrier_runtime_stub(StubAssembler* sasm) const;
public:
virtual void generate_c1_post_write_barrier_stub(LIR_Assembler* ce, MMTkC1PostBarrierStub* stub) const;
virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) override;
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) override;
};
Expand Down
Loading