214 #endif // INCLUDE_JVMCI
215 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
216 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
217
218 // The flag return_oop() indicates call sites which return oop
219 // in compiled code. Such sites include java method calls,
220 // runtime calls (for example, used to allocate new objects/arrays
221 // on slow code path) and any other calls generated in compiled code.
222 // It is not guaranteed that we can get such information here only
223 // by analyzing bytecode in deoptimized frames. This is why this flag
224 // is set during method compilation (see Compile::Process_OopMap_Node()).
225 // If the previous frame was popped, we don't have a result.
226 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution();
227 Handle return_value;
228 if (save_oop_result) {
229 // Reallocation may trigger GC. If deoptimization happened on return from
230 // call which returns oop we need to save it since it is not in oopmap.
231 oop result = deoptee.saved_oop_result(&map);
232 assert(result == NULL || result->is_oop(), "must be oop");
233 return_value = Handle(thread, result);
234 assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
235 if (TraceDeoptimization) {
236 ttyLocker ttyl;
237 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread));
238 }
239 }
240 if (objects != NULL) {
241 JRT_BLOCK
242 realloc_failures = realloc_objects(thread, &deoptee, objects, THREAD);
243 JRT_END
244 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
245 #ifndef PRODUCT
246 if (TraceDeoptimization) {
247 ttyLocker ttyl;
248 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
249 print_objects(objects, realloc_failures);
250 }
251 #endif
252 }
253 if (save_oop_result) {
254 // Restore result.
|
214 #endif // INCLUDE_JVMCI
215 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
216 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
217
218 // The flag return_oop() indicates call sites which return oop
219 // in compiled code. Such sites include java method calls,
220 // runtime calls (for example, used to allocate new objects/arrays
221 // on slow code path) and any other calls generated in compiled code.
222 // It is not guaranteed that we can get such information here only
223 // by analyzing bytecode in deoptimized frames. This is why this flag
224 // is set during method compilation (see Compile::Process_OopMap_Node()).
225 // If the previous frame was popped, we don't have a result.
226 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution();
227 Handle return_value;
228 if (save_oop_result) {
229 // Reallocation may trigger GC. If deoptimization happened on return from
230 // call which returns oop we need to save it since it is not in oopmap.
231 oop result = deoptee.saved_oop_result(&map);
232 assert(result == NULL || result->is_oop(), "must be oop");
233 return_value = Handle(thread, result);
234 assert(GC::gc()->heap()->is_in_or_null(result), "must be heap pointer");
235 if (TraceDeoptimization) {
236 ttyLocker ttyl;
237 tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread));
238 }
239 }
240 if (objects != NULL) {
241 JRT_BLOCK
242 realloc_failures = realloc_objects(thread, &deoptee, objects, THREAD);
243 JRT_END
244 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
245 #ifndef PRODUCT
246 if (TraceDeoptimization) {
247 ttyLocker ttyl;
248 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
249 print_objects(objects, realloc_failures);
250 }
251 #endif
252 }
253 if (save_oop_result) {
254 // Restore result.
|