src/hotspot/share/code/compiledMethod.inline.hpp
author pliden
Mon, 14 May 2018 15:42:59 +0200
changeset 50102 454fa295105c
parent 49816 a3e79f97e86b
child 52405 c0c6cdea32f1
permissions -rw-r--r--
8202976: Add C1 lea patching support for x86 Reviewed-by: kvn, neliasso
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
/*
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
     2
 * Copyright (c) 2017, 2018, 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
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    25
#ifndef SHARE_VM_CODE_COMPILEDMETHOD_INLINE_HPP
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    26
#define SHARE_VM_CODE_COMPILEDMETHOD_INLINE_HPP
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
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    44
inline void CompiledMethod::release_set_exception_cache(ExceptionCache *ec) {
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    45
  OrderAccess::release_store(&_exception_cache, ec);
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    46
}
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    47
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    48
// -----------------------------------------------------------------------------
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    49
// CompiledMethod::get_deopt_original_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
// Return the original PC for the given PC if:
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    52
// (a) the given PC belongs to a nmethod and
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    53
// (b) it is a deopt PC
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    54
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    55
inline address CompiledMethod::get_deopt_original_pc(const frame* fr) {
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    56
  if (fr->cb() == NULL)  return NULL;
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
  CompiledMethod* cm = fr->cb()->as_compiled_method_or_null();
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    59
  if (cm != NULL && cm->is_deopt_pc(fr->pc()))
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    60
    return cm->get_original_pc(fr);
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    61
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    62
  return NULL;
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    63
}
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    64
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    65
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    66
// class ExceptionCache methods
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    67
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    68
inline int ExceptionCache::count() { return OrderAccess::load_acquire(&_count); }
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    69
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    70
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
    71
  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
    72
  return _pc[index];
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    73
}
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
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
    76
  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
    77
  return _handler[index];
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    78
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49340
diff changeset
    79
49340
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    80
// 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
    81
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
    82
4e82736053ae 8191102: Incorrect include file use in classLoader.hpp
hseigel
parents: 47216
diff changeset
    83
46623
261b9d05b79d 8183299: Improve inlining of CompiledMethod methods into frame::sender
redestad
parents:
diff changeset
    84
#endif //SHARE_VM_CODE_COMPILEDMETHOD_INLINE_HPP