98 inline ~SafepointOp() { // reload oops
99 _cont._continuation = _conth();
100 _cont._tail = jdk_internal_vm_Continuation::tail(_cont._continuation);
101 _cont.disallow_safepoint();
102 }
103 };
104
105 public:
106 ~ContinuationWrapper() { allow_safepoint(); }
107
108 ContinuationWrapper(JavaThread* thread, oop continuation);
109 ContinuationWrapper(oop continuation);
110 ContinuationWrapper(const RegisterMap* map);
111
112 JavaThread* thread() const { return _thread; }
113 oop continuation() { return _continuation; }
114 stackChunkOop tail() const { return _tail; }
115 void set_tail(stackChunkOop chunk) { _tail = chunk; }
116
117 inline bool is_preempted();
118 inline void read();
119 inline void write();
120
121 NOT_PRODUCT(intptr_t hash();)
122
123 ContinuationEntry* entry() const { return _entry; }
124 bool is_mounted() const { return _entry != nullptr; }
125 intptr_t* entrySP() const { return _entry->entry_sp(); }
126 intptr_t* entryFP() const { return _entry->entry_fp(); }
127 address entryPC() const { return _entry->entry_pc(); }
128 int argsize() const { assert(_entry->argsize() >= 0, ""); return _entry->argsize(); }
129 int entry_frame_extension() const {
130 // the entry frame is extended if the bottom frame has stack arguments
131 assert(_entry->argsize() >= 0, "");
132 return _entry->argsize() == 0 ? _entry->argsize() : _entry->argsize() + frame::metadata_words_at_top;
133 }
134 void set_argsize(int value) { _entry->set_argsize(value); }
135
136 bool is_empty() const { return last_nonempty_chunk() == nullptr; }
137 const frame last_frame();
146 };
147
148 inline ContinuationWrapper::ContinuationWrapper(JavaThread* thread, ContinuationEntry* entry, oop continuation)
149 : _thread(thread), _entry(entry), _continuation(continuation), _done(false) {
150 assert(oopDesc::is_oop(_continuation),
151 "Invalid continuation object: " INTPTR_FORMAT, p2i((void*)_continuation));
152 disallow_safepoint();
153 read();
154 }
155
156 inline ContinuationWrapper::ContinuationWrapper(JavaThread* thread, oop continuation)
157 : ContinuationWrapper(thread, thread->last_continuation(), continuation) {}
158
159 inline ContinuationWrapper::ContinuationWrapper(oop continuation)
160 : ContinuationWrapper(nullptr, nullptr, continuation) {}
161
162 inline bool ContinuationWrapper::is_preempted() {
163 return jdk_internal_vm_Continuation::is_preempted(_continuation);
164 }
165
166 inline void ContinuationWrapper::read() {
167 _tail = jdk_internal_vm_Continuation::tail(_continuation);
168 }
169
170 inline void ContinuationWrapper::write() {
171 assert(oopDesc::is_oop(_continuation), "bad oop");
172 assert(oopDesc::is_oop_or_null(_tail), "bad oop");
173 jdk_internal_vm_Continuation::set_tail(_continuation, _tail);
174 }
175
176 inline stackChunkOop ContinuationWrapper::last_nonempty_chunk() const {
177 assert(chunk_invariant(), "");
178 stackChunkOop chunk = _tail;
179 if (chunk != nullptr && chunk->is_empty()) {
180 chunk = chunk->parent();
181 }
182 assert(chunk == nullptr || !chunk->is_empty(), "");
183 return chunk;
184 }
185
|
98 inline ~SafepointOp() { // reload oops
99 _cont._continuation = _conth();
100 _cont._tail = jdk_internal_vm_Continuation::tail(_cont._continuation);
101 _cont.disallow_safepoint();
102 }
103 };
104
105 public:
106 ~ContinuationWrapper() { allow_safepoint(); }
107
108 ContinuationWrapper(JavaThread* thread, oop continuation);
109 ContinuationWrapper(oop continuation);
110 ContinuationWrapper(const RegisterMap* map);
111
112 JavaThread* thread() const { return _thread; }
113 oop continuation() { return _continuation; }
114 stackChunkOop tail() const { return _tail; }
115 void set_tail(stackChunkOop chunk) { _tail = chunk; }
116
117 inline bool is_preempted();
118 inline void set_preempted(bool value);
119 inline void read();
120 inline void write();
121
122 NOT_PRODUCT(intptr_t hash();)
123
124 ContinuationEntry* entry() const { return _entry; }
125 bool is_mounted() const { return _entry != nullptr; }
126 intptr_t* entrySP() const { return _entry->entry_sp(); }
127 intptr_t* entryFP() const { return _entry->entry_fp(); }
128 address entryPC() const { return _entry->entry_pc(); }
129 int argsize() const { assert(_entry->argsize() >= 0, ""); return _entry->argsize(); }
130 int entry_frame_extension() const {
131 // the entry frame is extended if the bottom frame has stack arguments
132 assert(_entry->argsize() >= 0, "");
133 return _entry->argsize() == 0 ? _entry->argsize() : _entry->argsize() + frame::metadata_words_at_top;
134 }
135 void set_argsize(int value) { _entry->set_argsize(value); }
136
137 bool is_empty() const { return last_nonempty_chunk() == nullptr; }
138 const frame last_frame();
147 };
148
149 inline ContinuationWrapper::ContinuationWrapper(JavaThread* thread, ContinuationEntry* entry, oop continuation)
150 : _thread(thread), _entry(entry), _continuation(continuation), _done(false) {
151 assert(oopDesc::is_oop(_continuation),
152 "Invalid continuation object: " INTPTR_FORMAT, p2i((void*)_continuation));
153 disallow_safepoint();
154 read();
155 }
156
157 inline ContinuationWrapper::ContinuationWrapper(JavaThread* thread, oop continuation)
158 : ContinuationWrapper(thread, thread->last_continuation(), continuation) {}
159
160 inline ContinuationWrapper::ContinuationWrapper(oop continuation)
161 : ContinuationWrapper(nullptr, nullptr, continuation) {}
162
163 inline bool ContinuationWrapper::is_preempted() {
164 return jdk_internal_vm_Continuation::is_preempted(_continuation);
165 }
166
167 inline void ContinuationWrapper::set_preempted(bool value) {
168 jdk_internal_vm_Continuation::set_preempted(_continuation, value);
169 }
170
171 inline void ContinuationWrapper::read() {
172 _tail = jdk_internal_vm_Continuation::tail(_continuation);
173 }
174
175 inline void ContinuationWrapper::write() {
176 assert(oopDesc::is_oop(_continuation), "bad oop");
177 assert(oopDesc::is_oop_or_null(_tail), "bad oop");
178 jdk_internal_vm_Continuation::set_tail(_continuation, _tail);
179 }
180
181 inline stackChunkOop ContinuationWrapper::last_nonempty_chunk() const {
182 assert(chunk_invariant(), "");
183 stackChunkOop chunk = _tail;
184 if (chunk != nullptr && chunk->is_empty()) {
185 chunk = chunk->parent();
186 }
187 assert(chunk == nullptr || !chunk->is_empty(), "");
188 return chunk;
189 }
190
|