[12] RFR 8206895: aarch64: rework error-prone cmp instruction

Andrew Haley aph at redhat.com
Wed Jul 11 15:48:04 UTC 2018


On 07/11/2018 04:42 PM, Boris Ulasevich wrote:
> Please review the following patch:
> http://cr.openjdk.java.net/~bulasevich/8206895/webrev.02
> https://bugs.openjdk.java.net/browse/JDK-8206895
> 
> cmp instruction overloading introduced to force user to specify 
> immediate value type implicitly. The only allowed type is unsigned char. 

But how does this solve the problem?  Won't the C++ compiler silently
truncate cmp(reg, int) to a uint8 ?

> For immediate values outside of byte range subs macro should be called 
> directly.
> 
> cmp calls all over the codes was fixed accordingly to the following plan:
>    cmp(reg, imm8)  -> cmp(reg, (u1)imm8)
>    cmp(reg, imm12) -> subs(zr, reg, imm12)
>    cmp(reg, imm64) -> subs(scratch, reg, imm64)
> 
> The change was tested with jtreg tests.

This hunk looks wrong:

@@ -1129,7 +1129,7 @@

   if (super_check_offset.is_register()) {
     br(Assembler::EQ, *L_success);
-    cmp(super_check_offset.as_register(), sc_offset);
+    subs(zr, super_check_offset.as_register(), sc_offset);

cmp with register is still allowed.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the hotspot-dev mailing list