Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
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 @@ -36,9 +36,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 = "37d81218028d788f7a24158aac0588c3f6925d08" }
# mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "37d81218028d788f7a24158aac0588c3f6925d08" }
# 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
3 changes: 2 additions & 1 deletion mmtk/src/object_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use mmtk::vm::*;
pub struct VMObjectModel<const COMPRESSED: bool> {}

impl<const COMPRESSED: bool> ObjectModel<OpenJDK<COMPRESSED>> for VMObjectModel<COMPRESSED> {
const GLOBAL_LOG_BIT_SPEC: VMGlobalLogBitSpec = vm_metadata::LOGGING_SIDE_METADATA_SPEC;
const GLOBAL_OBJECT_UNLOG_BIT_SPEC: VMGlobalObjectUnlogBitSpec = vm_metadata::OBJECT_LOGGING_SIDE_METADATA_SPEC;
const GLOBAL_FIELD_UNLOG_BIT_SPEC: VMGlobalFieldUnlogBitSpec = vm_metadata::FIELD_LOGGING_SIDE_METADATA_SPEC;

const LOCAL_FORWARDING_POINTER_SPEC: VMLocalForwardingPointerSpec =
vm_metadata::FORWARDING_POINTER_METADATA_SPEC;
Expand Down
5 changes: 5 additions & 0 deletions mmtk/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ impl<const COMPRESSED: bool> Slot for OpenJDKSlot<COMPRESSED> {
unsafe { self.addr.store(object) }
}
}

fn to_address(&self) -> Address {
assert!(!COMPRESSED);
self.addr
Comment on lines +210 to +211

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized this issue in my branch. I think something like the below is better:

Suggested change
assert!(!COMPRESSED);
self.addr
if COMPRESSED {
self.untagged_address()
} else {
self.addr
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will eventually do this. Currently the 1 bit per word field unlog bit side metadata doesn't work for compressed pointers, so I want it to fail loud. To support compressed pointers, I will introduce an alternative 1 bit per 32 bit field unlog bit side metadata and give the VM binding the option to select that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah fair enough. Makes sense. I just found this bug in my branch so I thought it'd be better to make a comment here in case you also have issues with the same in the future.

}
}

/// A range of OpenJDKSlot, usually used for arrays.
Expand Down
6 changes: 5 additions & 1 deletion mmtk/src/vm_metadata/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ pub(crate) const FORWARDING_POINTER_OFFSET: isize = 0;

/// Global logging bit metadata spec
/// 1 bit per object
pub(crate) const LOGGING_SIDE_METADATA_SPEC: VMGlobalLogBitSpec = VMGlobalLogBitSpec::side_first();
pub(crate) const OBJECT_LOGGING_SIDE_METADATA_SPEC: VMGlobalObjectUnlogBitSpec =
VMGlobalObjectUnlogBitSpec::side_first();

pub(crate) const FIELD_LOGGING_SIDE_METADATA_SPEC: VMGlobalFieldUnlogBitSpec =
VMGlobalFieldUnlogBitSpec::side_after(OBJECT_LOGGING_SIDE_METADATA_SPEC.as_spec());

// Global MetadataSpecs - End

Expand Down
4 changes: 2 additions & 2 deletions openjdk/cpu/x86/mmtkUnlogBitBarrierSetAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void MMTkUnlogBitBarrierSetAssembler::object_reference_write_pre_or_post(MacroAs
// compressed oops, the `val` register will be holding a compressed pointer to the target object
// due to the way `BarrierSetAssembler::store_at` works. If the write barrier needs to know the
// target, we will need to decompress it before passing it to the barrier slow path.
__ xorptr(c_rarg1, c_rarg1);
__ xorptr(c_rarg2, c_rarg2);
__ lea(c_rarg1, dst);
__ movptr(c_rarg2, val);

address entry_point = mmtk_enable_barrier_fastpath ? FN_ADDR(MMTkBarrierSetRuntime::object_reference_write_slow_call)
: pre ? FN_ADDR(MMTkBarrierSetRuntime::object_reference_write_pre_call)
Expand Down
Loading