Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes a method to be classed as "'not compilable (disabled)" by the hotspot compiler?

After making some changes to an application it suffered a significant performance degradation and on investigation one of the most frequently called methods is no longer being compiled. Turning on: -XX:+LogCompilation shows that before the change, this method was: queued for compilation, compiled, and then successfully inlined into callers; whereas after the change, there is no record of a compilation attempt and the inlining attempt says:

inline_fail reason='not compilable (disabled)'

The original method is as follows, where _maxRepeats is an instance variable declared as a Map (no generics, code written a long time ago), used such that the key was an object of class DadNode and the value was an Integer.

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

The amendment involved changing the _maxRepeats map to use generics:

  Map<Integer, Integer>

and a new parameter was added to the method:

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

Using explicit calls to Integer.valueOf and Integer.intValue to avoid autoboxing make no difference; the method is still not compilable.

I can "poke it with a stick" until I get a solution which does what I want (and is also compilable), but what are the criteria behind this disabling?

like image 444
Pete Geraghty Avatar asked Jun 29 '17 00:06

Pete Geraghty


1 Answers

I think a basic mistake on my part - the log with the "compilation disabled" method was produced when running debug through IntelliJ (although with breakpoints muted). I expect IntelliJ disables compilations for methods with breakpoints in, even when muted.

So to answer my own question, I have no reason to think that anything apart from explicitly disabling compilation will do so.

like image 136
Pete Geraghty Avatar answered Nov 16 '22 08:11

Pete Geraghty