< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page
rev 56101 : 8227745: Enable Escape Analysis for better performance when debugging
Reviewed-by: ???


1236         if (methods == NULL || matches(methods, cvf->method(), JVMCIENV)) {
1237           if (initialSkip > 0) {
1238             initialSkip--;
1239           } else {
1240             ScopeDesc* scope = cvf->scope();
1241             // native wrappers do not have a scope
1242             if (scope != NULL && scope->objects() != NULL) {
1243               GrowableArray<ScopeValue*>* objects;
1244               if (!realloc_called) {
1245                 objects = scope->objects();
1246               } else {
1247                 // some object might already have been re-allocated, only reallocate the non-allocated ones
1248                 objects = new GrowableArray<ScopeValue*>(scope->objects()->length());
1249                 for (int i = 0; i < scope->objects()->length(); i++) {
1250                   ObjectValue* sv = (ObjectValue*) scope->objects()->at(i);
1251                   if (sv->value().is_null()) {
1252                     objects->append(sv);
1253                   }
1254                 }
1255               }

1256               bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), fst.register_map(), objects, CHECK_NULL);
1257               Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, realloc_failures, false);
1258               realloc_called = true;
1259 
1260               GrowableArray<ScopeValue*>* local_values = scope->locals();
1261               assert(local_values != NULL, "NULL locals");
1262               typeArrayOop array_oop = oopFactory::new_boolArray(local_values->length(), CHECK_NULL);
1263               typeArrayHandle array(THREAD, array_oop);
1264               for (int i = 0; i < local_values->length(); i++) {
1265                 ScopeValue* value = local_values->at(i);
1266                 if (value->is_object()) {
1267                   array->bool_at_put(i, true);
1268                 }
1269               }
1270               HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), array());
1271             } else {
1272               HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL);
1273             }
1274 
1275             locals = cvf->locals();


1494     if (vf->is_top()) {
1495       break;
1496     }
1497     vf = vf->sender();
1498   }
1499 
1500   int last_frame_number = JVMCIENV->get_HotSpotStackFrameReference_frameNumber(hs_frame);
1501   if (last_frame_number >= virtualFrames->length()) {
1502     JVMCI_THROW_MSG(IllegalStateException, "invalid frame number");
1503   }
1504 
1505   // Reallocate the non-escaping objects and restore their fields.
1506   assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope");
1507   GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects();
1508 
1509   if (objects == NULL) {
1510     // no objects to materialize
1511     return;
1512   }
1513 

1514   bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, CHECK);
1515   Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false);
1516 
1517   for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) {
1518     compiledVFrame* cvf = virtualFrames->at(frame_index);
1519 
1520     GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals();
1521     StackValueCollection* locals = cvf->locals();
1522     if (locals != NULL) {
1523       for (int i2 = 0; i2 < locals->size(); i2++) {
1524         StackValue* var = locals->at(i2);
1525         if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) {
1526           jvalue val;
1527           val.l = (jobject) locals->at(i2)->get_obj()();
1528           cvf->update_local(T_OBJECT, i2, val);
1529         }
1530       }
1531     }
1532 
1533     GrowableArray<ScopeValue*>* scopeExpressions = cvf->scope()->expressions();




1236         if (methods == NULL || matches(methods, cvf->method(), JVMCIENV)) {
1237           if (initialSkip > 0) {
1238             initialSkip--;
1239           } else {
1240             ScopeDesc* scope = cvf->scope();
1241             // native wrappers do not have a scope
1242             if (scope != NULL && scope->objects() != NULL) {
1243               GrowableArray<ScopeValue*>* objects;
1244               if (!realloc_called) {
1245                 objects = scope->objects();
1246               } else {
1247                 // some object might already have been re-allocated, only reallocate the non-allocated ones
1248                 objects = new GrowableArray<ScopeValue*>(scope->objects()->length());
1249                 for (int i = 0; i < scope->objects()->length(); i++) {
1250                   ObjectValue* sv = (ObjectValue*) scope->objects()->at(i);
1251                   if (sv->value().is_null()) {
1252                     objects->append(sv);
1253                   }
1254                 }
1255               }
1256               // TODO: use Deoptimization::deoptimize_objects()
1257               bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), fst.register_map(), objects, CHECK_NULL);
1258               Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, realloc_failures, false);
1259               realloc_called = true;
1260 
1261               GrowableArray<ScopeValue*>* local_values = scope->locals();
1262               assert(local_values != NULL, "NULL locals");
1263               typeArrayOop array_oop = oopFactory::new_boolArray(local_values->length(), CHECK_NULL);
1264               typeArrayHandle array(THREAD, array_oop);
1265               for (int i = 0; i < local_values->length(); i++) {
1266                 ScopeValue* value = local_values->at(i);
1267                 if (value->is_object()) {
1268                   array->bool_at_put(i, true);
1269                 }
1270               }
1271               HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), array());
1272             } else {
1273               HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL);
1274             }
1275 
1276             locals = cvf->locals();


1495     if (vf->is_top()) {
1496       break;
1497     }
1498     vf = vf->sender();
1499   }
1500 
1501   int last_frame_number = JVMCIENV->get_HotSpotStackFrameReference_frameNumber(hs_frame);
1502   if (last_frame_number >= virtualFrames->length()) {
1503     JVMCI_THROW_MSG(IllegalStateException, "invalid frame number");
1504   }
1505 
1506   // Reallocate the non-escaping objects and restore their fields.
1507   assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope");
1508   GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects();
1509 
1510   if (objects == NULL) {
1511     // no objects to materialize
1512     return;
1513   }
1514 
1515   // TODO: use Deoptimization::deoptimize_objects()
1516   bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, CHECK);
1517   Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false);
1518 
1519   for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) {
1520     compiledVFrame* cvf = virtualFrames->at(frame_index);
1521 
1522     GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals();
1523     StackValueCollection* locals = cvf->locals();
1524     if (locals != NULL) {
1525       for (int i2 = 0; i2 < locals->size(); i2++) {
1526         StackValue* var = locals->at(i2);
1527         if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) {
1528           jvalue val;
1529           val.l = (jobject) locals->at(i2)->get_obj()();
1530           cvf->update_local(T_OBJECT, i2, val);
1531         }
1532       }
1533     }
1534 
1535     GrowableArray<ScopeValue*>* scopeExpressions = cvf->scope()->expressions();


< prev index next >