105b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray/*
205b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * Copyright (C) 2016 The Android Open Source Project
305b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray *
405b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License");
505b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * you may not use this file except in compliance with the License.
605b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * You may obtain a copy of the License at
705b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray *
805b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray *      http://www.apache.org/licenses/LICENSE-2.0
905b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray *
1005b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software
1105b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS,
1205b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1305b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * See the License for the specific language governing permissions and
1405b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray * limitations under the License.
1505b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray */
1605b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray
1705b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffrayimport java.lang.reflect.Method;
1805b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray
1905b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffraypublic class Main {
2005b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray  // Workaround for b/18051191.
2105b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray  class InnerClass {}
2205b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray
2305b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray  public static void main(String[] args) throws Exception {
2405b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    Class<?> c = Class.forName("IrreducibleLoop");
2505b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    // Note that we don't actually enter the loops in the 'liveness'
2605b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    // method, so this is just a sanity check that part of the code we
2705b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    // generated for that method is correct.
2805b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    Method m = c.getMethod("liveness", int.class);
2905b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    Object[] arguments = { 42 };
3005b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray    System.out.println(m.invoke(null, arguments));
3105b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray  }
3205b3fa02ed8ef62841a92cd96526ba3a06bf1f63Nicolas Geoffray}
33