annotate src/share/vm/code/stubs.hpp @ 17716:cdb71841f4bc

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents 55fb97c4c58d
children abec000618bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 8767
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_CODE_STUBS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_CODE_STUBS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
28 #include "asm/codeBuffer.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #ifdef TARGET_OS_FAMILY_linux
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 # include "os_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #ifdef TARGET_OS_FAMILY_solaris
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 # include "os_solaris.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #ifdef TARGET_OS_FAMILY_windows
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 # include "os_windows.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
39 #ifdef TARGET_OS_FAMILY_bsd
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
40 # include "os_bsd.inline.hpp"
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
41 #endif
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
42
0
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // The classes in this file provide a simple framework for the
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // management of little pieces of machine code - or stubs -
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // created on the fly and frequently discarded. In this frame-
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // work stubs are stored in a queue.
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Stub serves as abstract base class. A concrete stub
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // implementation is a subclass of Stub, implementing
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // all (non-virtual!) functions required sketched out
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // in the Stub class.
a61af66fc99e Initial load
duke
parents:
diff changeset
53 //
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // A concrete stub layout may look like this (both data
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // and code sections could be empty as well):
a61af66fc99e Initial load
duke
parents:
diff changeset
56 //
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // ________
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // stub -->| | <--+
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // | data | |
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // |________| |
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // code_begin -->| | |
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // | | |
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // | code | | size
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // | | |
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // |________| |
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // code_end -->| | |
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // | data | |
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // |________| |
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // <--+
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 class Stub VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Initialization/finalization
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
75 void initialize(int size,
8767
a5de0cc2f91c 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 6842
diff changeset
76 CodeStrings& strings) { ShouldNotCallThis(); } // called to initialize/specify the stub's size
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void finalize() { ShouldNotCallThis(); } // called before the stub is deallocated
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // General info/converters
a61af66fc99e Initial load
duke
parents:
diff changeset
80 int size() const { ShouldNotCallThis(); return 0; } // must return the size provided by initialize
a61af66fc99e Initial load
duke
parents:
diff changeset
81 static int code_size_to_size(int code_size) { ShouldNotCallThis(); return 0; } // computes the size given the code size
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // Code info
a61af66fc99e Initial load
duke
parents:
diff changeset
84 address code_begin() const { ShouldNotCallThis(); return NULL; } // points to the first byte of the code
a61af66fc99e Initial load
duke
parents:
diff changeset
85 address code_end() const { ShouldNotCallThis(); return NULL; } // points to the first byte after the code
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // Debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void verify() { ShouldNotCallThis(); } // verifies the Stub
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void print() { ShouldNotCallThis(); } // prints some information about the stub
a61af66fc99e Initial load
duke
parents:
diff changeset
90 };
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // A stub interface defines the interface between a stub queue
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // and the stubs it queues. In order to avoid a vtable and
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // (and thus the extra word) in each stub, a concrete stub
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // interface object is created and associated with a stub
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // buffer which in turn uses the stub interface to interact
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // with its stubs.
a61af66fc99e Initial load
duke
parents:
diff changeset
99 //
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // StubInterface serves as an abstract base class. A concrete
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // stub interface implementation is a subclass of StubInterface,
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // forwarding its virtual function calls to non-virtual calls
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // of the concrete stub (see also macro below). There's exactly
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // one stub interface instance required per stub queue.
a61af66fc99e Initial load
duke
parents:
diff changeset
105
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3960
diff changeset
106 class StubInterface: public CHeapObj<mtCode> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Initialization/finalization
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
109 virtual void initialize(Stub* self, int size,
8767
a5de0cc2f91c 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 6842
diff changeset
110 CodeStrings& strings) = 0; // called after creation (called twice if allocated via (request, commit))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 virtual void finalize(Stub* self) = 0; // called before deallocation
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // General info/converters
a61af66fc99e Initial load
duke
parents:
diff changeset
114 virtual int size(Stub* self) const = 0; // the total size of the stub in bytes (must be a multiple of CodeEntryAlignment)
a61af66fc99e Initial load
duke
parents:
diff changeset
115 virtual int code_size_to_size(int code_size) const = 0; // computes the total stub size in bytes given the code size in bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Code info
a61af66fc99e Initial load
duke
parents:
diff changeset
118 virtual address code_begin(Stub* self) const = 0; // points to the first code byte
a61af66fc99e Initial load
duke
parents:
diff changeset
119 virtual address code_end(Stub* self) const = 0; // points to the first byte after the code
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
122 virtual void verify(Stub* self) = 0; // verifies the stub
a61af66fc99e Initial load
duke
parents:
diff changeset
123 virtual void print(Stub* self) = 0; // prints information about the stub
a61af66fc99e Initial load
duke
parents:
diff changeset
124 };
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // DEF_STUB_INTERFACE is used to create a concrete stub interface
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // class, forwarding stub interface calls to the corresponding
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // stub calls.
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #define DEF_STUB_INTERFACE(stub) \
a61af66fc99e Initial load
duke
parents:
diff changeset
132 class stub##Interface: public StubInterface { \
a61af66fc99e Initial load
duke
parents:
diff changeset
133 private: \
a61af66fc99e Initial load
duke
parents:
diff changeset
134 static stub* cast(Stub* self) { return (stub*)self; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
135 \
a61af66fc99e Initial load
duke
parents:
diff changeset
136 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
137 /* Initialization/finalization */ \
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
138 virtual void initialize(Stub* self, int size, \
8767
a5de0cc2f91c 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 6842
diff changeset
139 CodeStrings& strings) { cast(self)->initialize(size, strings); } \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
140 virtual void finalize(Stub* self) { cast(self)->finalize(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
141 \
a61af66fc99e Initial load
duke
parents:
diff changeset
142 /* General info */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
143 virtual int size(Stub* self) const { return cast(self)->size(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
144 virtual int code_size_to_size(int code_size) const { return stub::code_size_to_size(code_size); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
145 \
a61af66fc99e Initial load
duke
parents:
diff changeset
146 /* Code info */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
147 virtual address code_begin(Stub* self) const { return cast(self)->code_begin(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
148 virtual address code_end(Stub* self) const { return cast(self)->code_end(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
149 \
a61af66fc99e Initial load
duke
parents:
diff changeset
150 /* Debugging */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
151 virtual void verify(Stub* self) { cast(self)->verify(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
152 virtual void print(Stub* self) { cast(self)->print(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
153 };
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // A StubQueue maintains a queue of stubs.
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Note: All sizes (spaces) are given in bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
158
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3960
diff changeset
159 class StubQueue: public CHeapObj<mtCode> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
160 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
162 StubInterface* _stub_interface; // the interface prototype
a61af66fc99e Initial load
duke
parents:
diff changeset
163 address _stub_buffer; // where all stubs are stored
a61af66fc99e Initial load
duke
parents:
diff changeset
164 int _buffer_size; // the buffer size in bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
165 int _buffer_limit; // the (byte) index of the actual buffer limit (_buffer_limit <= _buffer_size)
a61af66fc99e Initial load
duke
parents:
diff changeset
166 int _queue_begin; // the (byte) index of the first queue entry (word-aligned)
a61af66fc99e Initial load
duke
parents:
diff changeset
167 int _queue_end; // the (byte) index of the first entry after the queue (word-aligned)
a61af66fc99e Initial load
duke
parents:
diff changeset
168 int _number_of_stubs; // the number of buffered stubs
a61af66fc99e Initial load
duke
parents:
diff changeset
169 Mutex* const _mutex; // the lock used for a (request, commit) transaction
a61af66fc99e Initial load
duke
parents:
diff changeset
170
a61af66fc99e Initial load
duke
parents:
diff changeset
171 void check_index(int i) const { assert(0 <= i && i < _buffer_limit && i % CodeEntryAlignment == 0, "illegal index"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
172 bool is_contiguous() const { return _queue_begin <= _queue_end; }
a61af66fc99e Initial load
duke
parents:
diff changeset
173 int index_of(Stub* s) const { int i = (address)s - _stub_buffer; check_index(i); return i; }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 Stub* stub_at(int i) const { check_index(i); return (Stub*)(_stub_buffer + i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 Stub* current_stub() const { return stub_at(_queue_end); }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // Stub functionality accessed via interface
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
178 void stub_initialize(Stub* s, int size,
8767
a5de0cc2f91c 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 6842
diff changeset
179 CodeStrings& strings) { assert(size % CodeEntryAlignment == 0, "size not aligned"); _stub_interface->initialize(s, size, strings); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
180 void stub_finalize(Stub* s) { _stub_interface->finalize(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 int stub_size(Stub* s) const { return _stub_interface->size(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
182 bool stub_contains(Stub* s, address pc) const { return _stub_interface->code_begin(s) <= pc && pc < _stub_interface->code_end(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
183 int stub_code_size_to_size(int code_size) const { return _stub_interface->code_size_to_size(code_size); }
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void stub_verify(Stub* s) { _stub_interface->verify(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
185 void stub_print(Stub* s) { _stub_interface->print(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 static void register_queue(StubQueue*);
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
190 StubQueue(StubInterface* stub_interface, int buffer_size, Mutex* lock,
a61af66fc99e Initial load
duke
parents:
diff changeset
191 const char* name);
a61af66fc99e Initial load
duke
parents:
diff changeset
192 ~StubQueue();
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 // General queue info
a61af66fc99e Initial load
duke
parents:
diff changeset
195 bool is_empty() const { return _queue_begin == _queue_end; }
a61af66fc99e Initial load
duke
parents:
diff changeset
196 int total_space() const { return _buffer_size - 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
197 int available_space() const { int d = _queue_begin - _queue_end - 1; return d < 0 ? d + _buffer_size : d; }
a61af66fc99e Initial load
duke
parents:
diff changeset
198 int used_space() const { return total_space() - available_space(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 int number_of_stubs() const { return _number_of_stubs; }
a61af66fc99e Initial load
duke
parents:
diff changeset
200 bool contains(address pc) const { return _stub_buffer <= pc && pc < _stub_buffer + _buffer_limit; }
a61af66fc99e Initial load
duke
parents:
diff changeset
201 Stub* stub_containing(address pc) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
202 address code_start() const { return _stub_buffer; }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 address code_end() const { return _stub_buffer + _buffer_limit; }
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 // Stub allocation (atomic transactions)
a61af66fc99e Initial load
duke
parents:
diff changeset
206 Stub* request_committed(int code_size); // request a stub that provides exactly code_size space for code
a61af66fc99e Initial load
duke
parents:
diff changeset
207 Stub* request(int requested_code_size); // request a stub with a (maximum) code space - locks the queue
6796
b31471cdc53e 7200163: add CodeComments functionality to assember stubs
kvn
parents: 6197
diff changeset
208 void commit (int committed_code_size,
8767
a5de0cc2f91c 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 6842
diff changeset
209 CodeStrings& strings); // commit the previously requested stub - unlocks the queue
0
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 // Stub deallocation
a61af66fc99e Initial load
duke
parents:
diff changeset
212 void remove_first(); // remove the first stub in the queue
a61af66fc99e Initial load
duke
parents:
diff changeset
213 void remove_first(int n); // remove the first n stubs in the queue
a61af66fc99e Initial load
duke
parents:
diff changeset
214 void remove_all(); // remove all stubs in the queue
a61af66fc99e Initial load
duke
parents:
diff changeset
215
a61af66fc99e Initial load
duke
parents:
diff changeset
216 // Iteration
a61af66fc99e Initial load
duke
parents:
diff changeset
217 static void queues_do(void f(StubQueue* s)); // call f with each StubQueue
a61af66fc99e Initial load
duke
parents:
diff changeset
218 void stubs_do(void f(Stub* s)); // call f with all stubs
a61af66fc99e Initial load
duke
parents:
diff changeset
219 Stub* first() const { return number_of_stubs() > 0 ? stub_at(_queue_begin) : NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
220 Stub* next(Stub* s) const { int i = index_of(s) + stub_size(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 if (i == _buffer_limit) i = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
222 return (i == _queue_end) ? NULL : stub_at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 address stub_code_begin(Stub* s) const { return _stub_interface->code_begin(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
226 address stub_code_end(Stub* s) const { return _stub_interface->code_end(s); }
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 // Debugging/printing
a61af66fc99e Initial load
duke
parents:
diff changeset
229 void verify(); // verifies the stub queue
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void print(); // prints information about the stub queue
a61af66fc99e Initial load
duke
parents:
diff changeset
231 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
232
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
233 #endif // SHARE_VM_CODE_STUBS_HPP