< prev index next >

src/hotspot/share/code/stubs.cpp

Print this page
rev 47398 : 8166317: InterpreterCodeSize should be computed
Reviewed-by: kvn, coleenp


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/codeBlob.hpp"

  27 #include "code/stubs.hpp"
  28 #include "memory/allocation.inline.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/mutexLocker.hpp"
  31 #include "utilities/align.hpp"
  32 
  33 
  34 // Implementation of StubQueue
  35 //
  36 // Standard wrap-around queue implementation; the queue dimensions
  37 // are specified by the _queue_begin & _queue_end indices. The queue
  38 // can be in two states (transparent to the outside):
  39 //
  40 // a) contiguous state: all queue entries in one block (or empty)
  41 //
  42 // Queue: |...|XXXXXXX|...............|
  43 //        ^0  ^begin  ^end            ^size = limit
  44 //            |_______|
  45 //            one block
  46 //


  72   }
  73   _stub_interface  = stub_interface;
  74   _buffer_size     = blob->content_size();
  75   _buffer_limit    = blob->content_size();
  76   _stub_buffer     = blob->content_begin();
  77   _queue_begin     = 0;
  78   _queue_end       = 0;
  79   _number_of_stubs = 0;
  80   register_queue(this);
  81 }
  82 
  83 
  84 StubQueue::~StubQueue() {
  85   // Note: Currently StubQueues are never destroyed so nothing needs to be done here.
  86   //       If we want to implement the destructor, we need to release the BufferBlob
  87   //       allocated in the constructor (i.e., we need to keep it around or look it
  88   //       up via CodeCache::find_blob(...).
  89   Unimplemented();
  90 }
  91 







  92 
  93 Stub* StubQueue::stub_containing(address pc) const {
  94   if (contains(pc)) {
  95     for (Stub* s = first(); s != NULL; s = next(s)) {
  96       if (stub_contains(s, pc)) return s;
  97     }
  98   }
  99   return NULL;
 100 }
 101 
 102 
 103 Stub* StubQueue::request_committed(int code_size) {
 104   Stub* s = request(code_size);
 105   CodeStrings strings;
 106   if (s != NULL) commit(code_size, strings);
 107   return s;
 108 }
 109 
 110 
 111 Stub* StubQueue::request(int requested_code_size) {




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/codeBlob.hpp"
  27 #include "code/codeCache.hpp"
  28 #include "code/stubs.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "runtime/mutexLocker.hpp"
  32 #include "utilities/align.hpp"
  33 
  34 
  35 // Implementation of StubQueue
  36 //
  37 // Standard wrap-around queue implementation; the queue dimensions
  38 // are specified by the _queue_begin & _queue_end indices. The queue
  39 // can be in two states (transparent to the outside):
  40 //
  41 // a) contiguous state: all queue entries in one block (or empty)
  42 //
  43 // Queue: |...|XXXXXXX|...............|
  44 //        ^0  ^begin  ^end            ^size = limit
  45 //            |_______|
  46 //            one block
  47 //


  73   }
  74   _stub_interface  = stub_interface;
  75   _buffer_size     = blob->content_size();
  76   _buffer_limit    = blob->content_size();
  77   _stub_buffer     = blob->content_begin();
  78   _queue_begin     = 0;
  79   _queue_end       = 0;
  80   _number_of_stubs = 0;
  81   register_queue(this);
  82 }
  83 
  84 
  85 StubQueue::~StubQueue() {
  86   // Note: Currently StubQueues are never destroyed so nothing needs to be done here.
  87   //       If we want to implement the destructor, we need to release the BufferBlob
  88   //       allocated in the constructor (i.e., we need to keep it around or look it
  89   //       up via CodeCache::find_blob(...).
  90   Unimplemented();
  91 }
  92 
  93 void StubQueue::deallocate_unused_tail() {
  94   CodeBlob* blob = CodeCache::find_blob((void*)_stub_buffer);
  95   CodeCache::free_unused_tail(blob, used_space());
  96   // Update the limits to the new, trimmed CodeBlob size
  97   _buffer_size = blob->content_size();
  98   _buffer_limit = blob->content_size();
  99 }
 100 
 101 Stub* StubQueue::stub_containing(address pc) const {
 102   if (contains(pc)) {
 103     for (Stub* s = first(); s != NULL; s = next(s)) {
 104       if (stub_contains(s, pc)) return s;
 105     }
 106   }
 107   return NULL;
 108 }
 109 
 110 
 111 Stub* StubQueue::request_committed(int code_size) {
 112   Stub* s = request(code_size);
 113   CodeStrings strings;
 114   if (s != NULL) commit(code_size, strings);
 115   return s;
 116 }
 117 
 118 
 119 Stub* StubQueue::request(int requested_code_size) {


< prev index next >