Thu, 24 May 2018 19:24:53 +0800
#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1998, 2013, 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_OBJECTMONITOR_INLINE_HPP |
aoqi@0 | 26 | #define SHARE_VM_RUNTIME_OBJECTMONITOR_INLINE_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | inline intptr_t ObjectMonitor::is_entered(TRAPS) const { |
aoqi@0 | 29 | if (THREAD == _owner || THREAD->is_lock_owned((address) _owner)) { |
aoqi@0 | 30 | return 1; |
aoqi@0 | 31 | } |
aoqi@0 | 32 | return 0; |
aoqi@0 | 33 | } |
aoqi@0 | 34 | |
aoqi@0 | 35 | inline markOop ObjectMonitor::header() const { |
aoqi@0 | 36 | return _header; |
aoqi@0 | 37 | } |
aoqi@0 | 38 | |
aoqi@0 | 39 | inline void ObjectMonitor::set_header(markOop hdr) { |
aoqi@0 | 40 | _header = hdr; |
aoqi@0 | 41 | } |
aoqi@0 | 42 | |
aoqi@0 | 43 | inline intptr_t ObjectMonitor::count() const { |
aoqi@0 | 44 | return _count; |
aoqi@0 | 45 | } |
aoqi@0 | 46 | |
aoqi@0 | 47 | inline void ObjectMonitor::set_count(intptr_t count) { |
aoqi@0 | 48 | _count= count; |
aoqi@0 | 49 | } |
aoqi@0 | 50 | |
aoqi@0 | 51 | inline intptr_t ObjectMonitor::waiters() const { |
aoqi@0 | 52 | return _waiters; |
aoqi@0 | 53 | } |
aoqi@0 | 54 | |
aoqi@0 | 55 | inline void* ObjectMonitor::owner() const { |
aoqi@0 | 56 | return _owner; |
aoqi@0 | 57 | } |
aoqi@0 | 58 | |
aoqi@0 | 59 | inline void ObjectMonitor::clear() { |
aoqi@0 | 60 | assert(_header, "Fatal logic error in ObjectMonitor header!"); |
aoqi@0 | 61 | assert(_count == 0, "Fatal logic error in ObjectMonitor count!"); |
aoqi@0 | 62 | assert(_waiters == 0, "Fatal logic error in ObjectMonitor waiters!"); |
aoqi@0 | 63 | assert(_recursions == 0, "Fatal logic error in ObjectMonitor recursions!"); |
aoqi@0 | 64 | assert(_object, "Fatal logic error in ObjectMonitor object!"); |
aoqi@0 | 65 | assert(_owner == 0, "Fatal logic error in ObjectMonitor owner!"); |
aoqi@0 | 66 | |
aoqi@0 | 67 | _header = NULL; |
aoqi@0 | 68 | _object = NULL; |
aoqi@0 | 69 | } |
aoqi@0 | 70 | |
aoqi@0 | 71 | |
aoqi@0 | 72 | inline void* ObjectMonitor::object() const { |
aoqi@0 | 73 | return _object; |
aoqi@0 | 74 | } |
aoqi@0 | 75 | |
aoqi@0 | 76 | inline void* ObjectMonitor::object_addr() { |
aoqi@0 | 77 | return (void *)(&_object); |
aoqi@0 | 78 | } |
aoqi@0 | 79 | |
aoqi@0 | 80 | inline void ObjectMonitor::set_object(void* obj) { |
aoqi@0 | 81 | _object = obj; |
aoqi@0 | 82 | } |
aoqi@0 | 83 | |
aoqi@0 | 84 | inline bool ObjectMonitor::check(TRAPS) { |
aoqi@0 | 85 | if (THREAD != _owner) { |
aoqi@0 | 86 | if (THREAD->is_lock_owned((address) _owner)) { |
aoqi@0 | 87 | _owner = THREAD; // regain ownership of inflated monitor |
aoqi@0 | 88 | OwnerIsThread = 1 ; |
aoqi@0 | 89 | assert (_recursions == 0, "invariant") ; |
aoqi@0 | 90 | } else { |
aoqi@0 | 91 | check_slow(THREAD); |
aoqi@0 | 92 | return false; |
aoqi@0 | 93 | } |
aoqi@0 | 94 | } |
aoqi@0 | 95 | return true; |
aoqi@0 | 96 | } |
aoqi@0 | 97 | |
aoqi@0 | 98 | |
aoqi@0 | 99 | // return number of threads contending for this monitor |
aoqi@0 | 100 | inline intptr_t ObjectMonitor::contentions() const { |
aoqi@0 | 101 | return _count; |
aoqi@0 | 102 | } |
aoqi@0 | 103 | |
aoqi@0 | 104 | // Do NOT set _count = 0. There is a race such that _count could |
aoqi@0 | 105 | // be set while inflating prior to setting _owner |
aoqi@0 | 106 | // Just use Atomic::inc/dec and assert 0 when monitor put on free list |
aoqi@0 | 107 | inline void ObjectMonitor::set_owner(void* owner) { |
aoqi@0 | 108 | _owner = owner; |
aoqi@0 | 109 | _recursions = 0; |
aoqi@0 | 110 | } |
aoqi@0 | 111 | |
aoqi@0 | 112 | |
aoqi@0 | 113 | #endif // SHARE_VM_RUNTIME_OBJECTMONITOR_INLINE_HPP |