< prev index next >

src/share/vm/runtime/deoptimization.cpp

Print this page




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




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


< prev index next >