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?

Sean Mickey
  • 7,618
  • 2
  • 32
  • 58
  • It may be marked un-complilable for reasons unrelated to the code itself. For example, have you tried increasing code cache size? `-XX:ReservedCodeCacheSize` – Gene Jun 29 '17 at 01:16
  • 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? – Sean Mickey Jun 29 '17 at 01:38
  • what version are you using? `LogCompilation` is `PrintCompilation` for a long time... – Eugene Jul 01 '17 at 11:54

1 Answers1

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.