214 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
215 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
216
217 // The flag return_oop() indicates call sites which return oop
218 // in compiled code. Such sites include java method calls,
219 // runtime calls (for example, used to allocate new objects/arrays
220 // on slow code path) and any other calls generated in compiled code.
221 // It is not guaranteed that we can get such information here only
222 // by analyzing bytecode in deoptimized frames. This is why this flag
223 // is set during method compilation (see Compile::Process_OopMap_Node()).
224 // If the previous frame was popped or if we are dispatching an exception,
225 // we don't have an oop result.
226 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution() && (exec_mode == Unpack_deopt);
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 bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
245 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
246 #ifndef PRODUCT
247 if (TraceDeoptimization) {
248 ttyLocker ttyl;
249 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
250 print_objects(objects, realloc_failures);
251 }
252 #endif
253 }
254 if (save_oop_result) {
|
214 assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames");
215 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects();
216
217 // The flag return_oop() indicates call sites which return oop
218 // in compiled code. Such sites include java method calls,
219 // runtime calls (for example, used to allocate new objects/arrays
220 // on slow code path) and any other calls generated in compiled code.
221 // It is not guaranteed that we can get such information here only
222 // by analyzing bytecode in deoptimized frames. This is why this flag
223 // is set during method compilation (see Compile::Process_OopMap_Node()).
224 // If the previous frame was popped or if we are dispatching an exception,
225 // we don't have an oop result.
226 bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution() && (exec_mode == Unpack_deopt);
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 bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
245 reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
246 #ifndef PRODUCT
247 if (TraceDeoptimization) {
248 ttyLocker ttyl;
249 tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
250 print_objects(objects, realloc_failures);
251 }
252 #endif
253 }
254 if (save_oop_result) {
|