src/cpu/x86/vm/rtmLocking.cpp

Fri, 16 Aug 2019 16:50:17 +0200

author
eosterlund
date
Fri, 16 Aug 2019 16:50:17 +0200
changeset 9834
bb1da64b0492
parent 6430
52b37289e3be
child 6876
710a3c8b516e
permissions
-rw-r--r--

8229345: Memory leak due to vtable stubs not being shared on SPARC
Reviewed-by: mdoerr, dholmes, kvn

kvn@6429 1 /*
kvn@6429 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
kvn@6429 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kvn@6429 4 *
kvn@6429 5 * This code is free software; you can redistribute it and/or modify it
kvn@6429 6 * under the terms of the GNU General Public License version 2 only, as
kvn@6429 7 * published by the Free Software Foundation.
kvn@6429 8 *
kvn@6429 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kvn@6429 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kvn@6429 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kvn@6429 12 * version 2 for more details (a copy is included in the LICENSE file that
kvn@6429 13 * accompanied this code).
kvn@6429 14 *
kvn@6429 15 * You should have received a copy of the GNU General Public License version
kvn@6429 16 * 2 along with this work; if not, write to the Free Software Foundation,
kvn@6429 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kvn@6429 18 *
kvn@6429 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
kvn@6429 20 * or visit www.oracle.com if you need additional information or have any
kvn@6429 21 * questions.
kvn@6429 22 *
kvn@6429 23 */
kvn@6429 24
kvn@6429 25 #include "precompiled.hpp"
kvn@6430 26 #include "memory/allocation.inline.hpp"
kvn@6429 27 #include "runtime/task.hpp"
kvn@6429 28 #include "runtime/rtmLocking.hpp"
kvn@6429 29
kvn@6429 30 // One-shot PeriodicTask subclass for enabling RTM locking
kvn@6429 31 uintx RTMLockingCounters::_calculation_flag = 0;
kvn@6429 32
kvn@6429 33 class RTMLockingCalculationTask : public PeriodicTask {
kvn@6429 34 public:
kvn@6429 35 RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){ }
kvn@6429 36
kvn@6429 37 virtual void task() {
kvn@6429 38 RTMLockingCounters::_calculation_flag = 1;
kvn@6429 39 // Reclaim our storage and disenroll ourself
kvn@6429 40 delete this;
kvn@6429 41 }
kvn@6429 42 };
kvn@6429 43
kvn@6429 44 void RTMLockingCounters::init() {
kvn@6429 45 if (UseRTMLocking && RTMLockingCalculationDelay > 0) {
kvn@6429 46 RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay);
kvn@6429 47 task->enroll();
kvn@6429 48 } else {
kvn@6429 49 _calculation_flag = 1;
kvn@6429 50 }
kvn@6429 51 }
kvn@6429 52
kvn@6429 53 //------------------------------print_on-------------------------------
kvn@6429 54 void RTMLockingCounters::print_on(outputStream* st) {
kvn@6429 55 tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate);
kvn@6429 56 tty->print_cr("# rtm lock aborts : " UINTX_FORMAT, _abort_count);
kvn@6429 57 for (int i = 0; i < ABORT_STATUS_LIMIT; i++) {
kvn@6429 58 tty->print_cr("# rtm lock aborts %d: " UINTX_FORMAT, i, _abortX_count[i]);
kvn@6429 59 }
kvn@6429 60 }

mercurial