RFR: 8261137: Optimization of Box nodes in uncommon_trap [v7]

Wang Huang whuang at openjdk.java.net
Fri Mar 19 02:15:05 UTC 2021


On Wed, 17 Mar 2021 14:14:50 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Wang Huang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   refactor some codes
>
> src/hotspot/share/opto/callGenerator.cpp line 673:
> 
>> 671:   if (is_pure_call()) {
>> 672:     if (is_boxing_call() && callprojs.resproj != nullptr) {
>> 673:         replace_box_to_scalar(call, callprojs.resproj);
> 
> I suggest to split it into 2 parts: 
>   * `bool has_non_debug_usages(Node* n)` check which ensures there are only debug usages present
>   *  `scalarize_debug_usages(...)` which iterates over all usages assuming they are debug and scalarizes them.
> 
> After that you can just keep `result_not_used` as is. After all debug usages are gone, the call becomes clearly not used. And IMO `result_not_used` communicates the intention better than `call_can_eliminate`.

Sure, I refact these codes.

> src/hotspot/share/opto/callGenerator.cpp line 803:
> 
>> 801:  public:
>> 802:   LateInlineBoxingCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
>> 803:     LateInlineCallGenerator(method, inline_cg, /*is_pure=*/true, /*is_boxing*/true) {}
> 
> You can replace `_is_boxing_call` with `is_boxing_late_inline()`. I find it clearer.
> 
> src/hotspot/share/opto/callGenerator.cpp
> @@ -813,6 +795,8 @@ class LateInlineBoxingCallGenerator : public LateInlineCallGenerator {
>      return new_jvms;
>    }
>  
> +  virtual bool is_boxing_late_inline() const { return true; }
> +
>    virtual CallGenerator* with_call_node(CallNode* call) {
>      LateInlineBoxingCallGenerator* cg = new LateInlineBoxingCallGenerator(method(), _inline_cg);
>      cg->set_call_node(call->as_CallStaticJava());
> 
> src/hotspot/share/opto/callGenerator.hpp
> @@ -75,6 +75,7 @@ class CallGenerator : public ResourceObj {
>    virtual bool      is_late_inline() const         { return false; }
>    // same but for method handle calls
>    virtual bool      is_mh_late_inline() const      { return false; }
> +  virtual bool      is_boxing_late_inline() const  { return false; }
>    virtual bool      is_string_late_inline() const  { return false; }
>    virtual bool      is_virtual_late_inline() const { return false; }

Thank you for your review. I fix it in my patch.

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

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


More information about the hotspot-compiler-dev mailing list