test/runtime/jsig/TestJNI.c

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 5453
f9ee986a9fea
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

ccheung@5420 1 /*
ccheung@5420 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
ccheung@5420 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ccheung@5420 4 *
ccheung@5420 5 * This code is free software; you can redistribute it and/or modify it
ccheung@5420 6 * under the terms of the GNU General Public License version 2 only, as
ccheung@5420 7 * published by the Free Software Foundation.
ccheung@5420 8 *
ccheung@5420 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ccheung@5420 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ccheung@5420 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ccheung@5420 12 * version 2 for more details (a copy is included in the LICENSE file that
ccheung@5420 13 * accompanied this code).
ccheung@5420 14 *
ccheung@5420 15 * You should have received a copy of the GNU General Public License version
ccheung@5420 16 * 2 along with this work; if not, write to the Free Software Foundation,
ccheung@5420 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ccheung@5420 18 *
ccheung@5420 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ccheung@5420 20 * or visit www.oracle.com if you need additional information or have any
ccheung@5420 21 * questions.
ccheung@5420 22 */
ccheung@5420 23
ccheung@5420 24 #include <stdio.h>
ccheung@5420 25 #include <jni.h>
ccheung@5420 26 #include <signal.h>
ccheung@5420 27 #include <sys/ucontext.h>
ccheung@5420 28
ccheung@5420 29 #ifdef __cplusplus
ccheung@5420 30 extern "C" {
ccheung@5420 31 #endif
ccheung@5420 32
ccheung@5420 33 void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
ccheung@5420 34
ccheung@5420 35 printf( " HANDLER (1) " );
ccheung@5420 36 }
ccheung@5420 37
ccheung@5420 38 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {
ccheung@5420 39 struct sigaction act;
ccheung@5420 40 struct sigaction oact;
ccheung@5420 41
ccheung@5420 42 act.sa_flags = SA_ONSTACK|SA_RESTART|SA_SIGINFO;
ccheung@5420 43 sigfillset(&act.sa_mask);
ccheung@5420 44 act.sa_handler = SIG_DFL;
ccheung@5420 45 act.sa_sigaction = (void (*)())sig_handler;
ccheung@5420 46 sigaction(0x20+val, &act, &oact);
ccheung@5420 47
ccheung@5420 48 printf( " doSomething(%d) " , val);
ccheung@5420 49 printf( " old handler = %p " , oact.sa_handler);
ccheung@5420 50 }
ccheung@5420 51
ccheung@5420 52 #ifdef __cplusplus
ccheung@5420 53 }
ccheung@5420 54 #endif
ccheung@5420 55

mercurial