annotate src/cpu/x86/vm/rtmLocking.cpp @ 20304:a22acf6d7598

8048112: G1 Full GC needs to support the case when the very first region is not available Summary: Refactor preparation for compaction during Full GC so that it lazily initializes the first compaction point. This also avoids problems later when the first region may not be committed. Also reviewed by K. Barrett. Reviewed-by: brutisso
author tschatzl
date Mon, 21 Jul 2014 10:00:31 +0200
parents 52b37289e3be
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17780
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
1 /*
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
4 *
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
7 * published by the Free Software Foundation.
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
8 *
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
13 * accompanied this code).
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
14 *
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
18 *
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
21 * questions.
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
22 *
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
23 */
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
24
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
25 #include "precompiled.hpp"
17781
52b37289e3be 8038181: Can't build product VM without precompiled header
kvn
parents: 17780
diff changeset
26 #include "memory/allocation.inline.hpp"
17780
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
27 #include "runtime/task.hpp"
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
28 #include "runtime/rtmLocking.hpp"
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
29
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
30 // One-shot PeriodicTask subclass for enabling RTM locking
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
31 uintx RTMLockingCounters::_calculation_flag = 0;
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
32
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
33 class RTMLockingCalculationTask : public PeriodicTask {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
34 public:
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
35 RTMLockingCalculationTask(size_t interval_time) : PeriodicTask(interval_time){ }
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
36
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
37 virtual void task() {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
38 RTMLockingCounters::_calculation_flag = 1;
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
39 // Reclaim our storage and disenroll ourself
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
40 delete this;
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
41 }
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
42 };
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
43
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
44 void RTMLockingCounters::init() {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
45 if (UseRTMLocking && RTMLockingCalculationDelay > 0) {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
46 RTMLockingCalculationTask* task = new RTMLockingCalculationTask(RTMLockingCalculationDelay);
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
47 task->enroll();
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
48 } else {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
49 _calculation_flag = 1;
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
50 }
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
51 }
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
52
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
53 //------------------------------print_on-------------------------------
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
54 void RTMLockingCounters::print_on(outputStream* st) {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
55 tty->print_cr("# rtm locks total (estimated): " UINTX_FORMAT, _total_count * RTMTotalCountIncrRate);
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
56 tty->print_cr("# rtm lock aborts : " UINTX_FORMAT, _abort_count);
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
57 for (int i = 0; i < ABORT_STATUS_LIMIT; i++) {
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
58 tty->print_cr("# rtm lock aborts %d: " UINTX_FORMAT, i, _abortX_count[i]);
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
59 }
606acabe7b5c 8031320: Use Intel RTM instructions for locks
kvn
parents:
diff changeset
60 }