hotspot/src/cpu/zero/vm/compiledIC_zero.cpp
author dlong
Wed, 24 Apr 2013 20:55:28 -0400
changeset 17094 29c4955396d2
child 25359 8a19ff205f89
permissions -rw-r--r--
8003853: specify offset of IC load in java_to_interp stub Summary: refactored code to allow platform-specific differences Reviewed-by: dlong, twisti Contributed-by: Goetz Lindenmaier <goetz.lindenmaier@sap.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17094
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     1
/*
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     4
 *
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     7
 * published by the Free Software Foundation.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     8
 *
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    13
 * accompanied this code).
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    14
 *
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    18
 *
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    21
 * questions.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    22
 *
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    23
 */
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    24
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    25
#include "precompiled.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    26
#include "classfile/systemDictionary.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    27
#include "code/codeCache.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    28
#include "code/compiledIC.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    29
#include "code/icBuffer.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    30
#include "code/nmethod.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    31
#include "code/vtableStubs.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    32
#include "interpreter/interpreter.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    33
#include "interpreter/linkResolver.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    34
#include "memory/metadataFactory.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    35
#include "memory/oopFactory.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    36
#include "oops/method.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    37
#include "oops/oop.inline.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    38
#include "oops/symbol.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    39
#include "runtime/icache.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    40
#include "runtime/sharedRuntime.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    41
#include "runtime/stubRoutines.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    42
#include "utilities/events.hpp"
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    43
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    44
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    45
// Release the CompiledICHolder* associated with this call site is there is one.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    46
void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    47
  // This call site might have become stale so inspect it carefully.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    48
  NativeCall* call = nativeCall_at(call_site->addr());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    49
  if (is_icholder_entry(call->destination())) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    50
    NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    51
    InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    52
  }
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    53
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    54
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    55
bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    56
  // This call site might have become stale so inspect it carefully.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    57
  NativeCall* call = nativeCall_at(call_site->addr());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    58
  return is_icholder_entry(call->destination());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    59
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    60
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    61
//-----------------------------------------------------------------------------
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    62
// High-level access to an inline cache. Guaranteed to be MT-safe.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    63
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    64
CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    65
  : _ic_call(call)
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    66
{
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    67
  address ic_call = call->instruction_address();
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    68
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    69
  assert(ic_call != NULL, "ic_call address must be set");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    70
  assert(nm != NULL, "must pass nmethod");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    71
  assert(nm->contains(ic_call), "must be in nmethod");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    72
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    73
  // Search for the ic_call at the given address.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    74
  RelocIterator iter(nm, ic_call, ic_call+1);
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    75
  bool ret = iter.next();
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    76
  assert(ret == true, "relocInfo must exist at this address");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    77
  assert(iter.addr() == ic_call, "must find ic_call");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    78
  if (iter.type() == relocInfo::virtual_call_type) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    79
    virtual_call_Relocation* r = iter.virtual_call_reloc();
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    80
    _is_optimized = false;
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    81
    _value = nativeMovConstReg_at(r->cached_value());
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    82
  } else {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    83
    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    84
    _is_optimized = true;
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    85
    _value = NULL;
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    86
  }
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    87
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    88
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    89
// ----------------------------------------------------------------------------
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    90
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    91
void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    92
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    93
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    94
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    95
int CompiledStaticCall::to_interp_stub_size() {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    96
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    97
  return 0;
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    98
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
    99
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   100
// Relocation entries for call stub, compiled java to interpreter.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   101
int CompiledStaticCall::reloc_to_interp_stub() {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   102
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   103
  return 0;
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   104
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   105
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   106
void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   107
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   108
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   109
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   110
void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   111
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   112
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   113
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   114
//-----------------------------------------------------------------------------
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   115
// Non-product mode code.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   116
#ifndef PRODUCT
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   117
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   118
void CompiledStaticCall::verify() {
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   119
  ShouldNotReachHere(); // Only needed for COMPILER2.
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   120
}
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   121
29c4955396d2 8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff changeset
   122
#endif // !PRODUCT