comparison src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @ 10405:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 746b070f5022
children 980532a806a5 5e3b6f79d280
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
1 /* 1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
181 // Assumes ucontext is valid 181 // Assumes ucontext is valid
182 intptr_t* os::Solaris::ucontext_get_fp(ucontext_t *uc) { 182 intptr_t* os::Solaris::ucontext_get_fp(ucontext_t *uc) {
183 return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; 183 return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
184 } 184 }
185 185
186 address os::Solaris::ucontext_get_pc(ucontext_t *uc) {
187 return (address) uc->uc_mcontext.gregs[REG_PC];
188 }
189
186 // For Forte Analyzer AsyncGetCallTrace profiling support - thread 190 // For Forte Analyzer AsyncGetCallTrace profiling support - thread
187 // is currently interrupted by SIGPROF. 191 // is currently interrupted by SIGPROF.
188 // 192 //
189 // The difference between this and os::fetch_frame_from_context() is that 193 // The difference between this and os::fetch_frame_from_context() is that
190 // here we try to skip nested signal frames. 194 // here we try to skip nested signal frames.
250 } else { 254 } else {
251 return os::get_sender_for_C_frame(&myframe); 255 return os::get_sender_for_C_frame(&myframe);
252 } 256 }
253 } 257 }
254 258
255 // This is a simple callback that just fetches a PC for an interrupted thread.
256 // The thread need not be suspended and the fetched PC is just a hint.
257 // This one is currently used for profiling the VMThread ONLY!
258
259 // Must be synchronous
260 void GetThreadPC_Callback::execute(OSThread::InterruptArguments *args) {
261 Thread* thread = args->thread();
262 ucontext_t* uc = args->ucontext();
263 intptr_t* sp;
264
265 assert(ProfileVM && thread->is_VM_thread(), "just checking");
266
267 ExtendedPC new_addr((address)uc->uc_mcontext.gregs[REG_PC]);
268 _addr = new_addr;
269 }
270
271 static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) { 259 static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) {
272 char lwpstatusfile[PROCFILE_LENGTH]; 260 char lwpstatusfile[PROCFILE_LENGTH];
273 int lwpfd, err; 261 int lwpfd, err;
274 262
275 if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs)) 263 if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs))
417 } 405 }
418 406
419 guarantee(sig != os::Solaris::SIGinterrupt(), "Can not chain VM interrupt signal, try -XX:+UseAltSigs"); 407 guarantee(sig != os::Solaris::SIGinterrupt(), "Can not chain VM interrupt signal, try -XX:+UseAltSigs");
420 408
421 if (sig == os::Solaris::SIGasync()) { 409 if (sig == os::Solaris::SIGasync()) {
422 if(thread){ 410 if(thread || vmthread){
423 OSThread::InterruptArguments args(thread, uc); 411 OSThread::SR_handler(t, uc);
424 thread->osthread()->do_interrupt_callbacks_at_interrupt(&args);
425 return true;
426 }
427 else if(vmthread){
428 OSThread::InterruptArguments args(vmthread, uc);
429 vmthread->osthread()->do_interrupt_callbacks_at_interrupt(&args);
430 return true; 412 return true;
431 } else if (os::Solaris::chained_handler(sig, info, ucVoid)) { 413 } else if (os::Solaris::chained_handler(sig, info, ucVoid)) {
432 return true; 414 return true;
433 } else { 415 } else {
434 // If os::Solaris::SIGasync not chained, and this is a non-vm and 416 // If os::Solaris::SIGasync not chained, and this is a non-vm and