184 int total_space() const { return _buffer_size - 1; }
185 int available_space() const { int d = _queue_begin - _queue_end - 1; return d < 0 ? d + _buffer_size : d; }
186 int used_space() const { return total_space() - available_space(); }
187 int number_of_stubs() const { return _number_of_stubs; }
188 bool contains(address pc) const { return _stub_buffer <= pc && pc < _stub_buffer + _buffer_limit; }
189 Stub* stub_containing(address pc) const;
190 address code_start() const { return _stub_buffer; }
191 address code_end() const { return _stub_buffer + _buffer_limit; }
192
193 // Stub allocation (atomic transactions)
194 Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code
195 Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue
196 void commit (int committed_code_size,
197 CodeStrings& strings); // commit the previously requested stub - unlocks the queue
198
199 // Stub deallocation
200 void remove_first(); // remove the first stub in the queue
201 void remove_first(int n); // remove the first n stubs in the queue
202 void remove_all(); // remove all stubs in the queue
203
204 // Iteration
205 static void queues_do(void f(StubQueue* s)); // call f with each StubQueue
206 void stubs_do(void f(Stub* s)); // call f with all stubs
207 Stub* first() const { return number_of_stubs() > 0 ? stub_at(_queue_begin) : NULL; }
208 Stub* next(Stub* s) const { int i = index_of(s) + stub_size(s);
209 if (i == _buffer_limit) i = 0;
210 return (i == _queue_end) ? NULL : stub_at(i);
211 }
212
213 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); }
214 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); }
215
216 // Debugging/printing
217 void verify(); // verifies the stub queue
218 void print(); // prints information about the stub queue
219
220 };
221
222 #endif // SHARE_VM_CODE_STUBS_HPP
|
184 int total_space() const { return _buffer_size - 1; }
185 int available_space() const { int d = _queue_begin - _queue_end - 1; return d < 0 ? d + _buffer_size : d; }
186 int used_space() const { return total_space() - available_space(); }
187 int number_of_stubs() const { return _number_of_stubs; }
188 bool contains(address pc) const { return _stub_buffer <= pc && pc < _stub_buffer + _buffer_limit; }
189 Stub* stub_containing(address pc) const;
190 address code_start() const { return _stub_buffer; }
191 address code_end() const { return _stub_buffer + _buffer_limit; }
192
193 // Stub allocation (atomic transactions)
194 Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code
195 Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue
196 void commit (int committed_code_size,
197 CodeStrings& strings); // commit the previously requested stub - unlocks the queue
198
199 // Stub deallocation
200 void remove_first(); // remove the first stub in the queue
201 void remove_first(int n); // remove the first n stubs in the queue
202 void remove_all(); // remove all stubs in the queue
203
204 void deallocate_unused_tail(); // deallocate the unused tail of the underlying CodeBlob
205 // only used from TemplateInterpreter::initialize()
206 // Iteration
207 static void queues_do(void f(StubQueue* s)); // call f with each StubQueue
208 void stubs_do(void f(Stub* s)); // call f with all stubs
209 Stub* first() const { return number_of_stubs() > 0 ? stub_at(_queue_begin) : NULL; }
210 Stub* next(Stub* s) const { int i = index_of(s) + stub_size(s);
211 if (i == _buffer_limit) i = 0;
212 return (i == _queue_end) ? NULL : stub_at(i);
213 }
214
215 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); }
216 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); }
217
218 // Debugging/printing
219 void verify(); // verifies the stub queue
220 void print(); // prints information about the stub queue
221
222 };
223
224 #endif // SHARE_VM_CODE_STUBS_HPP
|