Skip to content

Commit 928ce42

Browse files
wksmmtkgc-bot
andauthored
Add option to put forwarding bits on the side (mmtk#277)
Added a feature to force using on-the-side forwarding bits. This is for testing mmtk-core. The CI script for minimal test is also extended to run several plans involving CopySpace and ImmixSpace on OpenJDK with side forwarding bits. Related PR: mmtk/mmtk-core#1138 The feature introduced in this PR can be used to check the correctness of that PR. --------- Co-authored-by: mmtkgc-bot <mmtkgc.bot@gmail.com>
1 parent 9360c18 commit 928ce42

File tree

8 files changed

+106
-27
lines changed

8 files changed

+106
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
set -xe
2+
3+
. $(dirname "$0")/common.sh
4+
5+
unset JAVA_TOOL_OPTIONS
6+
7+
run_subset() {
8+
heap_multiplier=$1
9+
10+
runbms_dacapo2006_with_heap_multiplier antlr $heap_multiplier
11+
runbms_dacapo2006_with_heap_multiplier fop $heap_multiplier
12+
runbms_dacapo2006_with_heap_multiplier luindex $heap_multiplier
13+
runbms_dacapo2006_with_heap_multiplier lusearch $heap_multiplier
14+
}
15+
16+
# Run plans that involve CopySpace and ImmixSpace which use forwarding bits.
17+
MMTK_PLAN=SemiSpace run_subset 4
18+
MMTK_PLAN=Immix run_subset 4
19+
MMTK_PLAN=GenCopy run_subset 4
20+
MMTK_PLAN=GenImmix run_subset 4
21+
MMTK_PLAN=StickyImmix run_subset 4

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

+9
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ MMTK_PLAN=GenImmix runbms_dacapo2006_with_heap_multiplier fop 4 -XX:-UseCompress
3434
MMTK_VO_BIT=1 $cur/ci-build.sh
3535
# Test
3636
MMTK_PLAN=GenImmix runbms_dacapo2006_with_heap_multiplier fop 4
37+
38+
# Build with on-the-side forwarding bits
39+
MMTK_FORWARDING_ON_SIDE=1 $cur/ci-build.sh
40+
# Test
41+
MMTK_PLAN=SemiSpace runbms_dacapo2006_with_heap_multiplier lusearch 4
42+
MMTK_PLAN=Immix runbms_dacapo2006_with_heap_multiplier lusearch 4
43+
MMTK_PLAN=GenCopy runbms_dacapo2006_with_heap_multiplier lusearch 4
44+
MMTK_PLAN=GenImmix runbms_dacapo2006_with_heap_multiplier lusearch 4
45+
MMTK_PLAN=StickyImmix runbms_dacapo2006_with_heap_multiplier lusearch 4

.github/workflows/run-dacapo-2006.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ jobs:
8989
strategy:
9090
fail-fast: false
9191
matrix:
92-
test-script: ["ci-test-vo-bit", "ci-test-assertions", "ci-test-malloc-mark-sweep", "ci-test-mark-in-header"]
92+
test-script:
93+
- ci-test-vo-bit
94+
- ci-test-assertions
95+
- ci-test-malloc-mark-sweep
96+
- ci-test-mark-in-header
97+
- ci-test-forwarding-on-side
9398
include:
9499
- test-script: ci-test-vo-bit
95100
build-suffix: MMTK_VO_BIT=1
@@ -99,6 +104,8 @@ jobs:
99104
build-suffix: MMTK_MALLOC_MARK_SWEEP=1_MMTK_EXTREME_ASSERTIONS=1
100105
- test-script: ci-test-mark-in-header
101106
build-suffix: MMTK_MALLOC_MARK_SWEEP=1_MMTK_MARK_IN_HEADER=1
107+
- test-script: ci-test-forwarding-on-side
108+
build-suffix: MMTK_FORWARDING_ON_SIDE=1
102109
steps:
103110
- name: Checkout MMTk OpenJDK binding
104111
uses: actions/checkout@v4

.github/workflows/test-pr.yml

+7
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,20 @@ jobs:
4848
build-env-var: MMTK_MALLOC_MARK_SWEEP=1 MMTK_MARK_IN_HEADER=1
4949
debug-level: fastdebug
5050

51+
build-forwarding-on-side:
52+
uses: ./.github/workflows/build.yml
53+
with:
54+
build-env-var: MMTK_FORWARDING_ON_SIDE=1
55+
debug-level: fastdebug
56+
5157
run-dacapo-2006:
5258
needs:
5359
- build-normal-fastdebug
5460
- build-vo-bit
5561
- build-extreme-assertions
5662
- build-malloc-mark-sweep
5763
- build-mark-in-header
64+
- build-forwarding-on-side
5865
uses: ./.github/workflows/run-dacapo-2006.yml
5966

6067
run-dacapo-chopin:

mmtk/Cargo.lock

+12-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mmtk/Cargo.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ lazy_static = "1.1"
2626
once_cell = "1.10.0"
2727
atomic = "0.6.0"
2828
memoffset = "0.9.0"
29+
cfg-if = "1.0"
30+
2931
# Be very careful to commit any changes to the following mmtk dependency, as our CI scripts (including mmtk-core CI)
3032
# rely on matching these lines to modify them: e.g. comment out the git dependency and use the local path.
3133
# These changes are safe:
3234
# - change branch
3335
# - change repo name
3436
# But other changes including adding/removing whitespaces in commented lines may break the CI.
35-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "56b2521d2b99848ee0613a0a5288fe6d81b754ba" }
37+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "a9b619a4ee18a4f83209f930f8c48a3b63ee478c" }
3638
# Uncomment the following to build locally
3739
# mmtk = { path = "../repos/mmtk-core" }
3840

@@ -48,9 +50,12 @@ nogc_no_zeroing = ["mmtk/nogc_no_zeroing"]
4850
# See README.
4951
vo_bit = ["mmtk/vo_bit"]
5052

51-
# This compile time constant places the mark bit in the header of the object instead of on the side.
53+
# Place the mark bit in the header of objects instead of on the side.
5254
mark_bit_in_header = []
5355

56+
# Place the forwarding bits on the side instead of in the header of objects.
57+
forwarding_bits_on_side = []
58+
5459
# Use malloc mark sweep - we should only run marksweep with this feature turned on.
5560
malloc_mark_sweep = ["mmtk/malloc_mark_sweep"]
5661

mmtk/src/vm_metadata/constants.rs

+34-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use mmtk::vm::*;
1+
use mmtk::{util::metadata::MetadataSpec, vm::*};
22

33
#[cfg(target_pointer_width = "64")]
4+
#[allow(unused)]
45
pub(crate) const FORWARDING_BITS_OFFSET: isize = 56;
56
#[cfg(target_pointer_width = "32")]
7+
#[allow(unused)]
68
pub(crate) const FORWARDING_BITS_OFFSET: isize = unimplemented!();
79

810
pub(crate) const FORWARDING_POINTER_OFFSET: isize = 0;
@@ -22,20 +24,39 @@ pub(crate) const LOGGING_SIDE_METADATA_SPEC: VMGlobalLogBitSpec = VMGlobalLogBit
2224
pub(crate) const FORWARDING_POINTER_METADATA_SPEC: VMLocalForwardingPointerSpec =
2325
VMLocalForwardingPointerSpec::in_header(FORWARDING_POINTER_OFFSET);
2426

25-
/// PolicySpecific object forwarding status metadata spec
26-
/// 2 bits per object
27-
pub(crate) const FORWARDING_BITS_METADATA_SPEC: VMLocalForwardingBitsSpec =
28-
VMLocalForwardingBitsSpec::in_header(FORWARDING_BITS_OFFSET);
27+
cfg_if::cfg_if! {
28+
if #[cfg(feature = "mark_bit_in_header")] {
29+
/// PolicySpecific mark bit metadata spec
30+
/// 1 bit per object
31+
pub(crate) const MARKING_METADATA_SPEC: VMLocalMarkBitSpec =
32+
VMLocalMarkBitSpec::in_header(FORWARDING_BITS_OFFSET);
2933

30-
/// PolicySpecific mark bit metadata spec
31-
/// 1 bit per object
32-
#[cfg(feature = "mark_bit_in_header")]
33-
pub(crate) const MARKING_METADATA_SPEC: VMLocalMarkBitSpec =
34-
VMLocalMarkBitSpec::in_header(FORWARDING_BITS_OFFSET);
34+
#[allow(unused)]
35+
const LAST_SIDE_SPEC_BEFORE_MARK: &MetadataSpec = LOS_METADATA_SPEC.as_spec();
36+
} else {
37+
/// PolicySpecific mark bit metadata spec
38+
/// 1 bit per object
39+
pub(crate) const MARKING_METADATA_SPEC: VMLocalMarkBitSpec =
40+
VMLocalMarkBitSpec::side_after(LOS_METADATA_SPEC.as_spec());
41+
42+
#[allow(unused)]
43+
const LAST_SIDE_SPEC_BEFORE_MARK: &MetadataSpec = MARKING_METADATA_SPEC.as_spec();
44+
}
45+
}
3546

36-
#[cfg(not(feature = "mark_bit_in_header"))]
37-
pub(crate) const MARKING_METADATA_SPEC: VMLocalMarkBitSpec =
38-
VMLocalMarkBitSpec::side_after(LOS_METADATA_SPEC.as_spec());
47+
cfg_if::cfg_if! {
48+
if #[cfg(feature = "forwarding_bits_on_side")] {
49+
/// PolicySpecific object forwarding status metadata spec
50+
/// 2 bits per object
51+
pub(crate) const FORWARDING_BITS_METADATA_SPEC: VMLocalForwardingBitsSpec =
52+
VMLocalForwardingBitsSpec::side_after(LAST_SIDE_SPEC_BEFORE_MARK);
53+
} else {
54+
/// PolicySpecific object forwarding status metadata spec
55+
/// 2 bits per object
56+
pub(crate) const FORWARDING_BITS_METADATA_SPEC: VMLocalForwardingBitsSpec =
57+
VMLocalForwardingBitsSpec::in_header(FORWARDING_BITS_OFFSET);
58+
}
59+
}
3960

4061
/// PolicySpecific mark-and-nursery bits metadata spec
4162
/// 2-bits per object

openjdk/CompileThirdPartyHeap.gmk

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ ifeq ($(MMTK_MARK_IN_HEADER), 1)
3535
endif
3636
endif
3737

38+
ifeq ($(MMTK_FORWARDING_ON_SIDE), 1)
39+
ifndef GC_FEATURES
40+
GC_FEATURES=--features forwarding_bits_on_side
41+
else
42+
GC_FEATURES:=$(strip $(GC_FEATURES))",forwarding_bits_on_side"
43+
endif
44+
endif
45+
3846
ifeq ($(MMTK_EXTREME_ASSERTIONS), 1)
3947
ifndef GC_FEATURES
4048
GC_FEATURES=--features mmtk_extreme_assertions

0 commit comments

Comments
 (0)