RFR: 8259619: C1: 3-arg StubAssembler::call_RT stack-use condition is incorrect [v2]

Aleksey Shipilev shade at openjdk.java.net
Tue Jan 12 12:47:11 UTC 2021


> SonarCould instance reports this code smell in c1_Runtime_x86.cpp: Identical sub-expressions on both sides of operator "||"
> 
> int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
> #ifdef _LP64
>   // if there is any conflict use the stack
>   if (arg1 == c_rarg2 || arg1 == c_rarg3 ||
>       arg2 == c_rarg1 || arg1 == c_rarg3 ||
>       arg3 == c_rarg1 || arg1 == c_rarg2) { <---- HERE
>     push(arg3);
>     push(arg2);
>     push(arg1);
>     pop(c_rarg1);
>     pop(c_rarg2);
>     pop(c_rarg3);
>   } else {
>     mov(c_rarg1, arg1);
>     mov(c_rarg2, arg2);
>     mov(c_rarg3, arg3);
>   }
> 
> It seems obvious that the right column in the condition should have been `arg1`, `arg2`, `arg3`.
> 
> Additional testing:
>  - [x] Linux x86_64 `tier1`

Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:

  Also fix AArch64

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2048/files
  - new: https://git.openjdk.java.net/jdk/pull/2048/files/699a3e29..443eb85f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2048&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2048&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2048.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2048/head:pull/2048

PR: https://git.openjdk.java.net/jdk/pull/2048


More information about the hotspot-compiler-dev mailing list