Skip to content

Commit 72f9990

Browse files
authored
Fix C1 code generation for alloc bit (#113)
1 parent 09f6d98 commit 72f9990

File tree

2 files changed

+32
-35
lines changed

2 files changed

+32
-35
lines changed

.github/scripts/ci-test-global-alloc-bit.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,46 @@ make CONF=linux-x86_64-normal-server-$DEBUG_LEVEL THIRD_PARTY_HEAP=$PWD/../../op
1919
# --- SemiSpace ---
2020
export MMTK_PLAN=SemiSpace
2121

22-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
23-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
24-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
22+
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
23+
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
24+
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
2525

2626

2727
# --- Immix ---
2828
export MMTK_PLAN=Immix
2929

30-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
31-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
32-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
30+
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
31+
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
32+
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
3333

3434
# --- GenImmix ---
3535
export MMTK_PLAN=GenImmix
3636

37-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
38-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
39-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
37+
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
38+
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
39+
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
4040

4141

4242
# --- GenCopy ---
4343
export MMTK_PLAN=GenCopy
4444

45-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
46-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
47-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
45+
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
46+
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
47+
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
4848

4949
# --- NoGC ---
5050

5151
export MMTK_PLAN=NoGC
5252

53-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms1G -Xmx1G -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
54-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms1G -Xmx1G -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
55-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms1G -Xmx1G -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
53+
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 antlr
54+
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 fop
55+
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 luindex
5656

5757

5858
# --- MarkSweep ---
5959
export MMTK_PLAN=MarkSweep
6060

61-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar antlr
62-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar fop
63-
build/linux-x86_64-normal-server-$DEBUG_LEVEL/jdk/bin/java -XX:+UseThirdPartyHeap -server -XX:MetaspaceSize=100M -Xms500M -Xmx500M -XX:-TieredCompilation -Xcomp -jar benchmarks/dacapo-2006-10-MR2.jar luindex
61+
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
62+
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
63+
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
6464

openjdk/mmtkBarrierSetAssembler_x86.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,35 +112,32 @@ void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register threa
112112
__ movptr(cursor, end);
113113

114114
#ifdef MMTK_ENABLE_GLOBAL_ALLOC_BIT
115-
Register tmp3 = rscratch2;
115+
Register tmp3 = rdi;
116116
Register tmp2 = rscratch1;
117-
Register tmp4 = t1;
118-
assert_different_registers(obj, tmp2, tmp3, tmp4, rcx);
117+
assert_different_registers(obj, tmp2, tmp3, rcx);
119118

120119
// tmp2 = load-byte (SIDE_METADATA_BASE_ADDRESS + (obj >> 6));
121120
__ movptr(tmp3, obj);
122121
__ shrptr(tmp3, 6);
123122
__ movptr(tmp2, ALLOC_BIT_BASE_ADDRESS);
124123
__ movb(tmp2, Address(tmp2, tmp3));
125124
// tmp3 = 1 << ((obj >> 3) & 7)
126-
// 1. tmp4 = (obj >> 3) & 7
127-
__ movptr(tmp4, obj);
128-
__ shrptr(tmp4, 3);
129-
__ andptr(tmp4, 7);
130-
// 2. tmp4 = 1 << tmp4
131-
__ movptr(tmp3, rcx);
132-
__ movl(rcx, tmp4);
133-
__ movptr(tmp4, 1);
134-
__ shlptr(tmp4);
135-
__ movptr(rcx, tmp3);
136-
// tmp2 = tmp2 | tmp4
137-
__ orptr(tmp2, tmp4);
125+
// 1. rcx = (obj >> 3) & 7
126+
__ movptr(rcx, obj);
127+
__ shrptr(rcx, 3);
128+
__ andptr(rcx, 7);
129+
// 2. tmp3 = 1 << rcx
130+
__ movptr(tmp3, 1);
131+
__ shlptr(tmp3);
132+
// tmp2 = tmp2 | tmp3
133+
__ orptr(tmp2, tmp3);
138134

139135
// store-byte tmp2 (SIDE_METADATA_BASE_ADDRESS + (obj >> 6))
140136
__ movptr(tmp3, obj);
141137
__ shrptr(tmp3, 6);
142-
__ movptr(tmp4, ALLOC_BIT_BASE_ADDRESS);
143-
__ movb(Address(tmp4, tmp3), tmp2);
138+
__ movptr(rcx, ALLOC_BIT_BASE_ADDRESS);
139+
__ movb(Address(rcx, tmp3), tmp2);
140+
144141
#endif
145142

146143
// BarrierSetAssembler::incr_allocated_bytes

0 commit comments

Comments
 (0)