RFR: 8278141: LIR_OpLoadKlass::_info shadows the field of the same name from LIR_Op

Aleksey Shipilev shade at openjdk.java.net
Fri Dec 3 15:46:19 UTC 2021


On Thu, 2 Dec 2021 12:31:41 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> SonarCloud complains about code added in [JDK-8277417](https://bugs.openjdk.java.net/browse/JDK-8277417):
>  Field "_info" shadows a field of the same name in base class "LIR_Op"
> 
> 
> class LIR_OpLoadKlass: public LIR_Op {
>   friend class LIR_OpVisitState;
> 
>  private:
>   LIR_Opr _obj;
>   CodeEmitInfo* _info; <--- here
> 
> 
> From the look of it, it seems risky to have two inconsistent fields here. Depending on which base class we use to access it, we might have different `_info`-s referenced. @rkennke, that was not intentional, was it? I don't see the mentions of this oddity in the original PR.
> 
> The fix is to push `CodeEmitInfo` to super-class `LIR_Op`, and use it from there.
> 
> Additional testing:
>  - [x] Linux x86_64 fastdebug `tier1`
>  - [x] Linux x86_64 fastdebug `tier2`

Thanks!

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

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


More information about the hotspot-compiler-dev mailing list