1 /*
2  * Copyright (C) 2017 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.reflect.Constructor;
18 import java.lang.reflect.Executable;
19 import java.lang.reflect.Field;
20 import java.lang.reflect.Method;
21 import java.lang.reflect.Modifier;
22 
23 import java.time.Duration;
24 
25 import java.util.concurrent.*;
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.List;
29 import java.util.Optional;
30 import java.util.Random;
31 import java.util.Stack;
32 import java.util.Vector;
33 
34 import java.util.function.Supplier;
35 
36 import art.*;
37 
38 public class Main extends Test1953 {
Main(boolean run_class_load_tests)39   public Main(boolean run_class_load_tests) {
40     super(run_class_load_tests, (testObj) -> {
41       try {
42         // Make sure everything is jitted in the method. We do this before calling setup since the
43         // suspend setup might make it impossible to jit the methods (by setting breakpoints or
44         // something).
45         for (Method m : testObj.getClass().getMethods()) {
46           if ((m.getModifiers() & Modifier.NATIVE) == 0 &&
47               !m.getName().startsWith("$noprecompile$")) {
48             ensureMethodJitCompiled(m);
49           }
50         }
51       } catch (Exception e) {}
52     });
53   }
54 
main(String[] args)55   public static void main(String[] args) throws Exception {
56     new Main(!Arrays.asList(args).contains("DISABLE_CLASS_LOAD_TESTS")).runTests();
57   }
58 
ensureMethodJitCompiled(Method meth)59   public static native void ensureMethodJitCompiled(Method meth);
60 }
61