src/hotspot/share/code/stubs.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 49373 47b5652f2928
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
     2
 * Copyright (c) 1997, 2019, 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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
    25
#ifndef SHARE_CODE_STUBS_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
    26
#define SHARE_CODE_STUBS_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
    28
#include "asm/codeBuffer.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// The classes in this file provide a simple framework for the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// management of little pieces of machine code - or stubs -
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// created on the fly and frequently discarded. In this frame-
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// work stubs are stored in a queue.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// Stub serves as abstract base class. A concrete stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// implementation is a subclass of Stub, implementing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// all (non-virtual!) functions required sketched out
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// in the Stub class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// A concrete stub layout may look like this (both data
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// and code sections could be empty as well):
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//                ________
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// stub       -->|        | <--+
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//               |  data  |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//               |________|    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// code_begin -->|        |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//               |        |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//               |  code  |    | size
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//               |        |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
//               |________|    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// code_end   -->|        |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
//               |  data  |    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
//               |________|    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//                          <--+
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
49373
47b5652f2928 8199283: Remove ValueObj class for allocation subclassing for compiler code
coleenp
parents: 48097
diff changeset
    60
class Stub {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // Initialization/finalization
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
    63
  void    initialize(int size,
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
    64
                     CodeStrings& strings)       { ShouldNotCallThis(); }                // called to initialize/specify the stub's size
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  void    finalize()                             { ShouldNotCallThis(); }                // called before the stub is deallocated
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  // General info/converters
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  int     size() const                           { ShouldNotCallThis(); return 0; }      // must return the size provided by initialize
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  static  int code_size_to_size(int code_size)   { ShouldNotCallThis(); return 0; }      // computes the size given the code size
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // Code info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  address code_begin() const                     { ShouldNotCallThis(); return NULL; }   // points to the first byte of    the code
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  address code_end() const                       { ShouldNotCallThis(); return NULL; }   // points to the first byte after the code
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  void    verify()                               { ShouldNotCallThis(); }                // verifies the Stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  void    print()                                { ShouldNotCallThis(); }                // prints some information about the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// A stub interface defines the interface between a stub queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
// and the stubs it queues. In order to avoid a vtable and
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// (and thus the extra word) in each stub, a concrete stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
// interface object is created and associated with a stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// buffer which in turn uses the stub interface to interact
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
// with its stubs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// StubInterface serves as an abstract base class. A concrete
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
// stub interface implementation is a subclass of StubInterface,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// forwarding its virtual function calls to non-virtual calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// of the concrete stub (see also macro below). There's exactly
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
// one stub interface instance required per stub queue.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 10565
diff changeset
    94
class StubInterface: public CHeapObj<mtCode> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  // Initialization/finalization
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
    97
  virtual void    initialize(Stub* self, int size,
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
    98
                             CodeStrings& strings)         = 0; // called after creation (called twice if allocated via (request, commit))
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  virtual void    finalize(Stub* self)                     = 0; // called before deallocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // General info/converters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual int     size(Stub* self) const                   = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  virtual int     code_size_to_size(int code_size) const   = 0; // computes the total stub size in bytes given the code size in bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  // Code info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual address code_begin(Stub* self) const             = 0; // points to the first code byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  virtual address code_end(Stub* self) const               = 0; // points to the first byte after the code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual void    verify(Stub* self)                       = 0; // verifies the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual void    print(Stub* self)                        = 0; // prints information about the stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
// DEF_STUB_INTERFACE is used to create a concrete stub interface
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
// class, forwarding stub interface calls to the corresponding
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// stub calls.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
#define DEF_STUB_INTERFACE(stub)                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  class stub##Interface: public StubInterface {            \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
   private:                                                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    static stub*    cast(Stub* self)                       { return (stub*)self; }                 \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
                                                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
   public:                                                 \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    /* Initialization/finalization */                      \
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
   126
    virtual void    initialize(Stub* self, int size,       \
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
   127
                               CodeStrings& strings)       { cast(self)->initialize(size, strings); } \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    virtual void    finalize(Stub* self)                   { cast(self)->finalize(); }             \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
                                                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    /* General info */                                     \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    virtual int     size(Stub* self) const                 { return cast(self)->size(); }          \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    virtual int     code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
                                                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    /* Code info */                                        \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    virtual address code_begin(Stub* self) const           { return cast(self)->code_begin(); }    \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    virtual address code_end(Stub* self) const             { return cast(self)->code_end(); }      \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
                                                           \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    /* Debugging */                                        \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    virtual void    verify(Stub* self)                     { cast(self)->verify(); }               \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    virtual void    print(Stub* self)                      { cast(self)->print(); }                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
// A StubQueue maintains a queue of stubs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
// Note: All sizes (spaces) are given in bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 10565
diff changeset
   147
class StubQueue: public CHeapObj<mtCode> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  StubInterface* _stub_interface;                // the interface prototype
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  address        _stub_buffer;                   // where all stubs are stored
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  int            _buffer_size;                   // the buffer size in bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  int            _buffer_limit;                  // the (byte) index of the actual buffer limit (_buffer_limit <= _buffer_size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  int            _queue_begin;                   // the (byte) index of the first queue entry (word-aligned)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  int            _queue_end;                     // the (byte) index of the first entry after the queue (word-aligned)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  int            _number_of_stubs;               // the number of buffered stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  Mutex* const   _mutex;                         // the lock used for a (request, commit) transaction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  void  check_index(int i) const                 { assert(0 <= i && i < _buffer_limit && i % CodeEntryAlignment == 0, "illegal index"); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  bool  is_contiguous() const                    { return _queue_begin <= _queue_end; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  int   index_of(Stub* s) const                  { int i = (address)s - _stub_buffer; check_index(i); return i; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  Stub* stub_at(int i) const                     { check_index(i); return (Stub*)(_stub_buffer + i); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  Stub* current_stub() const                     { return stub_at(_queue_end); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // Stub functionality accessed via interface
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
   166
  void  stub_initialize(Stub* s, int size,
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
   167
                        CodeStrings& strings)    { assert(size % CodeEntryAlignment == 0, "size not aligned"); _stub_interface->initialize(s, size, strings); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  void  stub_finalize(Stub* s)                   { _stub_interface->finalize(s); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  int   stub_size(Stub* s) const                 { return _stub_interface->size(s); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  bool  stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  int   stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  void  stub_verify(Stub* s)                     { _stub_interface->verify(s); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  void  stub_print(Stub* s)                      { _stub_interface->print(s); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
            const char* name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  ~StubQueue();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  // General queue info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  bool  is_empty() const                         { return _queue_begin == _queue_end; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  int   total_space() const                      { return _buffer_size - 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  int   available_space() const                  { int d = _queue_begin - _queue_end - 1; return d < 0 ? d + _buffer_size : d; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  int   used_space() const                       { return total_space() - available_space(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  int   number_of_stubs() const                  { return _number_of_stubs; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  bool  contains(address pc) const               { return _stub_buffer <= pc && pc < _stub_buffer + _buffer_limit; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  Stub* stub_containing(address pc) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  address code_start() const                     { return _stub_buffer; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  address code_end() const                       { return _stub_buffer + _buffer_limit; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  // Stub allocation (atomic transactions)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  Stub* request_committed(int code_size);        // request a stub that provides exactly code_size space for code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  Stub* request(int requested_code_size);        // request a stub with a (maximum) code space - locks the queue
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 13195
diff changeset
   194
  void  commit (int committed_code_size,
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
   195
                CodeStrings& strings);           // commit the previously requested stub - unlocks the queue
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  // Stub deallocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  void  remove_first();                          // remove the first stub in the queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  void  remove_first(int n);                     // remove the first n stubs in the queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  void  remove_all();                            // remove all stubs in the queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
47688
3d1e3786d66e 8166317: InterpreterCodeSize should be computed
simonis
parents: 47216
diff changeset
   202
  void deallocate_unused_tail();                 // deallocate the unused tail of the underlying CodeBlob
3d1e3786d66e 8166317: InterpreterCodeSize should be computed
simonis
parents: 47216
diff changeset
   203
                                                 // only used from TemplateInterpreter::initialize()
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // Iteration
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  Stub* first() const                            { return number_of_stubs() > 0 ? stub_at(_queue_begin) : NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  Stub* next(Stub* s) const                      { int i = index_of(s) + stub_size(s);
47688
3d1e3786d66e 8166317: InterpreterCodeSize should be computed
simonis
parents: 47216
diff changeset
   207
                                                   // Only wrap around in the non-contiguous case (see stubss.cpp)
3d1e3786d66e 8166317: InterpreterCodeSize should be computed
simonis
parents: 47216
diff changeset
   208
                                                   if (i == _buffer_limit && _queue_end < _buffer_limit) i = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
                                                   return (i == _queue_end) ? NULL : stub_at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
                                                 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // Debugging/printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  void  verify();                                // verifies the stub queue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  void  print();                                 // prints information about the stub queue
31620
53be635ad49c 8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents: 25468
diff changeset
   215
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   217
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49373
diff changeset
   218
#endif // SHARE_CODE_STUBS_HPP