小编Pet*_*hty的帖子

是什么导致一个方法被热点编译器归类为"'不可编译(禁用)"?

在对应用程序进行一些更改之后,它遭受了显着的性能下降,并且在调查中,最常调用的方法之一不再被编译.启用:-XX:+LogCompilation显示在更改之前,此方法是:排队进行编译,编译,然后成功内联到调用者; 而在更改之后,没有编译尝试的记录,并且内联尝试说:

inline_fail reason ='not compilable(disabled)'

原始方法如下,其中_maxRepeats一个实例变量声明为a Map(没有泛型,很久以前编写的代码),使用的是键是类的对象,DadNode值是a Integer.

  private int cnsGetMaxRepeats(DadNode dn) {
    if (_maxRepeats != null) {
      Integer max = (Integer)_maxRepeats.get(dn);
      if (max != null) {
        return max;
      }
    }
    return dn.getMaxOccurs().getValue();
  }
Run Code Online (Sandbox Code Playgroud)

修正案涉及将_maxRepeats地图更改为使用泛型:

  Map<Integer, Integer>
Run Code Online (Sandbox Code Playgroud)

并在方法中添加了一个新参数:

   private int cnsGetMaxRepeats(int childIdx, DadNode dn) {
    if (_maxRepeats != null) {
      Integer max = _maxRepeats.get(childIdx);
      if (max != null) {
        return max;
      }
    }
    return dn.getMaxOccurs().getValue();
  }
Run Code Online (Sandbox Code Playgroud)

使用显式调用Integer.valueOf和 …

java jvm-hotspot

10
推荐指数
1
解决办法
102
查看次数

标签 统计

java ×1

jvm-hotspot ×1