Fri, 06 Dec 2019 12:42:29 +0100
8235243: handle VS2017 15.9 and VS2019 in abstract_vm_version
8235325: build failure on Linux after 8235243
Reviewed-by: dholmes, mdoerr
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_RUNTIME_RTMLOCKING_HPP |
aoqi@0 | 26 | #define SHARE_VM_RUNTIME_RTMLOCKING_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | // Generate RTM (Restricted Transactional Memory) locking code for all inflated |
aoqi@0 | 29 | // locks when "UseRTMLocking" option is on with normal locking mechanism as fall back |
aoqi@0 | 30 | // handler. |
aoqi@0 | 31 | // |
aoqi@0 | 32 | // On abort/lock busy the lock will be retried a fixed number of times under RTM |
aoqi@0 | 33 | // as specified by "RTMRetryCount" option. The locks which abort too often |
aoqi@0 | 34 | // can be auto tuned or manually tuned. |
aoqi@0 | 35 | // |
aoqi@0 | 36 | // Auto-tuning can be done on an option like UseRTMDeopt and it will need abort |
aoqi@0 | 37 | // ratio calculation for each lock. The abort ratio will be calculated after |
aoqi@0 | 38 | // "RTMAbortThreshold" number of aborts is reached. The formulas are: |
aoqi@0 | 39 | // |
aoqi@0 | 40 | // Aborted transactions = abort_count * 100 |
aoqi@0 | 41 | // All transactions = total_count * RTMTotalCountIncrRate |
aoqi@0 | 42 | // |
aoqi@0 | 43 | // Aborted transactions >= All transactions * RTMAbortRatio |
aoqi@0 | 44 | // |
aoqi@0 | 45 | // If "UseRTMDeopt" is on and the aborts ratio reaches "RTMAbortRatio" |
aoqi@0 | 46 | // the method containing the lock will be deoptimized and recompiled with |
aoqi@0 | 47 | // all locks as normal locks. If the abort ratio continues to remain low after |
aoqi@0 | 48 | // "RTMLockingThreshold" locks are attempted, then the method will be deoptimized |
aoqi@0 | 49 | // and recompiled with all locks as RTM locks without abort ratio calculation code. |
aoqi@0 | 50 | // The abort ratio calculation can be delayed by specifying flag |
aoqi@0 | 51 | // -XX:RTMLockingCalculationDelay in millisecond. |
aoqi@0 | 52 | // |
aoqi@0 | 53 | // For manual tuning the abort statistics for each lock needs to be provided |
aoqi@0 | 54 | // to the user on some JVM option like "PrintPreciseRTMLockingStatistics". |
aoqi@0 | 55 | // Based on the abort statistics users can create a .hotspot_compiler file |
aoqi@0 | 56 | // or use -XX:CompileCommand=option,class::method,NoRTMLockEliding |
aoqi@0 | 57 | // to specify for which methods to disable RTM locking. |
aoqi@0 | 58 | // |
aoqi@0 | 59 | // When UseRTMForStackLocks option is enabled along with UseRTMLocking option, |
aoqi@0 | 60 | // the RTM locking code is generated for stack locks too. |
aoqi@0 | 61 | // The retries, auto-tuning support and rtm locking statistics are all |
aoqi@0 | 62 | // supported for stack locks just like inflated locks. |
aoqi@0 | 63 | |
aoqi@0 | 64 | // RTM locking counters |
aoqi@0 | 65 | class RTMLockingCounters VALUE_OBJ_CLASS_SPEC { |
aoqi@0 | 66 | private: |
aoqi@0 | 67 | uintx _total_count; // Total RTM locks count |
aoqi@0 | 68 | uintx _abort_count; // Total aborts count |
aoqi@0 | 69 | |
aoqi@0 | 70 | public: |
aoqi@0 | 71 | enum { ABORT_STATUS_LIMIT = 6 }; |
aoqi@0 | 72 | // Counters per RTM Abort Status. Incremented with +PrintPreciseRTMLockingStatistics |
aoqi@0 | 73 | // RTM uses the EAX register to communicate abort status to software. |
aoqi@0 | 74 | // Following an RTM abort the EAX register has the following definition. |
aoqi@0 | 75 | // |
aoqi@0 | 76 | // EAX register bit position Meaning |
aoqi@0 | 77 | // 0 Set if abort caused by XABORT instruction. |
aoqi@0 | 78 | // 1 If set, the transaction may succeed on a retry. This bit is always clear if bit 0 is set. |
aoqi@0 | 79 | // 2 Set if another logical processor conflicted with a memory address that was part of the transaction that aborted. |
aoqi@0 | 80 | // 3 Set if an internal buffer overflowed. |
aoqi@0 | 81 | // 4 Set if a debug breakpoint was hit. |
aoqi@0 | 82 | // 5 Set if an abort occurred during execution of a nested transaction. |
aoqi@0 | 83 | private: |
aoqi@0 | 84 | uintx _abortX_count[ABORT_STATUS_LIMIT]; |
aoqi@0 | 85 | |
aoqi@0 | 86 | public: |
aoqi@0 | 87 | static uintx _calculation_flag; |
aoqi@0 | 88 | static uintx* rtm_calculation_flag_addr() { return &_calculation_flag; } |
aoqi@0 | 89 | |
aoqi@0 | 90 | static void init(); |
aoqi@0 | 91 | |
aoqi@0 | 92 | RTMLockingCounters() : _total_count(0), _abort_count(0) { |
aoqi@0 | 93 | for (int i = 0; i < ABORT_STATUS_LIMIT; i++) { |
aoqi@0 | 94 | _abortX_count[i] = 0; |
aoqi@0 | 95 | } |
aoqi@0 | 96 | } |
aoqi@0 | 97 | |
aoqi@0 | 98 | uintx* total_count_addr() { return &_total_count; } |
aoqi@0 | 99 | uintx* abort_count_addr() { return &_abort_count; } |
aoqi@0 | 100 | uintx* abortX_count_addr() { return &_abortX_count[0]; } |
aoqi@0 | 101 | |
aoqi@0 | 102 | static int total_count_offset() { return (int)offset_of(RTMLockingCounters, _total_count); } |
aoqi@0 | 103 | static int abort_count_offset() { return (int)offset_of(RTMLockingCounters, _abort_count); } |
aoqi@0 | 104 | static int abortX_count_offset() { return (int)offset_of(RTMLockingCounters, _abortX_count[0]); } |
aoqi@0 | 105 | |
aoqi@0 | 106 | |
aoqi@0 | 107 | bool nonzero() { return (_abort_count + _total_count) > 0; } |
aoqi@0 | 108 | |
aoqi@0 | 109 | void print_on(outputStream* st); |
aoqi@0 | 110 | void print() { print_on(tty); } |
aoqi@0 | 111 | }; |
aoqi@0 | 112 | |
aoqi@0 | 113 | #endif // SHARE_VM_RUNTIME_RTMLOCKING_HPP |