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 #ifndef SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
26 #define SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
27
28 #include "runtime/continuationHelper.hpp"
29
30 #include "code/scopeDesc.hpp"
31 #include "compiler/oopMap.hpp"
32 #include "compiler/oopMap.inline.hpp"
33 #include "interpreter/oopMapCache.hpp"
34 #include "runtime/frame.inline.hpp"
35 #include "runtime/stackValue.hpp"
36 #include "utilities/macros.hpp"
37
38 #include CPU_HEADER_INLINE(continuationHelper)
39
40 #ifndef CPU_OVERRIDES_RETURN_ADDRESS_ACCESSORS
41 inline address ContinuationHelper::return_address_at(intptr_t* sp) {
42 return *(address*)sp;
43 }
44
45 inline void ContinuationHelper::patch_return_address_at(intptr_t* sp,
46 address pc) {
47 *(address*)sp = pc;
48 }
49 #endif // !CPU_OVERRIDES_RETURN_ADDRESS_ACCESSORS
50
51 inline bool ContinuationHelper::NonInterpretedUnknownFrame::is_instance(const frame& f) {
52 return !f.is_interpreted_frame();
53 }
54
55 inline bool ContinuationHelper::Frame::is_stub(CodeBlob* cb) {
56 return cb != nullptr && (cb->is_safepoint_stub() || cb->is_runtime_stub());
57 }
58
59 inline Method* ContinuationHelper::Frame::frame_method(const frame& f) {
60 return f.is_interpreted_frame() ? f.interpreter_frame_method() : f.cb()->as_nmethod()->method();
61 }
62
63 inline address ContinuationHelper::Frame::return_pc(const frame& f) {
64 return return_address_at((intptr_t *)return_pc_address(f));
65 }
66
67 #ifdef ASSERT
68 inline intptr_t* ContinuationHelper::Frame::frame_top(const frame &f) {
69 if (f.is_interpreted_frame()) {
70 ResourceMark rm;
71 InterpreterOopMap mask;
72 f.interpreted_frame_oop_map(&mask);
73 return InterpretedFrame::frame_top(f, &mask);
74 } else {
75 return CompiledFrame::frame_top(f);
76 }
178 }
179
180 for (int index = (mons->length()-1); index >= 0; index--) { // see compiledVFrame::monitors()
181 MonitorValue* mon = mons->at(index);
182 if (mon->eliminated()) {
183 continue; // we ignore scalar-replaced monitors
184 }
185 ScopeValue* ov = mon->owner();
186 StackValue* owner_sv = StackValue::create_stack_value(&f, map, ov); // it is an oop
187 oop owner = owner_sv->get_obj()();
188 if (owner != nullptr) {
189 //assert(nm->has_monitors(), "");
190 return true;
191 }
192 }
193 }
194 return false;
195 }
196 #endif
197
198 inline bool ContinuationHelper::StubFrame::is_instance(const frame& f) {
199 return !f.is_interpreted_frame() && is_stub(f.cb());
200 }
201
202 #endif // SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
|
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 #ifndef SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
26 #define SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
27
28 #include "runtime/continuationHelper.hpp"
29
30 #include "code/scopeDesc.hpp"
31 #include "compiler/oopMap.hpp"
32 #include "compiler/oopMap.inline.hpp"
33 #include "interpreter/oopMapCache.hpp"
34 #include "runtime/frame.inline.hpp"
35 #include "runtime/objectMonitor.hpp"
36 #include "runtime/stackValue.hpp"
37 #include "runtime/synchronizer.hpp"
38 #include "utilities/macros.hpp"
39
40 #include CPU_HEADER_INLINE(continuationHelper)
41
42 #ifndef CPU_OVERRIDES_RETURN_ADDRESS_ACCESSORS
43 inline address ContinuationHelper::return_address_at(intptr_t* sp) {
44 return *(address*)sp;
45 }
46
47 inline void ContinuationHelper::patch_return_address_at(intptr_t* sp,
48 address pc) {
49 *(address*)sp = pc;
50 }
51 #endif // !CPU_OVERRIDES_RETURN_ADDRESS_ACCESSORS
52
53 inline bool ContinuationHelper::NonInterpretedUnknownFrame::is_instance(const frame& f) {
54 return !f.is_interpreted_frame();
55 }
56
57 inline bool ContinuationHelper::Frame::is_stub(CodeBlob* cb) {
58 return cb != nullptr && cb->is_runtime_stub();
59 }
60
61 inline Method* ContinuationHelper::Frame::frame_method(const frame& f) {
62 return f.is_interpreted_frame() ? f.interpreter_frame_method() : f.cb()->as_nmethod()->method();
63 }
64
65 inline address ContinuationHelper::Frame::return_pc(const frame& f) {
66 return return_address_at((intptr_t *)return_pc_address(f));
67 }
68
69 #ifdef ASSERT
70 inline intptr_t* ContinuationHelper::Frame::frame_top(const frame &f) {
71 if (f.is_interpreted_frame()) {
72 ResourceMark rm;
73 InterpreterOopMap mask;
74 f.interpreted_frame_oop_map(&mask);
75 return InterpretedFrame::frame_top(f, &mask);
76 } else {
77 return CompiledFrame::frame_top(f);
78 }
180 }
181
182 for (int index = (mons->length()-1); index >= 0; index--) { // see compiledVFrame::monitors()
183 MonitorValue* mon = mons->at(index);
184 if (mon->eliminated()) {
185 continue; // we ignore scalar-replaced monitors
186 }
187 ScopeValue* ov = mon->owner();
188 StackValue* owner_sv = StackValue::create_stack_value(&f, map, ov); // it is an oop
189 oop owner = owner_sv->get_obj()();
190 if (owner != nullptr) {
191 //assert(nm->has_monitors(), "");
192 return true;
193 }
194 }
195 }
196 return false;
197 }
198 #endif
199
200 inline bool ContinuationHelper::NativeFrame::is_instance(const frame& f) {
201 return f.is_native_frame();
202 }
203
204 #ifdef ASSERT
205 inline bool ContinuationHelper::NativeFrame::is_owning_locks(JavaThread* thread, const frame& f) {
206 assert(NativeFrame::is_instance(f), "");
207
208 Method* method = f.cb()->as_nmethod()->method();
209 if (!method->is_synchronized()) {
210 return false;
211 } else {
212 // Just verify we are actually the owner
213 oop synced_obj = f.get_native_receiver();
214 assert(ObjectSynchronizer::current_thread_holds_lock(thread, Handle(thread, synced_obj)), "must be owner");
215 return true;
216 }
217 }
218 #endif
219
220 inline bool ContinuationHelper::StubFrame::is_instance(const frame& f) {
221 return !f.is_interpreted_frame() && is_stub(f.cb());
222 }
223
224 #endif // SHARE_VM_RUNTIME_CONTINUATIONHELPER_INLINE_HPP
|