< prev index next >

src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp

Print this page
   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  61   // If we have a walkable last_Java_frame, then we should use it
  62   // even if isInJava == true. It should be more reliable than
  63   // ucontext info.
  64   if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) {
  65     *fr_addr = jt->pd_last_frame();
  66     return true;
  67   }
  68 
  69   ucontext_t* uc = (ucontext_t*) ucontext;
  70 
  71   // At this point, we don't have a walkable last_Java_frame, so
  72   // we try to glean some information out of the ucontext.
  73   intptr_t* ret_sp;
  74   ExtendedPC addr = os::Solaris::fetch_frame_from_ucontext(this, uc,
  75     &ret_sp, NULL /* ret_fp only used on Solaris X86 */);
  76   if (addr.pc() == NULL || ret_sp == NULL) {
  77     // ucontext wasn't useful
  78     return false;
  79   }
  80 
  81 #if INCLUDE_CDS
  82   if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
  83     // In the middle of a trampoline call. Bail out for safety.
  84     // This happens rarely so shouldn't affect profiling.
  85     return false;
  86   }
  87 #endif
  88 
  89   frame ret_frame(ret_sp, frame::unpatchable, addr.pc());
  90 
  91   // we were running Java code when SIGPROF came in
  92   if (isInJava) {
  93 
  94 
  95     // If the frame we got is safe then it is most certainly valid
  96     if (ret_frame.safe_for_sender(jt)) {
  97       *fr_addr = ret_frame;
  98       return true;
  99     }
 100 
 101     // If it isn't safe then we can try several things to try and get
 102     // a good starting point.
 103     //
 104     // On sparc the frames are almost certainly walkable in the sense
 105     // of sp/fp linkages. However because of recycling of windows if
 106     // a piece of code does multiple save's where the initial save creates
 107     // a real frame with a return pc and the succeeding save's are used to


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  61   // If we have a walkable last_Java_frame, then we should use it
  62   // even if isInJava == true. It should be more reliable than
  63   // ucontext info.
  64   if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) {
  65     *fr_addr = jt->pd_last_frame();
  66     return true;
  67   }
  68 
  69   ucontext_t* uc = (ucontext_t*) ucontext;
  70 
  71   // At this point, we don't have a walkable last_Java_frame, so
  72   // we try to glean some information out of the ucontext.
  73   intptr_t* ret_sp;
  74   ExtendedPC addr = os::Solaris::fetch_frame_from_ucontext(this, uc,
  75     &ret_sp, NULL /* ret_fp only used on Solaris X86 */);
  76   if (addr.pc() == NULL || ret_sp == NULL) {
  77     // ucontext wasn't useful
  78     return false;
  79   }
  80 
  81   if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) {

  82     // In the middle of a trampoline call. Bail out for safety.
  83     // This happens rarely so shouldn't affect profiling.
  84     return false;
  85   }

  86 
  87   frame ret_frame(ret_sp, frame::unpatchable, addr.pc());
  88 
  89   // we were running Java code when SIGPROF came in
  90   if (isInJava) {
  91 
  92 
  93     // If the frame we got is safe then it is most certainly valid
  94     if (ret_frame.safe_for_sender(jt)) {
  95       *fr_addr = ret_frame;
  96       return true;
  97     }
  98 
  99     // If it isn't safe then we can try several things to try and get
 100     // a good starting point.
 101     //
 102     // On sparc the frames are almost certainly walkable in the sense
 103     // of sp/fp linkages. However because of recycling of windows if
 104     // a piece of code does multiple save's where the initial save creates
 105     // a real frame with a return pc and the succeeding save's are used to


< prev index next >