196 // If the previous frame was popped, we don't have a result.
197 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution();
198 Handle return_value;
199 if (save_oop_result) {
200 // Reallocation may trigger GC. If deoptimization happened on return from
201 // call which returns oop we need to save it since it is not in oopmap.
202 oop result = deoptee.saved_oop_result(&map);
203 assert(result == NULL || result->is_oop(), "must be oop");
204 return_value = Handle(thread, result);
205 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
206 if (TraceDeoptimization) {
207 ttyLocker ttyl;
208 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread);
209 }
210 }
211 if (objects != NULL) {
212 JRT_BLOCK
213 realloc_failures = realloc_objects(thread, &deoptee, objects, THREAD);
214 JRT_END
215 reassign_fields(&deoptee, &map, objects, realloc_failures);
216 }
217 #ifndef PRODUCT
218 if (TraceDeoptimization) {
219 ttyLocker ttyl;
220 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread);
221 print_objects(objects, realloc_failures);
222 }
223 #endif
224 if (save_oop_result) {
225 // Restore result.
226 deoptee.set_saved_oop_result(&map, return_value());
227 }
228 }
229 if (EliminateLocks) {
230 #ifndef PRODUCT
231 bool first = true;
232 #endif
233 for (int i = 0; i < chunk->length(); i++) {
234 compiledVFrame* cvf = chunk->at(i);
235 assert (cvf->scope() != NULL,"expect only compiled java frames");
236 GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
237 if (monitors->is_nonempty()) {
238 relock_objects(monitors, thread, realloc_failures);
239 #ifndef PRODUCT
240 if (TraceDeoptimization) {
241 ttyLocker ttyl;
242 for (int j = 0; j < monitors->length(); j++) {
243 MonitorInfo* mi = monitors->at(j);
|
196 // If the previous frame was popped, we don't have a result.
197 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution();
198 Handle return_value;
199 if (save_oop_result) {
200 // Reallocation may trigger GC. If deoptimization happened on return from
201 // call which returns oop we need to save it since it is not in oopmap.
202 oop result = deoptee.saved_oop_result(&map);
203 assert(result == NULL || result->is_oop(), "must be oop");
204 return_value = Handle(thread, result);
205 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
206 if (TraceDeoptimization) {
207 ttyLocker ttyl;
208 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, (void *)result, thread);
209 }
210 }
211 if (objects != NULL) {
212 JRT_BLOCK
213 realloc_failures = realloc_objects(thread, &deoptee, objects, THREAD);
214 JRT_END
215 reassign_fields(&deoptee, &map, objects, realloc_failures);
216 #ifndef PRODUCT
217 if (TraceDeoptimization) {
218 ttyLocker ttyl;
219 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, thread);
220 print_objects(objects, realloc_failures);
221 }
222 #endif
223 }
224 if (save_oop_result) {
225 // Restore result.
226 deoptee.set_saved_oop_result(&map, return_value());
227 }
228 }
229 if (EliminateLocks) {
230 #ifndef PRODUCT
231 bool first = true;
232 #endif
233 for (int i = 0; i < chunk->length(); i++) {
234 compiledVFrame* cvf = chunk->at(i);
235 assert (cvf->scope() != NULL,"expect only compiled java frames");
236 GrowableArray<MonitorInfo*>* monitors = cvf->monitors();
237 if (monitors->is_nonempty()) {
238 relock_objects(monitors, thread, realloc_failures);
239 #ifndef PRODUCT
240 if (TraceDeoptimization) {
241 ttyLocker ttyl;
242 for (int j = 0; j < monitors->length(); j++) {
243 MonitorInfo* mi = monitors->at(j);
|