src/hotspot/share/code/compiledMethod.inline.hpp
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 53244 9807daeb47c4
child 59247 56bf71d64d51
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52405
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     4
 *
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     7
 * published by the Free Software Foundation.
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     8
 *
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    13
 * accompanied this code).
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    14
 *
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    18
 *
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    21
 * questions.
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    22
 *
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    23
 */
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52405
diff changeset
    25
#ifndef SHARE_CODE_COMPILEDMETHOD_INLINE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52405
diff changeset
    26
#define SHARE_CODE_COMPILEDMETHOD_INLINE_HPP
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    27
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    28
#include "code/compiledMethod.hpp"
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    29
#include "code/nativeInst.hpp"
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    30
#include "runtime/frame.hpp"
49816
a3e79f97e86b 8200555: OopHandle should use Access API
coleenp
parents: 49480
diff changeset
    31
#include "runtime/orderAccess.hpp"
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    32
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    33
inline bool CompiledMethod::is_deopt_pc(address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); }
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    34
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    35
// When using JVMCI the address might be off by the size of a call instruction.
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    36
inline bool CompiledMethod::is_deopt_entry(address pc) {
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    37
  return pc == deopt_handler_begin()
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    38
#if INCLUDE_JVMCI
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    39
    || (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::instruction_size))
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    40
#endif
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    41
    ;
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    42
}
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    43
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    44
// -----------------------------------------------------------------------------
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    45
// CompiledMethod::get_deopt_original_pc
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    46
//
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    47
// Return the original PC for the given PC if:
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    48
// (a) the given PC belongs to a nmethod and
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    49
// (b) it is a deopt PC
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    50
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    51
inline address CompiledMethod::get_deopt_original_pc(const frame* fr) {
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    52
  if (fr->cb() == NULL)  return NULL;
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    53
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    54
  CompiledMethod* cm = fr->cb()->as_compiled_method_or_null();
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    55
  if (cm != NULL && cm->is_deopt_pc(fr->pc()))
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    56
    return cm->get_original_pc(fr);
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    57
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    58
  return NULL;
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    59
}
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    60
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    61
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    62
// class ExceptionCache methods
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    63
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    64
inline int ExceptionCache::count() { return OrderAccess::load_acquire(&_count); }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    65
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    66
address ExceptionCache::pc_at(int index) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    67
  assert(index >= 0 && index < count(),"");
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    68
  return _pc[index];
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    69
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    70
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    71
address ExceptionCache::handler_at(int index) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    72
  assert(index >= 0 && index < count(),"");
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    73
  return _handler[index];
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    74
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    75
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    76
// increment_count is only called under lock, but there may be concurrent readers.
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    77
inline void ExceptionCache::increment_count() { OrderAccess::release_store(&_count, _count + 1); }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    78
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    79
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52405
diff changeset
    80
#endif // SHARE_CODE_COMPILEDMETHOD_INLINE_HPP