Home | History | Annotate | Download | only in 138-invoke-polymorphic-again
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 import java.lang.invoke.MethodHandle;
     18 import java.lang.invoke.MethodHandles;
     19 import java.lang.invoke.MethodHandles.Lookup;
     20 import java.lang.invoke.MethodType;
     21 
     22 public class Main {
     23   public static void assertEquals(int i1, int i2) {
     24   }
     25 
     26   public int foof(int a, int b, int c, int d,
     27                   int e, int f, int g, int h,
     28                   int i, int j, int k, int l,
     29                   int m, int n, int o) {
     30     return a;
     31   }
     32 
     33   public static void $opt$BasicTest() throws Throwable {
     34     Main m = null;
     35     // OTH: >= 15 arguments to invokeExact tickles this bug. Fewer, no repro.
     36     assertEquals(42, -42);
     37     m.foof(0, 1, 2, 3,
     38            4, 5, 6, 7,
     39            8, 9, 10, 11,
     40            12, 13, 14);
     41     MethodHandle mh0 = null;
     42     mh0.invokeExact("bad");
     43   }
     44 
     45   public static int $opt$BasicTest2() throws Throwable {
     46     Main m = null;
     47     // OTH: >= 15 arguments to invokeExact tickles this bug. Fewer, no repro.
     48     assertEquals(42, -42);
     49     m.foof(0, 1, 2, 3,
     50            4, 5, 6, 7,
     51            8, 9, 10, 11,
     52            12, 13, 14);
     53     MethodHandle mh0 = null;
     54     return (int) mh0.invokeExact("bad");
     55   }
     56 
     57   public static void main(String[] args) throws Throwable {
     58     $opt$BasicTest();
     59   }
     60 }
     61