Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5905662
Add immix allocator
wenyuzhao Feb 22, 2021
9cc7b2a
Reuse lines
wenyuzhao Feb 28, 2021
0a1a8a4
Refactor
wenyuzhao Feb 28, 2021
95b6236
Fix allocation fastpath
wenyuzhao Feb 28, 2021
577b4eb
update mmtk-core
wenyuzhao Feb 28, 2021
aa7305c
Merge branch 'master' into immix
wenyuzhao Mar 1, 2021
b6e9d49
Update mmtk-core
wenyuzhao Mar 1, 2021
552368e
inline hot methods
wenyuzhao Mar 9, 2021
7f9d182
Update
wenyuzhao Mar 25, 2021
4ca6020
Merge branch 'master' into immix
wenyuzhao Mar 25, 2021
2336b1d
Update
wenyuzhao Mar 28, 2021
e6c5570
Move post_alloc to rust
wenyuzhao May 11, 2021
b7e7bb7
Merge commit 'c3dc9d037fbe1472888d1129f70241dcb6e6eb87' into immix
wenyuzhao May 11, 2021
9a9b557
Merge branch 'master' into immix
wenyuzhao May 12, 2021
549a099
Cleanup
wenyuzhao May 13, 2021
15d961e
Fix
wenyuzhao May 26, 2021
15a39e3
Merge remote-tracking branch 'origin/master' into immix
wenyuzhao Jun 14, 2021
a48c903
Merge remote-tracking branch 'origin/master' into immix
wenyuzhao Jun 28, 2021
877e884
Update mmtk-core
wenyuzhao Jun 28, 2021
e1bcc92
Update mmtk-core
qinsoon Jul 9, 2021
8290738
cargo fmt
qinsoon Jul 9, 2021
b4f5be2
Merge branch 'master' into immix
wenyuzhao Jul 13, 2021
64c4537
Merge branch 'master' into immix
wenyuzhao Jul 16, 2021
ba8ee06
Fix after rebase
wenyuzhao Jul 16, 2021
41c8b45
extract common code
wenyuzhao Jul 16, 2021
bfa0e90
Update mmtk
wenyuzhao Jul 16, 2021
8687daa
Merge branch 'master' into metadata-offset
qinsoon Jul 21, 2021
c579501
Revert changes for makr bit in_header()
qinsoon Jul 21, 2021
1c71931
Use side mark bits
wenyuzhao Jul 21, 2021
52fe54b
Update Cargo.toml
qinsoon Jul 22, 2021
79d1a54
Merge branch 'master' into immix
wenyuzhao Jul 22, 2021
fba5245
Merge remote-tracking branch 'origin/metadata-offset' into immix
wenyuzhao Jul 22, 2021
c728a06
Update mmtk
wenyuzhao Jul 22, 2021
c442877
Update mmtk-core
wenyuzhao Jul 23, 2021
a178535
Remove unused fields
wenyuzhao Jul 28, 2021
bd97b37
Merge remote-tracking branch 'origin/master' into immix
wenyuzhao Jul 29, 2021
ecb863e
Add ci tests
wenyuzhao Aug 1, 2021
e5632d7
Fix MetadataSpec api
wenyuzhao Aug 3, 2021
6e3da7c
Run immix tests before build with MARK_IN_HEADER=1
wenyuzhao Aug 3, 2021
339ce86
Merge remote-tracking branch 'origin/master' into immix
wenyuzhao Aug 5, 2021
ab9d225
Update Cargo.toml
qinsoon Aug 9, 2021
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
6 changes: 6 additions & 0 deletions .github/scripts/ci-test-assertions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export MMTK_PLAN=SemiSpace
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
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

# --- Immix ---
export MMTK_PLAN=Immix

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
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

# -- GenCopy --
export MMTK_PLAN=GenCopy

Expand Down
18 changes: 18 additions & 0 deletions .github/scripts/ci-test-normal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHea
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 hsqldb
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 eclipse

# --- Immix ---
export MMTK_PLAN=Immix

# Test - the benchmarks that are commented out do not work yet
# 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.
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
#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
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
#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
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
#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
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
#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

# These benchmarks take 40s+ for slowdebug build, we may consider removing them from the CI
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 hsqldb
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 eclipse

# --- GenCopy ---
export MMTK_PLAN=GenCopy

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

Expand All @@ -42,3 +42,4 @@ semispace = []
gencopy = []
marksweep = []
pageprotect = []
immix = []
2 changes: 2 additions & 0 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ lazy_static! {
std::env::set_var("MMTK_PLAN", "MarkSweep");
#[cfg(feature = "pageprotect")]
std::env::set_var("MMTK_PLAN", "PageProtect");
#[cfg(feature = "immix")]
std::env::set_var("MMTK_PLAN", "Immix");
MMTK::new()
};
}
1 change: 1 addition & 0 deletions openjdk/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct AllocatorSelector {
#define TAG_BUMP_POINTER 0
#define TAG_LARGE_OBJECT 1
#define TAG_MALLOC 2
#define TAG_IMMIX 3

extern AllocatorSelector get_allocator_mapping(int allocator);
extern size_t get_max_non_los_default_alloc_bytes();
Expand Down
27 changes: 19 additions & 8 deletions openjdk/mmtkBarrierSetAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,29 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
}

// Only bump pointer allocator is implemented.
if (selector.tag != TAG_BUMP_POINTER) {
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_IMMIX) {
fatal("unimplemented allocator fastpath\n");
}

// Calculate offsets of top and end. We now assume we are using bump pointer.
int allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
+ selector.index * sizeof(BumpAllocator);
// Calculat offsets of top and end. We now assume we are using bump pointer.
int allocator_base_offset;
Address cursor, limit;

Address cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor)));
Address limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit)));
if (selector.tag == TAG_IMMIX) {
allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
+ in_bytes(byte_offset_of(Allocators, immix))
+ selector.index * sizeof(ImmixAllocator);
cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, cursor)));
limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, limit)));
} else {
allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
+ selector.index * sizeof(BumpAllocator);
cursor = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor)));
limit = Address(r15_thread, allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit)));
}
// obj = load lab.cursor
__ movptr(obj, cursor);
// end = obj + size
Expand Down
25 changes: 17 additions & 8 deletions openjdk/mmtkBarrierSetC2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,28 @@ void MMTkBarrierSetC2::expand_allocate(

{
// Only bump pointer allocator fastpath is implemented.
if (selector.tag != TAG_BUMP_POINTER) {
if (selector.tag != TAG_BUMP_POINTER && selector.tag != TAG_IMMIX) {
fatal("unimplemented allocator fastpath\n");
}

// Calculat offsets of top and end. We now assume we are using bump pointer.
int allocator_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators))
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
+ selector.index * sizeof(BumpAllocator);

int allocators_base_offset = in_bytes(JavaThread::third_party_heap_mutator_offset())
+ in_bytes(byte_offset_of(MMTkMutatorContext, allocators));
int tlab_top_offset, tlab_end_offset;
if (selector.tag == TAG_IMMIX) {
int allocator_base_offset = allocators_base_offset
+ in_bytes(byte_offset_of(Allocators, immix))
+ selector.index * sizeof(ImmixAllocator);
tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, cursor));
tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(ImmixAllocator, limit));
} else {
int allocator_base_offset = allocators_base_offset
+ in_bytes(byte_offset_of(Allocators, bump_pointer))
+ selector.index * sizeof(BumpAllocator);
tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor));
tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit));
}
Node* thread = x->transform_later(new ThreadLocalNode());
int tlab_top_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, cursor));
int tlab_end_offset = allocator_base_offset + in_bytes(byte_offset_of(BumpAllocator, limit));
eden_top_adr = x->basic_plus_adr(x->top()/*not oop*/, thread, tlab_top_offset);
eden_end_adr = x->basic_plus_adr(x->top()/*not oop*/, thread, tlab_end_offset);
}
Expand Down
18 changes: 18 additions & 0 deletions openjdk/mmtkMutator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct RustDynPtr {
const int MAX_BUMP_ALLOCATORS = 5;
const int MAX_LARGE_OBJECT_ALLOCATORS = 1;
const int MAX_MALLOC_ALLOCATORS = 1;
const int MAX_IMMIX_ALLOCATORS = 1;

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

Expand All @@ -39,6 +40,22 @@ struct LargeObjectAllocator {
RustDynPtr plan;
};

struct ImmixAllocator {
void* tls;
void* cursor;
void* limit;
void* immix_space;
RustDynPtr plan;
uint8_t hot;
uint8_t copy;
void* large_cursor;
void* large_limit;
uint8_t request_for_large;
uint8_t _align[7];
uint8_t line_opt_tag;
uintptr_t line_opt;
};

struct MallocAllocator {
void* tls;
void* space;
Expand All @@ -49,6 +66,7 @@ struct Allocators {
BumpAllocator bump_pointer[MAX_BUMP_ALLOCATORS];
LargeObjectAllocator large_object[MAX_LARGE_OBJECT_ALLOCATORS];
MallocAllocator malloc[MAX_MALLOC_ALLOCATORS];
ImmixAllocator immix[MAX_IMMIX_ALLOCATORS];
};

struct MutatorConfig {
Expand Down