diff --git a/.github/scripts/ci-test-global-alloc-bit.sh b/.github/scripts/ci-test-vo-bit.sh similarity index 99% rename from .github/scripts/ci-test-global-alloc-bit.sh rename to .github/scripts/ci-test-vo-bit.sh index d38c71bf..7c8d43fb 100755 --- a/.github/scripts/ci-test-global-alloc-bit.sh +++ b/.github/scripts/ci-test-vo-bit.sh @@ -5,7 +5,7 @@ set -xe unset JAVA_TOOL_OPTIONS export MMTK_EXTREME_ASSERTIONS=0 -export GLOBAL_ALLOC_BIT=1 +export VO_BIT=1 . $(dirname "$0")/ci-build.sh cd $OPENJDK_PATH diff --git a/.github/scripts/ci-test.sh b/.github/scripts/ci-test.sh index 1de23a83..6112d1b9 100755 --- a/.github/scripts/ci-test.sh +++ b/.github/scripts/ci-test.sh @@ -10,6 +10,6 @@ cd $cur cd $cur ./ci-test-assertions.sh cd $cur -./ci-test-global-alloc-bit.sh +./ci-test-vo-bit.sh cd $cur ./ci-test-malloc-mark-sweep.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38b9252f..7c86df77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,8 @@ jobs: run: | ./.github/scripts/ci-build.sh ./.github/scripts/ci-test-only-normal.sh - - name: DaCapo Tests with global allocation bit - run: ./.github/scripts/ci-test-global-alloc-bit.sh + - name: DaCapo Tests with valid object bit (VO bit) + run: ./.github/scripts/ci-test-vo-bit.sh - name: DaCapo Tests with malloc Mark-Sweep run: ./.github/scripts/ci-test-malloc-mark-sweep.sh diff --git a/README.md b/README.md index bb7c89bd..6e5c071e 100644 --- a/README.md +++ b/README.md @@ -197,12 +197,14 @@ building OpenJDK, we can change its location to be in the object's header: $ MARK_IN_HEADER=1 make CONF=linux-x86_64-normal-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk ``` -### Alloc bit -To support the `global_alloc_bit` feature in mmtk-core, you can set the environment variable `GLOBAL_ALLOC_BIT=1` when -building OpenJDK. This will set the feature for mmtk-core, as well as compiling the fastpath for the alloc bit. +### Valid object bit + +To support the `vo_bit` (valid object bit) feature in mmtk-core, you can set the +environment variable `VO_BIT=1` when building OpenJDK. This will set the feature +for mmtk-core, as well as compiling the fastpath for the VO bit. ```console -$ GLOBAL_ALLOC_BIT=1 make CONF=linux-x86_64-normal-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk +$ VO_BIT=1 make CONF=linux-x86_64-normal-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$PWD/../mmtk-openjdk/openjdk ``` ## Test diff --git a/mmtk/Cargo.lock b/mmtk/Cargo.lock index 0f560737..b95913e7 100644 --- a/mmtk/Cargo.lock +++ b/mmtk/Cargo.lock @@ -419,7 +419,7 @@ dependencies = [ [[package]] name = "mmtk" version = "0.18.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=f8469b0a019bea58cba26e9fb5c70fb7398ccd31#f8469b0a019bea58cba26e9fb5c70fb7398ccd31" +source = "git+https://github.com/mmtk/mmtk-core.git?rev=df146b7af6cf41cc7d6996e1ca538fd2b32950f5#df146b7af6cf41cc7d6996e1ca538fd2b32950f5" dependencies = [ "atomic", "atomic-traits", @@ -448,7 +448,7 @@ dependencies = [ [[package]] name = "mmtk-macros" version = "0.18.0" -source = "git+https://github.com/mmtk/mmtk-core.git?rev=f8469b0a019bea58cba26e9fb5c70fb7398ccd31#f8469b0a019bea58cba26e9fb5c70fb7398ccd31" +source = "git+https://github.com/mmtk/mmtk-core.git?rev=df146b7af6cf41cc7d6996e1ca538fd2b32950f5#df146b7af6cf41cc7d6996e1ca538fd2b32950f5" dependencies = [ "proc-macro-error", "proc-macro2", diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index f99f27c0..cae04d45 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -30,7 +30,7 @@ once_cell = "1.10.0" # - 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 = "f8469b0a019bea58cba26e9fb5c70fb7398ccd31" } +mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "df146b7af6cf41cc7d6996e1ca538fd2b32950f5" } # Uncomment the following to build locally # mmtk = { path = "../repos/mmtk-core" } @@ -42,9 +42,9 @@ default = [] mmtk_extreme_assertions = ["mmtk/extreme_assertions"] nogc_lock_free = ["mmtk/nogc_lock_free"] nogc_no_zeroing = ["mmtk/nogc_no_zeroing"] -# Use the env var GLOBAL_ALLOC_BIT=1 when building OpenJDK so the fastpath for setting the alloc bit will be compiled in. +# Use the env var VO_BIT=1 when building OpenJDK so the fastpath for setting the alloc bit will be compiled in. # See README. -global_alloc_bit = ["mmtk/global_alloc_bit"] +vo_bit = ["mmtk/vo_bit"] # This compile time constant places the mark bit in the header of the object instead of on the side. mark_bit_in_header = [] diff --git a/mmtk/src/lib.rs b/mmtk/src/lib.rs index 45820e47..7bca0753 100644 --- a/mmtk/src/lib.rs +++ b/mmtk/src/lib.rs @@ -108,8 +108,8 @@ pub static 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 GLOBAL_ALLOC_BIT_ADDRESS: uintptr_t = - mmtk::util::metadata::side_metadata::ALLOC_SIDE_METADATA_ADDR.as_usize(); +pub static 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 = diff --git a/openjdk/CompileThirdPartyHeap.gmk b/openjdk/CompileThirdPartyHeap.gmk index 7224526a..e946eb7e 100644 --- a/openjdk/CompileThirdPartyHeap.gmk +++ b/openjdk/CompileThirdPartyHeap.gmk @@ -19,11 +19,11 @@ ifdef MMTK_PLAN GC_FEATURES=--features $(MMTK_PLAN) endif -ifeq ($(GLOBAL_ALLOC_BIT), 1) +ifeq ($(VO_BIT), 1) ifndef GC_FEATURES - GC_FEATURES=--features global_alloc_bit + GC_FEATURES=--features vo_bit else - GC_FEATURES:=$(strip $(GC_FEATURES))",global_alloc_bit" + GC_FEATURES:=$(strip $(GC_FEATURES))",vo_bit" endif endif @@ -79,8 +79,8 @@ FORCE: TARGETS += $(LIB_MMTK) JVM_SRC_DIRS += $(MMTK_CPP_ROOT) $(MMTK_CPP_ROOT)/barriers JVM_CFLAGS += -std=c++11 -DINCLUDE_THIRD_PARTY_HEAP -DTHIRD_PARTY_HEAP_SRC=$(MMTK_CPP_ROOT) -ifeq ($(GLOBAL_ALLOC_BIT), 1) - JVM_CFLAGS += -DMMTK_ENABLE_GLOBAL_ALLOC_BIT +ifeq ($(VO_BIT), 1) + JVM_CFLAGS += -DMMTK_ENABLE_VO_BIT endif $(BUILD_LIBJVM): $(LIB_MMTK) diff --git a/openjdk/mmtk.h b/openjdk/mmtk.h index b1da9454..a2c3d9c9 100644 --- a/openjdk/mmtk.h +++ b/openjdk/mmtk.h @@ -20,7 +20,7 @@ typedef enum { extern const uintptr_t GLOBAL_SIDE_METADATA_BASE_ADDRESS; extern const uintptr_t GLOBAL_SIDE_METADATA_VM_BASE_ADDRESS; -extern const uintptr_t GLOBAL_ALLOC_BIT_ADDRESS; +extern const uintptr_t VO_BIT_ADDRESS; extern const size_t MMTK_MARK_COMPACT_HEADER_RESERVED_IN_BYTES; extern const uintptr_t FREE_LIST_ALLOCATOR_SIZE; diff --git a/openjdk/mmtkBarrierSet.hpp b/openjdk/mmtkBarrierSet.hpp index efced87a..07990706 100644 --- a/openjdk/mmtkBarrierSet.hpp +++ b/openjdk/mmtkBarrierSet.hpp @@ -40,7 +40,7 @@ #define MMTK_ENABLE_ALLOCATION_FASTPATH true #define MMTK_ENABLE_BARRIER_FASTPATH true -const intptr_t ALLOC_BIT_BASE_ADDRESS = GLOBAL_ALLOC_BIT_ADDRESS; +const intptr_t VO_BIT_BASE_ADDRESS = VO_BIT_ADDRESS; struct MMTkAllocatorOffsets { int tlab_top_offset; diff --git a/openjdk/mmtkBarrierSetAssembler_x86.cpp b/openjdk/mmtkBarrierSetAssembler_x86.cpp index cb06763b..dc59274e 100644 --- a/openjdk/mmtkBarrierSetAssembler_x86.cpp +++ b/openjdk/mmtkBarrierSetAssembler_x86.cpp @@ -98,11 +98,11 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa __ jcc(Assembler::above, slow_case); // lab.cursor = end __ movptr(cursor, end); - bool enable_global_alloc_bit = false; - #ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT - enable_global_alloc_bit = true; + bool enable_vo_bit = false; + #ifdef MMTK_ENABLE_VO_BIT + enable_vo_bit = true; #endif - if (enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) { + if (enable_vo_bit || selector.tag == TAG_MARK_COMPACT) { Register tmp3 = rdi; Register tmp2 = rscratch1; assert_different_registers(obj, tmp2, tmp3, rcx); @@ -110,7 +110,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, ALLOC_BIT_BASE_ADDRESS); + __ movptr(tmp2, VO_BIT_BASE_ADDRESS); __ movb(tmp2, Address(tmp2, tmp3)); // tmp3 = 1 << ((obj >> 3) & 7) // 1. rcx = (obj >> 3) & 7 @@ -126,7 +126,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, ALLOC_BIT_BASE_ADDRESS); + __ movptr(rcx, VO_BIT_BASE_ADDRESS); __ movb(Address(rcx, tmp3), tmp2); } diff --git a/openjdk/mmtkBarrierSetC2.cpp b/openjdk/mmtkBarrierSetC2.cpp index d885fe97..b58e433d 100644 --- a/openjdk/mmtkBarrierSetC2.cpp +++ b/openjdk/mmtkBarrierSetC2.cpp @@ -272,14 +272,14 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x, fast_oop_ctrl = needgc_false; // No contention, so this is the fast path fast_oop_rawmem = store_eden_top; - bool enable_global_alloc_bit = false; - #ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT - enable_global_alloc_bit = true; + bool enable_vo_bit = false; + #ifdef MMTK_ENABLE_VO_BIT + enable_vo_bit = true; #endif - if (enable_global_alloc_bit || selector.tag == TAG_MARK_COMPACT) { + 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*) (ALLOC_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); @@ -293,7 +293,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(ALLOC_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); @@ -329,10 +329,10 @@ void MMTkBarrierSetC2::expand_allocate(PhaseMacroExpand* x, Node *new_meta_val = new OrINode(meta_val, set_bit); x->transform_later(new_meta_val); - Node *set_alloc_bit = new StoreBNode(fast_oop_ctrl, fast_oop_rawmem, meta_addr_p, TypeRawPtr::BOTTOM, new_meta_val, MemNode::unordered); - x->transform_later(set_alloc_bit); + Node *set_vo_bit = new StoreBNode(fast_oop_ctrl, fast_oop_rawmem, meta_addr_p, TypeRawPtr::BOTTOM, new_meta_val, MemNode::unordered); + x->transform_later(set_vo_bit); - fast_oop_rawmem = set_alloc_bit; + fast_oop_rawmem = set_vo_bit; } InitializeNode* init = alloc->initialization();