Home | History | Annotate | Download | only in src
      1 public class Main {
      2   public Main() {
      3   }
      4 
      5   boolean doThrow = false;
      6 
      7   int $noinline$f() throws Exception {
      8     g(1);
      9     g(2);
     10 
     11     // This currently defeats inlining of `f`.
     12     if (doThrow) { throw new Error(); }
     13     return 0;
     14   }
     15 
     16   void g(int num_calls) {
     17     if (num_calls == 1) {
     18       System.out.println("1st call");
     19     } else if (num_calls == 2) {
     20       System.out.println("2nd call");
     21     }
     22     System.out.println(shlemiel());
     23   }
     24 
     25   String shlemiel() {
     26     String s0 = new String("0");
     27     String s1 = new String("1");
     28     String s2 = new String("2");
     29     String s3 = new String("3");
     30     String s4 = new String("4");
     31     String s5 = new String("5");
     32     String s6 = new String("6");
     33     String s7 = new String("7");
     34     String s8 = new String("8");
     35     String s9 = new String("9");
     36     String s10 = new String("10");
     37     String s11 = new String("11");
     38     String s12 = new String("12");
     39     String s13 = new String("13");
     40     String s14 = new String("14");
     41     String s15 = new String("15");
     42     String s16 = new String("16");
     43     String s17 = new String("17");
     44     String s18 = new String("18");
     45     String s19 = new String("19");
     46     String s20 = new String("20");
     47     String s = new String();
     48     s += s0;
     49     s += s1;
     50     s += s2;
     51     s += s3;
     52     s += s4;
     53     s += s5;
     54     s += s6;
     55     s += s7;
     56     s += s8;
     57     s += s9;
     58     s += s10;
     59     s += s11;
     60     s += s12;
     61     s += s13;
     62     s += s14;
     63     s += s15;
     64     s += s16;
     65     s += s17;
     66     s += s18;
     67     s += s19;
     68     s += s20;
     69 
     70     s += s6;
     71     s += s5;
     72     s += s2;
     73     s += s3;
     74 
     75     s10 = s + s10;
     76     s10 += s20;
     77 
     78     s20 += s10;
     79     s = s17 + s20;
     80 
     81     s4 = s18 = s19;
     82     s += s4;
     83     s += s18;
     84     stackmap(0);
     85     return s;
     86   }
     87 
     88   native int stackmap(int x);
     89 
     90   public static void main(String[] args) throws Exception {
     91     System.loadLibrary(args[0]);
     92     Main st = new Main();
     93     st.$noinline$f();
     94   }
     95 }
     96