RFR: 8267531: [x86] Assembler::andb(Address, Register) encoding is incorrect
Aleksey Shipilev
shade at openjdk.java.net
Fri May 21 16:37:08 UTC 2021
On Fri, 21 May 2021 15:36:51 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> > Is it possible to add a jtreg test for this fix?
>
> I guess it is possible to minimize the fuzzer test and/or create a fully synthetic regression test. But given how it looks like a copy-paste omission in the recent patch, I would prefer to invest time somewhere else.
I tried a few things, without success. Something like:
/**
* @test
* @bug 8267531
* @summary [x86] Assembler::andb(Address,Register) encoding is incorrect
*
* @run main/othervm -XX:-TieredCompilation -XX:+PrintAssembly -XX:-UseNewCode
* -XX:CompileCommand=compileonly,compiler.c2.Test8267531::test
* compiler.c2.Test8267531
* @run main/othervm -XX:-TieredCompilation -XX:+PrintAssembly -XX:+UseNewCode
* -XX:CompileCommand=compileonly,compiler.c2.Test8267531::test
* compiler.c2.Test8267531
*/
package compiler.c2;
import java.util.Arrays;
public class Test8267531 {
static byte[] array = new byte[] { -1, -1, -1, -1, -1, -1, -1 };
static int idx = 3;
static int mask;
public static void test() {
// match(Set dst (StoreB dst (AndI (LoadB dst) src)));
array[idx] &= mask;
}
public static void main(String[] args) {
for (int i = 0; i < 1000000; i++) {
test();
if (array[4] != -1 || array[3] != 0 || array[2] != -1) {
throw new IllegalStateException("Error: " + Arrays.toString(array));
}
}
}
}
It would seem we need to get lucky that both dst-addr-idx and src regs are fitting the branch path in `Assembler::prefix`. Let's mark the bug `noreg-hard` and move on?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4145
More information about the hotspot-compiler-dev
mailing list