Skip to content
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.

2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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 = "b1f0fac73f1df3b4f23126a94a76fbeddf7a573c" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "37d81218028d788f7a24158aac0588c3f6925d08" }
# Uncomment the following to build locally
# mmtk = { path = "../repos/mmtk-core" }

Expand Down
15 changes: 9 additions & 6 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,19 @@ pub struct OpenJDK_Upcalls {
pub static mut UPCALLS: *const OpenJDK_Upcalls = null_mut();

#[no_mangle]
pub static GLOBAL_SIDE_METADATA_BASE_ADDRESS: uintptr_t =
mmtk::util::metadata::side_metadata::GLOBAL_SIDE_METADATA_BASE_ADDRESS.as_usize();
pub extern "C" fn get_global_side_metadata_base_address() -> uintptr_t {
mmtk::util::metadata::side_metadata::global_side_metadata_base_address().as_usize()
}

#[no_mangle]
pub static GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS: uintptr_t =
mmtk::util::metadata::side_metadata::GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS.as_usize();
pub extern "C" fn get_global_side_metadata_vm_base_address() -> uintptr_t {
mmtk::util::metadata::side_metadata::global_side_metadata_vm_base_address().as_usize()
}

#[no_mangle]
pub static VO_BIT_ADDRESS: uintptr_t =
mmtk::util::metadata::side_metadata::VO_BIT_SIDE_METADATA_ADDR.as_usize();
pub extern "C" fn get_vo_bit_address() -> uintptr_t {
mmtk::util::metadata::side_metadata::vo_bit_side_metadata_addr().as_usize()
}

#[no_mangle]
pub static FREE_LIST_ALLOCATOR_SIZE: uintptr_t =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ void MMTkUnlogBitBarrierSetAssembler::emit_check_unlog_bit_fast_path(MacroAssemb
// not the `tmp1` and `tmp2` from `store_at`.
assert_different_registers(obj, tmp1, tmp2, tmp3);

// tmp2 = load-byte (UNLOG_BIT_BASE_ADDRESS + (obj >> 6));
__ movptr(tmp1, (intptr_t)UNLOG_BIT_BASE_ADDRESS);
// tmp2 = load-byte (unlog_bit_base_address() + (obj >> 6));
__ movptr(tmp1, (intptr_t)unlog_bit_base_address());
__ add(tmp2, tmp1, obj, Assembler::LSR, 6);
// tmp1 = (obj >> 3) & 7
__ movz(tmp1, 7);
Expand Down
4 changes: 2 additions & 2 deletions openjdk/cpu/x86/mmtkBarrierSetAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
// tmp2 = load-byte (SIDE_METADATA_BASE_ADDRESS + (obj >> 6));
__ movptr(tmp3, obj);
__ shrptr(tmp3, 6);
__ movptr(tmp2, VO_BIT_BASE_ADDRESS);
__ movptr(tmp2, vo_bit_base_address());
__ movb(tmp2, Address(tmp2, tmp3));
// tmp3 = 1 << ((obj >> 3) & 7)
// 1. rcx = (obj >> 3) & 7
Expand All @@ -128,7 +128,7 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
// store-byte tmp2 (SIDE_METADATA_BASE_ADDRESS + (obj >> 6))
__ movptr(tmp3, obj);
__ shrptr(tmp3, 6);
__ movptr(rcx, VO_BIT_BASE_ADDRESS);
__ movptr(rcx, vo_bit_base_address());
__ movb(Address(rcx, tmp3), tmp2);
}

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 @@ -17,10 +17,10 @@ void MMTkUnlogBitBarrierSetAssembler::emit_check_unlog_bit_fast_path(MacroAssemb
// not the `tmp1` and `tmp2` from `store_at`.
assert_different_registers(obj, tmp1, tmp2, tmp3);

// tmp2 = load-byte (UNLOG_BIT_BASE_ADDRESS + (obj >> 6));
// tmp2 = load-byte (unlog_bit_base_address() + (obj >> 6));
__ movptr(tmp1, obj);
__ shrptr(tmp1, 6);
__ movptr(tmp2, (intptr_t)UNLOG_BIT_BASE_ADDRESS);
__ movptr(tmp2, (intptr_t)unlog_bit_base_address());
__ movb(tmp2, Address(tmp2, tmp1));
// tmp1 = (obj >> 3) & 7
__ movptr(tmp1, obj);
Expand Down
6 changes: 3 additions & 3 deletions openjdk/share/barriers/mmtkUnlogBitBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ void MMTkUnlogBitBarrierSetC1::emit_check_unlog_bit_fast_path(LIRGenerator* gen,
LIR_Opr addr = gen->new_register(T_OBJECT);
__ move(src, addr);

// uint8_t* meta_addr = (uint8_t*) (UNLOG_BIT_BASE_ADDRESS + (addr >> 6));
// uint8_t* meta_addr = (uint8_t*) (unlog_bit_base_address() + (addr >> 6));
LIR_Opr offset = gen->new_pointer_register();
__ move(addr, offset);
__ unsigned_shift_right(offset, 6, offset);
LIR_Opr base = gen->new_pointer_register();
__ move(LIR_OprFact::longConst(UNLOG_BIT_BASE_ADDRESS), base);
__ move(LIR_OprFact::longConst(unlog_bit_base_address()), base);
LIR_Address* meta_addr = new LIR_Address(base, offset, T_BYTE);

// uint8_t byte_val = *meta_addr;
Expand Down Expand Up @@ -81,7 +81,7 @@ void MMTkUnlogBitBarrierSetC1::object_reference_write_pre_or_post(LIRAccess& acc
Node* MMTkUnlogBitBarrierSetC2::emit_check_unlog_bit_fast_path(MMTkIdealKit& ideal, Node* obj) {
Node* addr = __ CastPX(__ ctrl(), obj);
Node* no_base = __ top();
Node* meta_addr = __ AddP(no_base, __ ConP(UNLOG_BIT_BASE_ADDRESS), __ URShiftX(addr, __ ConI(6)));
Node* meta_addr = __ AddP(no_base, __ ConP(unlog_bit_base_address()), __ URShiftX(addr, __ ConI(6)));
Node* byte = __ load(__ ctrl(), meta_addr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
Node* shift = __ URShiftX(addr, __ ConI(3));
shift = __ AndI(__ ConvL2I(shift), __ ConI(7));
Expand Down
6 changes: 4 additions & 2 deletions openjdk/share/barriers/mmtkUnlogBitBarrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@

struct MMTkC1UnlogBitBarrierSlowPathStub;

const uintptr_t UNLOG_BIT_BASE_ADDRESS = GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS;
inline uintptr_t unlog_bit_base_address() {
return get_global_side_metadata_vm_base_address();
}

//////////////////// Runtime ////////////////////

class MMTkUnlogBitBarrierSetRuntime: public MMTkBarrierSetRuntime {
protected:
static bool is_unlog_bit_set(oop obj) {
uintptr_t addr = (uintptr_t) (void*) obj;
uint8_t* meta_addr = (uint8_t*) (UNLOG_BIT_BASE_ADDRESS + (addr >> 6));
uint8_t* meta_addr = (uint8_t*) (unlog_bit_base_address() + (addr >> 6));
uintptr_t shift = (addr >> 3) & 0b111;
uint8_t byte_val = *meta_addr;
return ((byte_val >> shift) & 1) == 1;
Expand Down
6 changes: 3 additions & 3 deletions openjdk/share/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ typedef enum {
MmapOutOfMemory,
} MMTkAllocationError;

extern const uintptr_t GLOBAL_SIDE_METADATA_BASE_ADDRESS;
extern const uintptr_t GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS;
extern const uintptr_t VO_BIT_ADDRESS;
extern uintptr_t get_global_side_metadata_base_address();
extern uintptr_t get_global_side_metadata_vm_base_address();
extern uintptr_t get_vo_bit_address();
extern const size_t MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES;
extern const uintptr_t FREE_LIST_ALLOCATOR_SIZE;
extern uint8_t CONCURRENT_MARKING_ACTIVE;
Expand Down
4 changes: 3 additions & 1 deletion openjdk/share/mmtkBarrierSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ extern bool mmtk_enable_allocation_fastpath;
extern bool mmtk_enable_barrier_fastpath;
extern bool mmtk_enable_reference_load_barrier;

const intptr_t VO_BIT_BASE_ADDRESS = VO_BIT_ADDRESS;
inline intptr_t vo_bit_base_address() {
return static_cast<intptr_t>(get_vo_bit_address());
}

struct MMTkAllocatorOffsets {
int tlab_top_offset;
Expand Down
4 changes: 2 additions & 2 deletions openjdk/share/mmtkBarrierSetC2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
if (enable_vo_bit || selector.tag == TAG_MARK_COMPACT) {
// set the alloc bit:
// intptr_t addr = (intptr_t) (void*) fast_oop;
// uint8_t* meta_addr = (uint8_t*) (VO_BIT_BASE_ADDRESS + (addr >> 6));
// uint8_t* meta_addr = (uint8_t*) (vo_bit_base_address() + (addr >> 6));
// intptr_t shift = (addr >> 3) & 0b111;
// uint8_t byte_val = *meta_addr;
// uint8_t new_byte_val = byte_val | (1 << shift);
Expand All @@ -306,7 +306,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
Node *meta_offset = new URShiftLNode(obj_addr, addr_shift);
x->transform_later(meta_offset);

Node *meta_base = ConLNode::make(VO_BIT_BASE_ADDRESS);
Node *meta_base = ConLNode::make(vo_bit_base_address());
x->transform_later(meta_base);

Node *meta_addr = new AddLNode(meta_base, meta_offset);
Expand Down
Loading