< prev index next >

src/share/vm/runtime/deoptimization.cpp

Print this page




 204 
 205   bool realloc_failures = false;
 206 
 207 #if defined(COMPILER2) || INCLUDE_JVMCI
 208   // Reallocate the non-escaping objects and restore their fields. Then
 209   // relock objects if synchronization on them was eliminated.
 210 #ifndef INCLUDE_JVMCI
 211   if (DoEscapeAnalysis || EliminateNestedLocks) {
 212     if (EliminateAllocations) {
 213 #endif // INCLUDE_JVMCI
 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, we don't have a result.
 225       bool save_oop_result = chunk->at(0)->scope()->return_oop() && !thread->popframe_forcing_deopt_reexecution();

 226       Handle return_value;
 227       if (save_oop_result) {
 228         // Reallocation may trigger GC. If deoptimization happened on return from
 229         // call which returns oop we need to save it since it is not in oopmap.
 230         oop result = deoptee.saved_oop_result(&map);
 231         assert(result == NULL || result->is_oop(), "must be oop");
 232         return_value = Handle(thread, result);
 233         assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
 234         if (TraceDeoptimization) {
 235           ttyLocker ttyl;
 236           tty->print_cr("SAVED OOP RESULT " INTPTR_FORMAT " in thread " INTPTR_FORMAT, p2i(result), p2i(thread));
 237         }
 238       }
 239       if (objects != NULL) {
 240         JRT_BLOCK
 241           realloc_failures = realloc_objects(thread, &deoptee, objects, THREAD);
 242         JRT_END
 243         bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci();
 244         reassign_fields(&deoptee, &map, objects, realloc_failures, skip_internal);
 245 #ifndef PRODUCT




 204 
 205   bool realloc_failures = false;
 206 
 207 #if defined(COMPILER2) || INCLUDE_JVMCI
 208   // Reallocate the non-escaping objects and restore their fields. Then
 209   // relock objects if synchronization on them was eliminated.
 210 #ifndef INCLUDE_JVMCI
 211   if (DoEscapeAnalysis || EliminateNestedLocks) {
 212     if (EliminateAllocations) {
 213 #endif // INCLUDE_JVMCI
 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


< prev index next >