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

1

10

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?

Shantel answered 29/6, 2017 at 0:30 Comment(3)
It may be marked un-complilable for reasons unrelated to the code itself. For example, have you tried increasing code cache size? -XX:ReservedCodeCacheSizeMatteson
What version of Java are you using? Is the OS 32-bit or 64-bit? Are you using the client compiler or the server compiler?Turner
what version are you using? LogCompilation is PrintCompilation for a long time...Religionism
S
2

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.

Shantel answered 29/6, 2017 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.