hotspot/src/share/vm/code/compiledIC.hpp
author trims
Tue, 05 Apr 2011 14:12:31 -0700
changeset 8921 14bfe81f2a9d
parent 8107 78e5bd944384
child 13728 882756847a04
permissions -rw-r--r--
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass Summary: Update the copyright to be 2010 on all changed files in OpenJDK Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8921
14bfe81f2a9d 7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents: 8107
diff changeset
     2
 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_CODE_COMPILEDIC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_CODE_COMPILEDIC_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "interpreter/linkResolver.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "oops/compiledICHolderKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "oops/compiledICHolderOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/klassOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
# include "nativeInst_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
# include "nativeInst_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    39
# include "nativeInst_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    40
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    41
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    42
# include "nativeInst_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    43
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    44
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    45
# include "nativeInst_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    46
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    47
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//-----------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// The CompiledIC represents a compiled inline cache.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// In order to make patching of the inline cache MT-safe, we only allow the following
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// transitions (when not at a safepoint):
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
//         [1] --<--  Clean -->---  [1]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
//            /       (null)      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//           /                     \      /-<-\
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
//          /          [2]          \    /     \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//      Interpreted  ---------> Monomorphic     | [3]
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//  (compiledICHolderOop)        (klassOop)     |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
//          \                        /   \     /
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//       [4] \                      / [4] \->-/
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
//            \->-  Megamorphic -<-/
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
//                  (methodOop)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// The text in paranteses () refere to the value of the inline cache receiver (mov instruction)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// The numbers in square brackets refere to the kind of transition:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// [1]: Initial fixup. Receiver it found from debug information
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// [2]: Compilation of a method
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// [3]: Recompilation of a method (note: only entry is changed. The klassOop must stay the same)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// [4]: Inline cache miss. We go directly to megamorphic call.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// The class automatically inserts transition stubs (using the InlineCacheBuffer) when an MT-unsafe
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
// transition is made to a stub.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
class CompiledIC;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
class CompiledICInfo {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  friend class CompiledIC;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  address _entry;              // entry point for call
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  Handle  _cached_oop;         // Value of cached_oop (either in stub or inline cache)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  bool    _is_optimized;       // it is an optimized virtual call (i.e., can be statically bound)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  bool    _to_interpreter;     // Call it to interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  address entry() const        { return _entry; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  Handle  cached_oop() const   { return _cached_oop; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  bool    is_optimized() const { return _is_optimized; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
class CompiledIC: public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  friend class InlineCacheBuffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  friend class ICStub;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  NativeCall*   _ic_call;       // the call instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  oop*          _oop_addr;      // patchable oop cell for this IC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  RelocIterator _oops;          // iteration over any and all set-oop instructions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  bool          _is_optimized;  // an optimized virtual call (i.e., no compiled IC)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  CompiledIC(NativeCall* ic_call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  CompiledIC(Relocation* ic_reloc);    // Must be of virtual_call_type/opt_virtual_call_type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  // low-level inline-cache manipulation. Cannot be accessed directly, since it might not be MT-safe
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // to change an inline-cache. These changes the underlying inline-cache directly. They *newer* make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // changes to a transition stub.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  void set_ic_destination(address entry_point);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  void set_cached_oop(oop cache);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // Reads the location of the transition stub. This will fail with an assertion, if no transition stub is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // associated with the inline cache.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  address stub_address() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  bool is_in_transition_state() const;  // Use InlineCacheBuffer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // conversion (machine PC to CompiledIC*)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  friend CompiledIC* CompiledIC_before(address return_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  friend CompiledIC* CompiledIC_at(address call_site);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  friend CompiledIC* CompiledIC_at(Relocation* call_site);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // Return the cached_oop/destination associated with this inline cache. If the cache currently points
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  // to a transition stub, it will read the values from the transition stub.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  oop  cached_oop() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  address ic_destination() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  bool is_optimized() const   { return _is_optimized; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // State
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  bool is_clean() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  bool is_megamorphic() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  bool is_call_to_compiled() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  bool is_call_to_interpreted() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  address end_of_call() { return  _ic_call->return_address(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledIC_ock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // so you are guaranteed that no patching takes place. The same goes for verify.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  // Note: We do not provide any direct access to the stub code, to prevent parts of the code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  // to manipulate the inline cache in MT-unsafe ways.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  void set_to_clean();  // Can only be called during a safepoint operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  void set_to_monomorphic(const CompiledICInfo& info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  void set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
                                        bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Location
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  address instruction_address() const { return _ic_call->instruction_address(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  // Misc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  void print()             PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  void print_compiled_ic() PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  void verify()            PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
inline CompiledIC* CompiledIC_before(address return_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  CompiledIC* c_ic = new CompiledIC(nativeCall_before(return_addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  c_ic->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  return c_ic;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
inline CompiledIC* CompiledIC_at(address call_site) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  CompiledIC* c_ic = new CompiledIC(nativeCall_at(call_site));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  c_ic->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  return c_ic;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
inline CompiledIC* CompiledIC_at(Relocation* call_site) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  CompiledIC* c_ic = new CompiledIC(call_site);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  c_ic->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  return c_ic;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
//-----------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
// The CompiledStaticCall represents a call to a static method in the compiled
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
// Transition diagram of a static call site is somewhat simpler than for an inlined cache:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
//           -----<----- Clean ----->-----
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
//          /                             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
//         /                               \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
//    compilled code <------------> interpreted code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
//  Clean:            Calls directly to runtime method for fixup
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
//  Compiled code:    Calls directly to compiled code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
//  Interpreted code: Calls to stub that set methodOop reference
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
class CompiledStaticCall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
class StaticCallInfo {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  address      _entry;          // Entrypoint
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  methodHandle _callee;         // Callee (used when calling interpreter)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  bool         _to_interpreter; // call to interpreted method (otherwise compiled)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  friend class CompiledStaticCall;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  address      entry() const    { return _entry;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  methodHandle callee() const   { return _callee; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
class CompiledStaticCall: public NativeCall {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  friend class CompiledIC;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  // Also used by CompiledIC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  void set_to_interpreted(methodHandle callee, address entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  bool is_optimized_virtual();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  friend CompiledStaticCall* compiledStaticCall_before(address return_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  friend CompiledStaticCall* compiledStaticCall_at(address native_call);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  friend CompiledStaticCall* compiledStaticCall_at(Relocation* call_site);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  // State
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  bool is_clean() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  bool is_call_to_compiled() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  bool is_call_to_interpreted() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  // Clean static call (will force resolving on next use)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  void set_to_clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  // Set state. The entry must be the same, as computed by compute_entry.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // Computation and setting is split up, since the actions are separate during
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  // a OptoRuntime::resolve_xxx.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  void set(const StaticCallInfo& info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  // Compute entry point given a method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  static void compute_entry(methodHandle m, StaticCallInfo& info);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  // Stub support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  address find_stub();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  static void set_stub_to_clean(static_stub_Relocation* static_stub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  // Misc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  void print()  PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  void verify() PRODUCT_RETURN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
inline CompiledStaticCall* compiledStaticCall_before(address return_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  CompiledStaticCall* st = (CompiledStaticCall*)nativeCall_before(return_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  st->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  return st;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
inline CompiledStaticCall* compiledStaticCall_at(address native_call) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  CompiledStaticCall* st = (CompiledStaticCall*)native_call;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  st->verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  return st;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
inline CompiledStaticCall* compiledStaticCall_at(Relocation* call_site) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  return compiledStaticCall_at(call_site->addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   265
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   266
#endif // SHARE_VM_CODE_COMPILEDIC_HPP