title: Why there is no infrastrucutre for hinting JIT compiler in JVM?
body: <p>I was reviewing one conference presentation that touched JIT inlining semantics where author pinned down weird behavior (weird only for first look, of course) - C2 was slower than C1 because it couldn't inline method due to excessive inlining depth. It may be represented in following example:</p>
  
  <pre><code>public static int multipleByTwo(int x) {
      return x * 2;
  }
  
  public static void entrypoint() {
      int sum = 0;
      for (int i = 0; i &lt; 10_000_000; i++) {
          // due to some arbitrary cause, multiplyByTwo doesn't get inlined
          sum += multiplyByTwo(i);
      }
  }
  </code></pre>
  
  <p>As a programmer, i may know there is a field for optimization that compiler doesn't know about. E.g. there is plenty of optimization possible if <code>multiplyByTwo</code> would be forcibly inlined, but due to various constraints (e.g. method size or inlining depth) it may be omitted from inlining. Why there is no way to tell the compiler "hey, i'm pretty sure you should prefer inlining that method rather not"? I'm sure i'm not the first one to think about this and there was discussion that resulted in not implementing such feature - why?</p>
  
  <p>p.s. please note that i'm talking about hints rather than directives; i do understand that latter choice would result in more harm than benefit.</p>