diff --git a/.github/scripts/ci-test-assertions.sh b/.github/scripts/ci-test-assertions.sh index 0a6a7d2f..64e75996 100755 --- a/.github/scripts/ci-test-assertions.sh +++ b/.github/scripts/ci-test-assertions.sh @@ -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 diff --git a/.github/scripts/ci-test-normal.sh b/.github/scripts/ci-test-normal.sh index 3ea6bead..e6ee752a 100755 --- a/.github/scripts/ci-test-normal.sh +++ b/.github/scripts/ci-test-normal.sh @@ -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 diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index bad132ee..3fd768bd 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -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" } @@ -42,3 +42,4 @@ semispace = [] gencopy = [] marksweep = [] pageprotect = [] +immix = [] diff --git a/mmtk/src/lib.rs b/mmtk/src/lib.rs index bc328de1..a335bb6b 100644 --- a/mmtk/src/lib.rs +++ b/mmtk/src/lib.rs @@ -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() }; } diff --git a/openjdk/mmtk.h b/openjdk/mmtk.h index 2481e331..e8ad38d5 100644 --- a/openjdk/mmtk.h +++ b/openjdk/mmtk.h @@ -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(); diff --git a/openjdk/mmtkBarrierSetAssembler_x86.cpp b/openjdk/mmtkBarrierSetAssembler_x86.cpp index f6625073..2089cf83 100644 --- a/openjdk/mmtkBarrierSetAssembler_x86.cpp +++ b/openjdk/mmtkBarrierSetAssembler_x86.cpp @@ -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 diff --git a/openjdk/mmtkBarrierSetC2.cpp b/openjdk/mmtkBarrierSetC2.cpp index aea2c0db..d5418864 100644 --- a/openjdk/mmtkBarrierSetC2.cpp +++ b/openjdk/mmtkBarrierSetC2.cpp @@ -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); } diff --git a/openjdk/mmtkMutator.hpp b/openjdk/mmtkMutator.hpp index 12cff9d6..410499e0 100644 --- a/openjdk/mmtkMutator.hpp +++ b/openjdk/mmtkMutator.hpp @@ -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) @@ -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; @@ -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 {