annotate test/compiler/8015436/Test8015436.java @ 10377:fe00365c8f31

8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds Summary: The InstanceKlass _initial_method_idnum value must be adjusted if overpass methods are added. Reviewed-by: twisti, kvn Contributed-by: serguei.spitsyn@oracle.com
author sspitsyn
date Thu, 30 May 2013 11:46:39 -0700
parents
children 2f004f9dc9e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10377
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
1 /*
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
4 *
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
7 * published by the Free Software Foundation.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
8 *
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
13 * accompanied this code).
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
14 *
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
18 *
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
21 * questions.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
22 */
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
23
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
24 /*
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
25 * @test
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
26 * @bug 8015436
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
27 * @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
28 * @run main Test8015436
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
29 *
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
30 */
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
31
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
32 /*
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
33 * The test checks that a MemberName for the defaultMethod() is cached in
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
34 * the class MemberNameTable without a crash in the VM fastdebug mode.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
35 * The original issue was that the InstanceKlass _initial_method_idnum was
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
36 * not adjusted properly when the overpass methods are added to the class.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
37 * The expected/correct behavior: The test does not crash nor throw any exceptions.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
38 * All the invocations of the defaultMethod() must be completed successfully.
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
39 */
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
40
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
41 import java.lang.invoke.*;
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
42
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
43 interface InterfaceWithDefaultMethod {
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
44 public void someMethod();
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
45
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
46 default public void defaultMethod(String str){
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
47 System.out.println("defaultMethod() " + str);
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
48 }
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
49 }
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
50
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
51 class Test8015436 implements InterfaceWithDefaultMethod {
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
52 @Override
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
53 public void someMethod() {
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
54 System.out.println("someMethod() invoked");
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
55 }
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
56
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
57 public static void main(String[] args) throws Throwable {
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
58 Test8015436 testObj = new Test8015436();
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
59 testObj.someMethod();
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
60 testObj.defaultMethod("invoked directly");
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
61
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
62 MethodHandles.Lookup lookup = MethodHandles.lookup();
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
63 MethodType mt = MethodType.methodType(void.class, String.class);
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
64 MethodHandle mh = lookup.findVirtual(Test8015436.class, "defaultMethod", mt);
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
65 mh.invokeExact(testObj, "invoked via a MethodHandle");
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
66 }
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
67 }
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
68
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
69 /*
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
70 * A successful execution gives the output:
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
71 * someMethod() invoked
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
72 * defaultMethod() invoked directly
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
73 * defaultMethod() invoked via a MethodHandle
fe00365c8f31 8015436: compiler/ciReplay/TestSA.sh fails with assert() index is out of bounds
sspitsyn
parents:
diff changeset
74 */