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

Expose object reference write #55

Merged
merged 6 commits into from
May 4, 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
4 changes: 2 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 @@ -10,7 +10,7 @@ edition = "2018"
[package.metadata.julia]
# Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works.
julia_repo = "https://github.com/mmtk/julia.git"
julia_version = "9dbc8fc65e1e273cefbbe87b20e35e4c43a7ebaf"
julia_version = "a760a7ee28150261669cb0b31a8284214b3635c7"

[lib]
crate-type = ["staticlib", "rlib", "dylib"]
Expand All @@ -29,7 +29,7 @@ lazy_static = "1.1"
# - 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 = "638d3287023c77fb4b6906a8bab35a77a5fb6a1f" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "2cc34abe2b3ce4ee213b9ac4b9295160dac754cc" }
# Uncomment the following to build locally
# mmtk = { path = "../repos/mmtk-core" }
log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"] }
Expand Down
3 changes: 2 additions & 1 deletion mmtk/api/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ extern void modify_check(void* ref);
extern int object_is_managed_by_mmtk(void* addr);
extern void runtime_panic(void);


extern void mmtk_object_reference_write_post(MMTk_Mutator mutator, const void* src, const void* target);
extern uint8_t mmtk_needs_write_barrier(void);

/**
* Tracing
Expand Down
26 changes: 26 additions & 0 deletions mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,29 @@ pub extern "C" fn mmtk_gc_poll(tls: VMMutatorThread) {
pub extern "C" fn runtime_panic() {
panic!("Panicking at runtime!")
}

#[no_mangle]
pub extern "C" fn mmtk_object_reference_write_post(
mutator: *mut Mutator<JuliaVM>,
src: ObjectReference,
target: ObjectReference,
) {
let mutator = unsafe { &mut *mutator };
memory_manager::object_reference_write_post(
mutator,
src,
crate::edges::JuliaVMEdge::Simple(mmtk::vm::edge_shape::SimpleEdge::from_address(
Address::ZERO,
)),
target,
)
}

#[no_mangle]
pub extern "C" fn mmtk_needs_write_barrier() -> u8 {
use mmtk::plan::BarrierSelector;
match SINGLETON.get_plan().constraints().barrier {
BarrierSelector::NoBarrier => 0,
BarrierSelector::ObjectBarrier => 1,
}
}