< prev index next >

src/hotspot/share/runtime/continuationEntry.cpp

Print this page

 24 
 25 #include "code/compiledIC.hpp"
 26 #include "code/nmethod.hpp"
 27 #include "oops/method.inline.hpp"
 28 #include "runtime/continuation.hpp"
 29 #include "runtime/continuationEntry.inline.hpp"
 30 #include "runtime/continuationHelper.inline.hpp"
 31 #include "runtime/frame.inline.hpp"
 32 #include "runtime/javaThread.hpp"
 33 #include "runtime/stackFrameStream.inline.hpp"
 34 #include "runtime/stackWatermarkSet.inline.hpp"
 35 #include "runtime/stubRoutines.hpp"
 36 
 37 int ContinuationEntry::_return_pc_offset = 0;
 38 int ContinuationEntry::_thaw_call_pc_offset = 0;
 39 int ContinuationEntry::_cleanup_offset = 0;
 40 address ContinuationEntry::_return_pc = nullptr;
 41 address ContinuationEntry::_thaw_call_pc = nullptr;
 42 address ContinuationEntry::_cleanup_pc = nullptr;
 43 nmethod* ContinuationEntry::_enter_special = nullptr;

 44 int ContinuationEntry::_interpreted_entry_offset = 0;
 45 
 46 void ContinuationEntry::set_enter_code(nmethod* nm, int interpreted_entry_offset) {
 47   assert(_return_pc_offset != 0, "");

 48   _return_pc = nm->code_begin() + _return_pc_offset;
 49   _thaw_call_pc = nm->code_begin() + _thaw_call_pc_offset;
 50   _cleanup_pc = nm->code_begin() + _cleanup_offset;
 51 
 52   _enter_special = nm;
 53   _interpreted_entry_offset = interpreted_entry_offset;
 54 
 55   assert(_enter_special->code_contains(compiled_entry()),    "entry not in enterSpecial");
 56   assert(_enter_special->code_contains(interpreted_entry()), "entry not in enterSpecial");
 57   assert(interpreted_entry() < compiled_entry(), "unexpected code layout");
 58 }
 59 




 60 address ContinuationEntry::compiled_entry() {
 61   return _enter_special->verified_entry_point();
 62 }
 63 
 64 address ContinuationEntry::interpreted_entry() {
 65   return _enter_special->code_begin() + _interpreted_entry_offset;
 66 }
 67 
 68 bool ContinuationEntry::is_interpreted_call(address call_address) {
 69   assert(_enter_special->code_contains(call_address), "call not in enterSpecial");
 70   assert(call_address >= interpreted_entry(), "unexpected location");
 71   return call_address < compiled_entry();
 72 }
 73 
 74 ContinuationEntry* ContinuationEntry::from_frame(const frame& f) {
 75   assert(Continuation::is_continuation_enterSpecial(f), "");
 76   return (ContinuationEntry*)f.unextended_sp();
 77 }
 78 
 79 NOINLINE static void flush_stack_processing(JavaThread* thread, intptr_t* sp) {

 95 
 96 void ContinuationEntry::flush_stack_processing(JavaThread* thread) const {
 97   maybe_flush_stack_processing(thread, (intptr_t*)((uintptr_t)entry_sp() + ContinuationEntry::size()));
 98 }
 99 
100 #ifndef PRODUCT
101 void ContinuationEntry::describe(FrameValues& values, int frame_no) const {
102   address usp = (address)this;
103   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_offset())),    "parent");
104   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::cont_offset())),      "continuation");
105   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::flags_offset())),     "flags");
106   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::chunk_offset())),     "chunk");
107   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::argsize_offset())),   "argsize");
108   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::pin_count_offset())), "pin_count");
109   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_cont_fastpath_offset())),      "parent fastpath");
110   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_held_monitor_count_offset())), "parent held monitor count");
111 }
112 #endif
113 
114 #ifdef ASSERT
115 bool ContinuationEntry::assert_entry_frame_laid_out(JavaThread* thread) {
116   assert(thread->has_last_Java_frame(), "Wrong place to use this assertion");
117 


118   ContinuationEntry* entry = thread->last_continuation();
119   assert(entry != nullptr, "");
120 
121   intptr_t* unextended_sp = entry->entry_sp();
122   intptr_t* sp;
123   if (entry->argsize() > 0) {
124     sp = entry->bottom_sender_sp();
125   } else {
126     sp = unextended_sp;
127     bool interpreted_bottom = false;
128     RegisterMap map(thread,
129                     RegisterMap::UpdateMap::skip,
130                     RegisterMap::ProcessFrames::skip,
131                     RegisterMap::WalkContinuation::skip);
132     frame f;
133     for (f = thread->last_frame();
134          !f.is_first_frame() && f.sp() <= unextended_sp && !Continuation::is_continuation_enterSpecial(f);
135          f = f.sender(&map)) {
136       interpreted_bottom = f.is_interpreted_frame();
137     }

 24 
 25 #include "code/compiledIC.hpp"
 26 #include "code/nmethod.hpp"
 27 #include "oops/method.inline.hpp"
 28 #include "runtime/continuation.hpp"
 29 #include "runtime/continuationEntry.inline.hpp"
 30 #include "runtime/continuationHelper.inline.hpp"
 31 #include "runtime/frame.inline.hpp"
 32 #include "runtime/javaThread.hpp"
 33 #include "runtime/stackFrameStream.inline.hpp"
 34 #include "runtime/stackWatermarkSet.inline.hpp"
 35 #include "runtime/stubRoutines.hpp"
 36 
 37 int ContinuationEntry::_return_pc_offset = 0;
 38 int ContinuationEntry::_thaw_call_pc_offset = 0;
 39 int ContinuationEntry::_cleanup_offset = 0;
 40 address ContinuationEntry::_return_pc = nullptr;
 41 address ContinuationEntry::_thaw_call_pc = nullptr;
 42 address ContinuationEntry::_cleanup_pc = nullptr;
 43 nmethod* ContinuationEntry::_enter_special = nullptr;
 44 nmethod* ContinuationEntry::_do_yield = nullptr;
 45 int ContinuationEntry::_interpreted_entry_offset = 0;
 46 
 47 void ContinuationEntry::set_enter_code(nmethod* nm, int interpreted_entry_offset) {
 48   assert(_return_pc_offset != 0, "");
 49   assert(_thaw_call_pc_offset != 0, "");
 50   _return_pc = nm->code_begin() + _return_pc_offset;
 51   _thaw_call_pc = nm->code_begin() + _thaw_call_pc_offset;
 52   _cleanup_pc = nm->code_begin() + _cleanup_offset;
 53 
 54   _enter_special = nm;
 55   _interpreted_entry_offset = interpreted_entry_offset;
 56 
 57   assert(_enter_special->code_contains(compiled_entry()),    "entry not in enterSpecial");
 58   assert(_enter_special->code_contains(interpreted_entry()), "entry not in enterSpecial");
 59   assert(interpreted_entry() < compiled_entry(), "unexpected code layout");
 60 }
 61 
 62 void ContinuationEntry::set_yield_code(nmethod* nm) {
 63   _do_yield = nm;
 64 }
 65 
 66 address ContinuationEntry::compiled_entry() {
 67   return _enter_special->verified_entry_point();
 68 }
 69 
 70 address ContinuationEntry::interpreted_entry() {
 71   return _enter_special->code_begin() + _interpreted_entry_offset;
 72 }
 73 
 74 bool ContinuationEntry::is_interpreted_call(address call_address) {
 75   assert(_enter_special->code_contains(call_address), "call not in enterSpecial");
 76   assert(call_address >= interpreted_entry(), "unexpected location");
 77   return call_address < compiled_entry();
 78 }
 79 
 80 ContinuationEntry* ContinuationEntry::from_frame(const frame& f) {
 81   assert(Continuation::is_continuation_enterSpecial(f), "");
 82   return (ContinuationEntry*)f.unextended_sp();
 83 }
 84 
 85 NOINLINE static void flush_stack_processing(JavaThread* thread, intptr_t* sp) {

101 
102 void ContinuationEntry::flush_stack_processing(JavaThread* thread) const {
103   maybe_flush_stack_processing(thread, (intptr_t*)((uintptr_t)entry_sp() + ContinuationEntry::size()));
104 }
105 
106 #ifndef PRODUCT
107 void ContinuationEntry::describe(FrameValues& values, int frame_no) const {
108   address usp = (address)this;
109   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_offset())),    "parent");
110   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::cont_offset())),      "continuation");
111   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::flags_offset())),     "flags");
112   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::chunk_offset())),     "chunk");
113   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::argsize_offset())),   "argsize");
114   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::pin_count_offset())), "pin_count");
115   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_cont_fastpath_offset())),      "parent fastpath");
116   values.describe(frame_no, (intptr_t*)(usp + in_bytes(ContinuationEntry::parent_held_monitor_count_offset())), "parent held monitor count");
117 }
118 #endif
119 
120 #ifdef ASSERT
121 bool ContinuationEntry::assert_entry_frame_laid_out(JavaThread* thread, bool preempted) {
122   assert(thread->has_last_Java_frame(), "Wrong place to use this assertion");
123 
124   if (preempted) return true;
125 
126   ContinuationEntry* entry = thread->last_continuation();
127   assert(entry != nullptr, "");
128 
129   intptr_t* unextended_sp = entry->entry_sp();
130   intptr_t* sp;
131   if (entry->argsize() > 0) {
132     sp = entry->bottom_sender_sp();
133   } else {
134     sp = unextended_sp;
135     bool interpreted_bottom = false;
136     RegisterMap map(thread,
137                     RegisterMap::UpdateMap::skip,
138                     RegisterMap::ProcessFrames::skip,
139                     RegisterMap::WalkContinuation::skip);
140     frame f;
141     for (f = thread->last_frame();
142          !f.is_first_frame() && f.sp() <= unextended_sp && !Continuation::is_continuation_enterSpecial(f);
143          f = f.sender(&map)) {
144       interpreted_bottom = f.is_interpreted_frame();
145     }
< prev index next >