Thu, 17 Nov 2016 16:06:56 +0000
8158639: C2 compilation fails with SIGSEGV
Summary: fixed the jvms for callsite traps based on declared signature.
Reviewed-by: jcm, coleenp, vlivanov
vlivanov@7287 | 1 | /* |
vlivanov@7287 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
vlivanov@7287 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
vlivanov@7287 | 4 | * |
vlivanov@7287 | 5 | * This code is free software; you can redistribute it and/or modify it |
vlivanov@7287 | 6 | * under the terms of the GNU General Public License version 2 only, as |
vlivanov@7287 | 7 | * published by the Free Software Foundation. |
vlivanov@7287 | 8 | * |
vlivanov@7287 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
vlivanov@7287 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
vlivanov@7287 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
vlivanov@7287 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
vlivanov@7287 | 13 | * accompanied this code). |
vlivanov@7287 | 14 | * |
vlivanov@7287 | 15 | * You should have received a copy of the GNU General Public License version |
vlivanov@7287 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
vlivanov@7287 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
vlivanov@7287 | 18 | * |
vlivanov@7287 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
vlivanov@7287 | 20 | * or visit www.oracle.com if you need additional information or have any |
vlivanov@7287 | 21 | * questions. |
vlivanov@7287 | 22 | */ |
vlivanov@7287 | 23 | |
vlivanov@7287 | 24 | /** |
vlivanov@7287 | 25 | * @test |
dbuck@8651 | 26 | * @bug 8059556 8158639 |
dbuck@8651 | 27 | * |
vlivanov@7287 | 28 | * @run main/othervm -Xbatch NullConstantReceiver |
dbuck@8651 | 29 | * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::run NullConstantReceiver |
vlivanov@7287 | 30 | */ |
vlivanov@7287 | 31 | |
vlivanov@7287 | 32 | import java.lang.invoke.MethodHandle; |
vlivanov@7287 | 33 | import java.lang.invoke.MethodHandles; |
vlivanov@7287 | 34 | import java.lang.invoke.MethodType; |
vlivanov@7287 | 35 | |
vlivanov@7287 | 36 | public class NullConstantReceiver { |
vlivanov@7287 | 37 | static final MethodHandle target; |
vlivanov@7287 | 38 | static { |
vlivanov@7287 | 39 | try { |
vlivanov@7287 | 40 | target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class)); |
vlivanov@7287 | 41 | } catch (ReflectiveOperationException e) { |
vlivanov@7287 | 42 | throw new Error(e); |
vlivanov@7287 | 43 | } |
vlivanov@7287 | 44 | } |
vlivanov@7287 | 45 | |
vlivanov@7287 | 46 | public void test() {} |
vlivanov@7287 | 47 | |
vlivanov@7287 | 48 | static void run() throws Throwable { |
vlivanov@7287 | 49 | target.invokeExact((NullConstantReceiver) null); |
vlivanov@7287 | 50 | } |
vlivanov@7287 | 51 | |
vlivanov@7287 | 52 | public static void main(String[] args) throws Throwable { |
vlivanov@7287 | 53 | for (int i = 0; i<15000; i++) { |
vlivanov@7287 | 54 | try { |
vlivanov@7287 | 55 | run(); |
vlivanov@7287 | 56 | } catch (NullPointerException e) { |
vlivanov@7287 | 57 | // expected |
vlivanov@7287 | 58 | continue; |
vlivanov@7287 | 59 | } |
vlivanov@7287 | 60 | throw new AssertionError("NPE wasn't thrown"); |
vlivanov@7287 | 61 | } |
vlivanov@7287 | 62 | System.out.println("TEST PASSED"); |
vlivanov@7287 | 63 | } |
vlivanov@7287 | 64 | } |