1 /*
2  * Copyright (C) 2014 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 public class Main {
main(String[] args)18   public static void main(String[] args) {
19    $opt$TestSlowPath();
20   }
21 
$opt$TestSlowPath()22   public static void $opt$TestSlowPath() {
23     Object[] o = bar();
24     assertEquals(0, o.length);
25     // The slowpath of the instanceof requires the live register
26     // holding `o` to be saved before going into runtime. The linear
27     // scan register allocator used to miscompute the number of
28     // live registers at a safepoint, so the place at which the register
29     // was saved was wrong.
30     doCall(o instanceof Interface[], o);
31   }
32 
assertEquals(int a, int b)33   public static void assertEquals(int a, int b) {}
doCall(boolean val, Object o)34   public static boolean doCall(boolean val, Object o) { return val; }
35 
bar()36   static Object[] bar() { return new Object[0]; }
37 
38   static interface Interface {}
39 }
40