Skip to content

Commit cdb745f

Browse files
authored
Mark compact (#124)
1 parent 138fffe commit cdb745f

File tree

10 files changed

+151
-32
lines changed

10 files changed

+151
-32
lines changed

.github/scripts/ci-test-normal.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHea
102102
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms1G -Xmx1G -jar benchmarks/dacapo-2006-10-MR2.jar pmd - OOM
103103
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms1G -Xmx1G -jar benchmarks/dacapo-2006-10-MR2.jar xalan - OOM
104104

105+
# --- MarkCompact ---
106+
export MMTK_PLAN=MarkCompact
107+
# Test - the benchmarks that are commented out do not work yet
108+
# Note: the command line options are necessary for now to ensure the benchmarks work. We may later change the options if we do not have these many constraints.
109+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar antlr
110+
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar bloat - does not work for stock build
111+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar fop
112+
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar jython - does not work for stock build
113+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar luindex
114+
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar lusearch - validation failed
115+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar pmd
116+
#build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar xalan - mmtk-core gets stuck in slowdebug build
117+
118+
# These benchmarks take 40s+ for slowdebug build, we may consider removing them from the CI
119+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -XX:TieredStopAtLevel=1 -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar hsqldb
120+
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -XX:TieredStopAtLevel=1 -Xms500M -Xmx500M -jar benchmarks/dacapo-2006-10-MR2.jar eclipse
121+
105122
# --- MarkSweep ---
106123
export MMTK_PLAN=MarkSweep
107124

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ lazy_static = "1.1"
2020
# - change branch
2121
# - change repo name
2222
# But other changes including adding/removing whitespaces in commented lines may break the CI.
23-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "8e50e2c3fa8b45f7e4cd4b9e87e986fb5c17b07e" }
23+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "4bd6ca82ad037dac97920bf3a1408e4912a6bf04" }
2424
# Uncomment the following to build locally
2525
# mmtk = { path = "../repos/mmtk-core" }
2626

mmtk/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ pub struct OpenJDK_Upcalls {
8181
pub scan_vm_thread_roots: extern "C" fn(process_edges: ProcessEdgesFn),
8282
pub number_of_mutators: extern "C" fn() -> usize,
8383
pub schedule_finalizer: extern "C" fn(),
84+
pub prepare_for_roots_re_scanning: extern "C" fn(),
85+
pub object_alignment: extern "C" fn() -> i32,
8486
}
8587

8688
pub static mut UPCALLS: *const OpenJDK_Upcalls = null_mut();
@@ -118,10 +120,16 @@ lazy_static! {
118120
std::env::set_var("MMTK_PLAN", "GenCopy");
119121
#[cfg(feature = "marksweep")]
120122
std::env::set_var("MMTK_PLAN", "MarkSweep");
123+
#[cfg(feature = "markcompact")]
124+
std::env::set_var("MMTK_PLAN", "MarkCompact");
121125
#[cfg(feature = "pageprotect")]
122126
std::env::set_var("MMTK_PLAN", "PageProtect");
123127
#[cfg(feature = "immix")]
124128
std::env::set_var("MMTK_PLAN", "Immix");
125129
MMTK::new()
126130
};
127131
}
132+
133+
#[no_mangle]
134+
pub static MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES: usize =
135+
mmtk::util::alloc::MarkCompactAllocator::<OpenJDK>::HEADER_RESERVED_IN_BYTES;

mmtk/src/object_model.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::sync::atomic::Ordering;
22

33
use super::UPCALLS;
44
use crate::{vm_metadata, OpenJDK};
5+
use mmtk::util::alloc::fill_alignment_gap;
56
use mmtk::util::metadata::header_metadata::HeaderMetadataSpec;
67
use mmtk::util::{Address, ObjectReference};
78
use mmtk::vm::*;
@@ -102,8 +103,23 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
102103
to_obj
103104
}
104105

105-
fn copy_to(_from: ObjectReference, _to: ObjectReference, _region: Address) -> Address {
106-
unimplemented!()
106+
fn copy_to(from: ObjectReference, to: ObjectReference, region: Address) -> Address {
107+
let need_copy = from != to;
108+
let bytes = unsafe { ((*UPCALLS).get_object_size)(from) };
109+
if need_copy {
110+
// copy obj to target
111+
let dst = to.to_address();
112+
// Copy
113+
let src = from.to_address();
114+
for i in 0..bytes {
115+
unsafe { (dst + i).store((src + i).load::<u8>()) };
116+
}
117+
}
118+
let start = Self::object_start_ref(to);
119+
if region != Address::ZERO {
120+
fill_alignment_gap::<OpenJDK>(region, start);
121+
}
122+
start + bytes
107123
}
108124

109125
fn get_reference_when_copied_to(_from: ObjectReference, _to: Address) -> ObjectReference {
@@ -114,6 +130,19 @@ impl ObjectModel<OpenJDK> for VMObjectModel {
114130
unsafe { ((*UPCALLS).get_object_size)(object) }
115131
}
116132

133+
fn get_size_when_copied(object: ObjectReference) -> usize {
134+
Self::get_current_size(object)
135+
}
136+
137+
fn get_align_when_copied(_object: ObjectReference) -> usize {
138+
// FIXME figure out the proper alignment
139+
::std::mem::size_of::<usize>()
140+
}
141+
142+
fn get_align_offset_when_copied(_object: ObjectReference) -> isize {
143+
0
144+
}
145+
117146
fn get_type_descriptor(_reference: ObjectReference) -> &'static [i8] {
118147
unimplemented!()
119148
}

mmtk/src/scanning.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,10 @@ impl Scanning<OpenJDK> for VMScanning {
101101
fn supports_return_barrier() -> bool {
102102
unimplemented!()
103103
}
104+
105+
fn prepare_for_roots_re_scanning() {
106+
unsafe {
107+
((*UPCALLS).prepare_for_roots_re_scanning)();
108+
}
109+
}
104110
}

openjdk/mmtk.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ typedef void* MMTk_TraceLocal;
1515
extern const uintptr_t GLOBAL_SIDE_METADATA_BASE_ADDRESS;
1616
extern const uintptr_t GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS;
1717
extern const uintptr_t GLOBAL_ALLOC_BIT_ADDRESS;
18+
extern const size_t MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES;
1819

1920
/**
2021
* Allocation
@@ -50,10 +51,11 @@ struct AllocatorSelector {
5051
uint8_t index;
5152
};
5253

53-
#define TAG_BUMP_POINTER 0
54-
#define TAG_LARGE_OBJECT 1
55-
#define TAG_MALLOC 2
56-
#define TAG_IMMIX 3
54+
#define TAG_BUMP_POINTER 0
55+
#define TAG_LARGE_OBJECT 1
56+
#define TAG_MALLOC 2
57+
#define TAG_IMMIX 3
58+
#define TAG_MARK_COMPACT 4
5759

5860
extern AllocatorSelector get_allocator_mapping(int allocator);
5961
extern size_t get_max_non_los_default_alloc_bytes();
@@ -133,6 +135,7 @@ typedef struct {
133135
void (*scan_vm_thread_roots) (ProcessEdgesFn process_edges);
134136
size_t (*number_of_mutators)();
135137
void (*schedule_finalizer)();
138+
void (*prepare_for_roots_re_scanning)();
136139
} OpenJDK_Upcalls;
137140

138141
extern void openjdk_gc_init(OpenJDK_Upcalls *calls, size_t heap_size);

openjdk/mmtkBarrierSetAssembler_x86.cpp

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,32 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
4747
// default space.
4848
assert(MMTkMutatorContext::max_non_los_default_alloc_bytes != 0, "max_non_los_default_alloc_bytes hasn't been initialized");
4949
size_t max_non_los_bytes = MMTkMutatorContext::max_non_los_default_alloc_bytes;
50+
size_t extra_header = 0;
51+
// fastpath, we only use default allocator
52+
Allocator allocator = AllocatorDefault;
53+
// We need to figure out which allocator we are using by querying MMTk.
54+
AllocatorSelector selector = get_allocator_mapping(allocator);
55+
if (selector.tag == TAG_MARK_COMPACT) extra_header = MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES;
56+
5057
if (var_size_in_bytes == noreg) {
5158
// constant alloc size. If it is larger than max_non_los_bytes, we directly go to slowpath.
52-
if ((size_t)con_size_in_bytes > max_non_los_bytes) {
59+
if ((size_t)con_size_in_bytes > max_non_los_bytes - extra_header) {
5360
__ jmp(slow_case);
5461
return;
5562
}
5663
} else {
5764
// var alloc size. We compare with max_non_los_bytes and conditionally jump to slowpath.
58-
__ cmpptr(var_size_in_bytes, max_non_los_bytes);
65+
__ cmpptr(var_size_in_bytes, max_non_los_bytes - extra_header);
5966
__ jcc(Assembler::aboveEqual, slow_case);
6067
}
6168

62-
// fastpath, we only use default allocator
63-
Allocator allocator = AllocatorDefault;
64-
// We need to figure out which allocator we are using by querying MMTk.
65-
AllocatorSelector selector = get_allocator_mapping(allocator);
66-
6769
if (selector.tag == TAG_MALLOC || selector.tag == TAG_LARGE_OBJECT) {
6870
__ jmp(slow_case);
6971
return;
7072
}
7173

7274
// Only bump pointer allocator is implemented.
73-
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_IMMIX) {
75+
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_MARK_COMPACT && selector.tag != TAG_IMMIX) {
7476
fatal("unimplemented allocator fastpath\n");
7577
}
7678

@@ -85,16 +87,26 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
8587
+ selector.index * sizeof(ImmixAllocator);
8688
cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, cursor)));
8789
limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, limit)));
88-
} else {
90+
} else if(selector.tag == TAG_BUMP_POINTER) {
8991
allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
9092
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
9193
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
9294
+ selector.index * sizeof(BumpAllocator);
9395
cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor)));
9496
limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit)));
97+
} else {
98+
// markcompact allocator
99+
allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
100+
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
101+
+ in_bytes(byte_offset_of(Allocators, markcompact))
102+
+ selector.index * sizeof(MarkCompactAllocator)
103+
+ in_bytes(byte_offset_of(MarkCompactAllocator, bump_allocator));
104+
cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor)));
105+
limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit)));
95106
}
96107
// obj = load lab.cursor
97108
__ movptr(obj, cursor);
109+
if (selector.tag == TAG_MARK_COMPACT) __ addptr(obj, extra_header);
98110
// end = obj + size
99111
Register end = t1;
100112
if (var_size_in_bytes == noreg) {
@@ -110,8 +122,12 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
110122
__ jcc(Assembler::above, slow_case);
111123
// lab.cursor = end
112124
__ movptr(cursor, end);
113-
114-
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
125+
bool enable_global_alloc_bit = false;
126+
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
127+
enable_global_alloc_bit = true;
128+
#endif
129+
// #ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
130+
if(enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) {
115131
Register tmp3 = rdi;
116132
Register tmp2 = rscratch1;
117133
assert_different_registers(obj, tmp2, tmp3, rcx);
@@ -137,15 +153,16 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
137153
__ shrptr(tmp3, 6);
138154
__ movptr(rcx, ALLOC_BIT_BASE_ADDRESS);
139155
__ movb(Address(rcx, tmp3), tmp2);
140-
141-
#endif
156+
}
157+
// #endif
142158

143159
// BarrierSetAssembler::incr_allocated_bytes
144160
if (var_size_in_bytes->is_valid()) {
145161
__ addq(Address(r15_thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
146162
} else {
147163
__ addq(Address(r15_thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
148164
}
165+
__ addq(Address(r15_thread, in_bytes(JavaThread::allocated_bytes_offset())), extra_header);
149166
}
150167
}
151168

openjdk/mmtkBarrierSetC2.cpp

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
7878
// The max non-los bytes from MMTk
7979
assert(MMTkMutatorContext::max_non_los_default_alloc_bytes != 0, "max_non_los_default_alloc_bytes hasn't been initialized");
8080
size_t max_non_los_bytes = MMTkMutatorContext::max_non_los_default_alloc_bytes;
81+
size_t extra_header = 0;
82+
// We always use the default allocator.
83+
// But we need to figure out which allocator we are using by querying MMTk.
84+
AllocatorSelector selector = get_allocator_mapping(AllocatorDefault);
85+
if (selector.tag == TAG_MARK_COMPACT) extra_header = MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES;
86+
8187
// Check if allocation size is constant
8288
long const_size = x->_igvn.find_long_con(size_in_bytes, -1);
8389
if (const_size >= 0) {
8490
// Constant alloc size. We know it is non-negative, it is safe to cast to unsigned long and compare with size_t
85-
if (((unsigned long)const_size) > max_non_los_bytes) {
91+
if (((unsigned long)const_size) > max_non_los_bytes - extra_header) {
8692
// We know at JIT time that we need to go to slowpath
8793
always_slow = true;
8894
initial_slow_test = NULL;
@@ -91,7 +97,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
9197
// Variable alloc size
9298

9399
// Create a node for the constant and compare with size_in_bytes
94-
Node *max_non_los_bytes_node = ConLNode::make((long)max_non_los_bytes);
100+
Node *max_non_los_bytes_node = ConLNode::make((long)max_non_los_bytes - extra_header);
95101
x->transform_later(max_non_los_bytes_node);
96102
Node *mmtk_size_cmp = new CmpLNode(size_in_bytes, max_non_los_bytes_node);
97103
x->transform_later(mmtk_size_cmp);
@@ -121,10 +127,6 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
121127
}
122128
}
123129

124-
// We always use the default allocator.
125-
// But we need to figure out which allocator we are using by querying MMTk.
126-
AllocatorSelector selector = get_allocator_mapping(AllocatorDefault);
127-
128130
if (x->C->env()->dtrace_alloc_probes() || !MMTK_ENABLE_ALLOCATION_FASTPATH
129131
// Malloc allocator has no fastpath
130132
|| (selector.tag == TAG_MALLOC || selector.tag == TAG_LARGE_OBJECT)) {
@@ -173,7 +175,7 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
173175

174176
{
175177
// Only bump pointer allocator fastpath is implemented.
176-
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_IMMIX) {
178+
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_MARK_COMPACT && selector.tag != TAG_IMMIX) {
177179
fatal("unimplemented allocator fastpath\n");
178180
}
179181

@@ -187,12 +189,20 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
187189
+ selector.index * sizeof(ImmixAllocator);
188190
tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, cursor));
189191
tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, limit));
190-
} else {
192+
} else if (selector.tag == TAG_BUMP_POINTER) {
191193
int allocator_base_offset = allocators_base_offset
192194
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
193195
+ selector.index * sizeof(BumpAllocator);
194196
tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor));
195197
tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit));
198+
} else {
199+
// markcompact allocator
200+
int allocator_base_offset = allocators_base_offset
201+
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
202+
+ selector.index * sizeof(MarkCompactAllocator)
203+
+ in_bytes(byte_offset_of(MarkCompactAllocator, bump_allocator));
204+
tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor));
205+
tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit));
196206
}
197207
Node* thread = x->transform_later(new ThreadLocalNode());
198208
eden_top_adr = x->basic_plus_adr(x->top()/*not oop*/, thread, tlab_top_offset);
@@ -226,8 +236,17 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
226236

227237
// Load(-locked) the heap top.
228238
// See note above concerning the control input when using a TLAB
229-
Node *old_eden_top = new LoadPNode(ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered);
230-
239+
Node *old_eden_top;
240+
241+
if (selector.tag == TAG_MARK_COMPACT) {
242+
Node *offset = ConLNode::make(extra_header);
243+
x->transform_later(offset);
244+
Node *node = new LoadPNode(ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered);
245+
x->transform_later(node);
246+
old_eden_top = new AddPNode(x->top(), node, offset);
247+
} else {
248+
old_eden_top = new LoadPNode(ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered);
249+
}
231250
x->transform_later(old_eden_top);
232251
// Add to heap top to get a new heap top
233252
Node *new_eden_top = new AddPNode(x->top(), old_eden_top, size_in_bytes);
@@ -277,7 +296,12 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
277296
fast_oop_ctrl = needgc_false; // No contention, so this is the fast path
278297
fast_oop_rawmem = store_eden_top;
279298

280-
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
299+
bool enable_global_alloc_bit = false;
300+
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
301+
enable_global_alloc_bit = true;
302+
#endif
303+
// #ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
304+
if(enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) {
281305
// set the alloc bit:
282306
// intptr_t addr = (intptr_t) (void*) fast_oop;
283307
// uint8_t* meta_addr = (uint8_t*) (ALLOC_BIT_BASE_ADDRESS + (addr >> 6));
@@ -334,7 +358,8 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x,
334358
x->transform_later(set_alloc_bit);
335359

336360
fast_oop_rawmem = set_alloc_bit;
337-
#endif
361+
}
362+
// #endif
338363

339364
InitializeNode* init = alloc->initialization();
340365
fast_oop_rawmem = x->initialize_object(alloc,

openjdk/mmtkMutator.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const int MAX_BUMP_ALLOCATORS = 5;
2323
const int MAX_LARGE_OBJECT_ALLOCATORS = 1;
2424
const int MAX_MALLOC_ALLOCATORS = 1;
2525
const int MAX_IMMIX_ALLOCATORS = 1;
26+
const int MAX_MARK_COMPACT_ALLOCATORS = 1;
2627

2728
// The following types should have the same layout as the types with the same name in MMTk core (Rust)
2829

@@ -63,11 +64,16 @@ struct MallocAllocator {
6364
RustDynPtr plan;
6465
};
6566

67+
struct MarkCompactAllocator {
68+
struct BumpAllocator bump_allocator;
69+
};
70+
6671
struct Allocators {
6772
BumpAllocator bump_pointer[MAX_BUMP_ALLOCATORS];
6873
LargeObjectAllocator large_object[MAX_LARGE_OBJECT_ALLOCATORS];
6974
MallocAllocator malloc[MAX_MALLOC_ALLOCATORS];
7075
ImmixAllocator immix[MAX_IMMIX_ALLOCATORS];
76+
MarkCompactAllocator markcompact[MAX_MARK_COMPACT_ALLOCATORS];
7177
};
7278

7379
struct MutatorConfig {

0 commit comments

Comments
 (0)