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

Pet*_*hty 10 java jvm-hotspot

在对应用程序进行一些更改之后,它遭受了显着的性能下降,并且在调查中,最常调用的方法之一不再被编译.启用:-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.valueOfInteger.intValue避免自动装箱没有任何区别; 该方法仍然无法编译.

我可以"用棍子戳它",直到我得到一个能满足我想要的解决方案(并且也可以编译),但这种禁用背后的标准是什么?

Pet*_*hty 2

我认为我犯了一个基本错误 - 通过 IntelliJ 运行调试时生成了带有“禁用编译”方法的日志(尽管断点已静音)。我希望 IntelliJ 禁用带有断点的方法的编译,即使在静音时也是如此。

因此,为了回答我自己的问题,我没有理由认为除了显式禁用编译之外的任何操作都会这样做。