1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
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 *
245 guarantee(_buffer_limit == _buffer_size, "_buffer_limit must equal _buffer_size");
246 }
247 // verify contents
248 int n = 0;
249 for (Stub* s = first(); s != NULL; s = next(s)) {
250 stub_verify(s);
251 n++;
252 }
253 guarantee(n == number_of_stubs(), "number of stubs inconsistent");
254 guarantee(_queue_begin != _queue_end || n == 0, "buffer indices must be the same");
255 }
256
257
258 void StubQueue::print() {
259 MutexLockerEx lock(_mutex);
260 for (Stub* s = first(); s != NULL; s = next(s)) {
261 stub_print(s);
262 }
263 }
264
265 // Fixup for pregenerated code
266 void StubQueue::fix_buffer(address buffer, address queue_end, address buffer_end, int number_of_stubs) {
267 const int extra_bytes = CodeEntryAlignment;
268 _stub_buffer = buffer;
269 _queue_begin = 0;
270 _queue_end = queue_end - buffer;
271 _number_of_stubs = number_of_stubs;
272 int size = buffer_end - buffer;
273 // Note: _buffer_limit must differ from _queue_end in the iteration loops
274 // => add extra space at the end (preserving alignment for asserts) if needed
275 if (buffer_end == queue_end) size += extra_bytes;
276 _buffer_limit = _buffer_size = size;
277 }
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
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 *
245 guarantee(_buffer_limit == _buffer_size, "_buffer_limit must equal _buffer_size");
246 }
247 // verify contents
248 int n = 0;
249 for (Stub* s = first(); s != NULL; s = next(s)) {
250 stub_verify(s);
251 n++;
252 }
253 guarantee(n == number_of_stubs(), "number of stubs inconsistent");
254 guarantee(_queue_begin != _queue_end || n == 0, "buffer indices must be the same");
255 }
256
257
258 void StubQueue::print() {
259 MutexLockerEx lock(_mutex);
260 for (Stub* s = first(); s != NULL; s = next(s)) {
261 stub_print(s);
262 }
263 }
264
|