< prev index next >

src/hotspot/share/runtime/interfaceSupport.cpp

Print this page




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/shared/collectedHeap.hpp"
  27 #include "gc/shared/collectedHeap.inline.hpp"
  28 #include "gc/shared/genCollectedHeap.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "runtime/atomic.hpp"

  31 #include "runtime/init.hpp"
  32 #include "runtime/interfaceSupport.hpp"
  33 #include "runtime/orderAccess.inline.hpp"
  34 #include "runtime/os.inline.hpp"

  35 #include "runtime/vframe.hpp"
  36 #include "utilities/preserveException.hpp"
  37 
  38 // Implementation of InterfaceSupport
  39 
  40 #ifdef ASSERT































  41 
  42 long InterfaceSupport::_number_of_calls       = 0;
  43 long InterfaceSupport::_scavenge_alot_counter = 1;
  44 long InterfaceSupport::_fullgc_alot_counter   = 1;
  45 long InterfaceSupport::_fullgc_alot_invocation = 0;
  46 
  47 Histogram* RuntimeHistogram;
  48 
  49 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  50   static volatile int RuntimeHistogram_lock = 0;
  51   _name = elementName;
  52   uintx count = 0;
  53 
  54   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  55     while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) {
  56       count +=1;
  57       if ( (WarnOnStalledSpinLock > 0)
  58         && (count % WarnOnStalledSpinLock == 0)) {
  59         warning("RuntimeHistogram_lock seems to be stalled");
  60       }




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/shared/collectedHeap.hpp"
  27 #include "gc/shared/collectedHeap.inline.hpp"
  28 #include "gc/shared/genCollectedHeap.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/handles.inline.hpp"
  32 #include "runtime/init.hpp"
  33 #include "runtime/interfaceSupport.inline.hpp"
  34 #include "runtime/orderAccess.inline.hpp"
  35 #include "runtime/os.inline.hpp"
  36 #include "runtime/thread.inline.hpp"
  37 #include "runtime/vframe.hpp"
  38 #include "utilities/preserveException.hpp"
  39 
  40 // Implementation of InterfaceSupport
  41 
  42 #ifdef ASSERT
  43 VMEntryWrapper::VMEntryWrapper() {
  44   if (VerifyLastFrame) {
  45     InterfaceSupport::verify_last_frame();
  46   }
  47 }
  48 
  49 VMEntryWrapper::~VMEntryWrapper() {
  50   InterfaceSupport::check_gc_alot();
  51   if (WalkStackALot) {
  52     InterfaceSupport::walk_stack();
  53   }
  54 #ifdef COMPILER2
  55   // This option is not used by Compiler 1
  56   if (StressDerivedPointers) {
  57     InterfaceSupport::stress_derived_pointers();
  58   }
  59 #endif
  60   if (DeoptimizeALot || DeoptimizeRandom) {
  61     InterfaceSupport::deoptimizeAll();
  62   }
  63   if (ZombieALot) {
  64     InterfaceSupport::zombieAll();
  65   }
  66   if (UnlinkSymbolsALot) {
  67     InterfaceSupport::unlinkSymbols();
  68   }
  69   // do verification AFTER potential deoptimization
  70   if (VerifyStack) {
  71     InterfaceSupport::verify_stack();
  72   }
  73 }
  74 
  75 long InterfaceSupport::_number_of_calls       = 0;
  76 long InterfaceSupport::_scavenge_alot_counter = 1;
  77 long InterfaceSupport::_fullgc_alot_counter   = 1;
  78 long InterfaceSupport::_fullgc_alot_invocation = 0;
  79 
  80 Histogram* RuntimeHistogram;
  81 
  82 RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) {
  83   static volatile int RuntimeHistogram_lock = 0;
  84   _name = elementName;
  85   uintx count = 0;
  86 
  87   while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) {
  88     while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) {
  89       count +=1;
  90       if ( (WarnOnStalledSpinLock > 0)
  91         && (count % WarnOnStalledSpinLock == 0)) {
  92         warning("RuntimeHistogram_lock seems to be stalled");
  93       }


< prev index next >