Wed, 15 Jul 2015 11:50:53 -0700
Merge
make/hotspot_version | file | annotate | diff | comparison | revisions |
1.1 --- a/make/hotspot_version Tue Jul 14 09:11:07 2015 -0700 1.2 +++ b/make/hotspot_version Wed Jul 15 11:50:53 2015 -0700 1.3 @@ -34,8 +34,8 @@ 1.4 HOTSPOT_VM_COPYRIGHT=Copyright 2015 1.5 1.6 HS_MAJOR_VER=25 1.7 -HS_MINOR_VER=60 1.8 -HS_BUILD_NUMBER=23 1.9 +HS_MINOR_VER=66 1.10 +HS_BUILD_NUMBER=01 1.11 1.12 JDK_MAJOR_VER=1 1.13 JDK_MINOR_VER=8
2.1 --- a/src/os/bsd/vm/jsig.c Tue Jul 14 09:11:07 2015 -0700 2.2 +++ b/src/os/bsd/vm/jsig.c Wed Jul 15 11:50:53 2015 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -36,6 +36,7 @@ 2.11 #include <stdio.h> 2.12 #include <stdlib.h> 2.13 #include <stdbool.h> 2.14 +#include <string.h> 2.15 2.16 #define MAXSIGNUM 32 2.17 #define MASK(sig) ((unsigned int)1 << sig) 2.18 @@ -43,6 +44,9 @@ 2.19 static struct sigaction sact[MAXSIGNUM]; /* saved signal handlers */ 2.20 static unsigned int jvmsigs = 0; /* signals used by jvm */ 2.21 2.22 +static pthread_key_t reentry_flag_key; 2.23 +static pthread_once_t reentry_key_init_once = PTHREAD_ONCE_INIT; 2.24 + 2.25 /* used to synchronize the installation of signal handlers */ 2.26 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 2.27 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; 2.28 @@ -59,6 +63,15 @@ 2.29 static bool jvm_signal_installing = false; 2.30 static bool jvm_signal_installed = false; 2.31 2.32 +#define check_status(cmd) \ 2.33 + do { \ 2.34 + int status = (cmd); \ 2.35 + if (status != 0) { \ 2.36 + printf("error %s (%d) in " #cmd "\n", strerror(status), status); \ 2.37 + exit(1); \ 2.38 + } \ 2.39 + } while (0) 2.40 + 2.41 static void signal_lock() { 2.42 pthread_mutex_lock(&mutex); 2.43 /* When the jvm is installing its set of signal handlers, threads 2.44 @@ -74,8 +87,15 @@ 2.45 pthread_mutex_unlock(&mutex); 2.46 } 2.47 2.48 +static void reentry_tls_init() { 2.49 + // value for reentry_flag_key will default to NULL (false) 2.50 + check_status(pthread_key_create(&reentry_flag_key, NULL)); 2.51 +} 2.52 + 2.53 static sa_handler_t call_os_signal(int sig, sa_handler_t disp, 2.54 bool is_sigset) { 2.55 + sa_handler_t res; 2.56 + 2.57 if (os_signal == NULL) { 2.58 if (!is_sigset) { 2.59 os_signal = (signal_t)dlsym(RTLD_NEXT, "signal"); 2.60 @@ -87,7 +107,12 @@ 2.61 exit(0); 2.62 } 2.63 } 2.64 - return (*os_signal)(sig, disp); 2.65 + check_status(pthread_once(&reentry_key_init_once, reentry_tls_init)); 2.66 + // set reentry_flag_key to non-NULL to show reentry 2.67 + check_status(pthread_setspecific(reentry_flag_key, &res)); 2.68 + res = (*os_signal)(sig, disp); 2.69 + check_status(pthread_setspecific(reentry_flag_key, NULL)); 2.70 + return res; 2.71 } 2.72 2.73 static void save_signal_handler(int sig, sa_handler_t disp) { 2.74 @@ -161,6 +186,11 @@ 2.75 bool sigused; 2.76 struct sigaction oldAct; 2.77 2.78 + check_status(pthread_once(&reentry_key_init_once, reentry_tls_init)); 2.79 + if (pthread_getspecific(reentry_flag_key) != NULL) { 2.80 + return call_os_sigaction(sig, act, oact); 2.81 + } 2.82 + 2.83 signal_lock(); 2.84 2.85 sigused = (MASK(sig) & jvmsigs) != 0;