blob: c8780de6dc2b986a080092b7e78212c123e9c137 [file] [log] [blame]
Sebastien Hertz270a0e12015-01-16 19:49:09 +01001/*
2 * Copyright (C) 2015 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
17import java.lang.reflect.Method;
18
19public class Main {
20 private static final int EXPECTED_RESULT = 100;
21 private static final int PARAMETER_VALUE = 0;
22
23 public static void main(String[] args) throws Throwable {
24 testCatchHandlerOnEntryWithoutMoveException();
25 }
26
27 /**
28 * Tests we correctly execute a method starting with a catch handler without
29 * move-exception instruction when throwing an exception during deoptimization.
30 */
31 private static void testCatchHandlerOnEntryWithoutMoveException() throws Throwable {
32 Class<?> c = Class.forName("CatchHandlerOnEntry");
33 Method m = c.getMethod("catchHandlerOnEntry", int.class);
34 Object result = m.invoke(null, new Object[]{PARAMETER_VALUE});
35 int intResult = ((Integer) result).intValue();
36 if (intResult == EXPECTED_RESULT) {
37 System.out.println("CatchHandlerOnEntryWithoutMoveException OK");
38 } else {
39 System.out.println("CatchHandlerOnEntryWithoutMoveException KO: result==" + intResult);
40 }
41 }
42}
43