< prev index next >

src/share/vm/gc_implementation/parNew/parNewGeneration.cpp

Print this page




1023       // other spaces.
1024       to()->mangle_unused_area();
1025     }
1026     swap_spaces();
1027 
1028     // A successful scavenge should restart the GC time limit count which is
1029     // for full GC's.
1030     size_policy->reset_gc_overhead_limit_count();
1031 
1032     assert(to()->is_empty(), "to space should be empty now");
1033 
1034     adjust_desired_tenuring_threshold();
1035   } else {
1036     handle_promotion_failed(gch, thread_state_set);
1037   }
1038   // set new iteration safe limit for the survivor spaces
1039   from()->set_concurrent_iteration_safe_limit(from()->top());
1040   to()->set_concurrent_iteration_safe_limit(to()->top());
1041 
1042   if (ResizePLAB) {
1043     plab_stats()->adjust_desired_plab_sz(n_workers);
1044   }
1045 
1046   if (PrintGC && !PrintGCDetails) {
1047     gch->print_heap_change(gch_prev_used);
1048   }
1049 
1050   TASKQUEUE_STATS_ONLY(if (PrintTerminationStats) thread_state_set.print_termination_stats());
1051   TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) thread_state_set.print_taskqueue_stats());
1052 
1053   if (UseAdaptiveSizePolicy) {
1054     size_policy->minor_collection_end(gch->gc_cause());
1055     size_policy->avg_survived()->sample(from()->used());
1056   }
1057 
1058   // We need to use a monotonically non-decreasing time in ms
1059   // or we will see time-warp warnings and os::javaTimeMillis()
1060   // does not guarantee monotonicity.
1061   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
1062   update_time_of_last_gc(now);
1063 
1064   rp->set_enqueuing_is_done(true);
1065   if (rp->processing_is_mt()) {
1066     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
1067     rp->enqueue_discovered_references(&task_executor);
1068   } else {
1069     rp->enqueue_discovered_references(NULL);
1070   }
1071   rp->verify_no_references_recorded();
1072 
1073   gch->trace_heap_after_gc(gc_tracer());
1074   _gc_tracer.report_tenuring_threshold(tenuring_threshold());
1075 
1076   _gc_timer->register_gc_end();
1077 
1078   _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());




1079 }
1080 
1081 static int sum;
1082 void ParNewGeneration::waste_some_time() {
1083   for (int i = 0; i < 100; i++) {
1084     sum += i;
1085   }
1086 }
1087 
1088 static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4);
1089 
1090 // Because of concurrency, there are times where an object for which
1091 // "is_forwarded()" is true contains an "interim" forwarding pointer
1092 // value.  Such a value will soon be overwritten with a real value.
1093 // This method requires "obj" to have a forwarding pointer, and waits, if
1094 // necessary for a real one to be inserted, and returns it.
1095 
1096 oop ParNewGeneration::real_forwardee(oop obj) {
1097   oop forward_ptr = obj->forwardee();
1098   if (forward_ptr != ClaimedForwardPtr) {




1023       // other spaces.
1024       to()->mangle_unused_area();
1025     }
1026     swap_spaces();
1027 
1028     // A successful scavenge should restart the GC time limit count which is
1029     // for full GC's.
1030     size_policy->reset_gc_overhead_limit_count();
1031 
1032     assert(to()->is_empty(), "to space should be empty now");
1033 
1034     adjust_desired_tenuring_threshold();
1035   } else {
1036     handle_promotion_failed(gch, thread_state_set);
1037   }
1038   // set new iteration safe limit for the survivor spaces
1039   from()->set_concurrent_iteration_safe_limit(from()->top());
1040   to()->set_concurrent_iteration_safe_limit(to()->top());
1041 
1042   if (ResizePLAB) {
1043     plab_stats()->adjust_desired_plab_sz();
1044   }
1045 
1046   if (PrintGC && !PrintGCDetails) {
1047     gch->print_heap_change(gch_prev_used);
1048   }
1049 
1050   TASKQUEUE_STATS_ONLY(if (PrintTerminationStats) thread_state_set.print_termination_stats());
1051   TASKQUEUE_STATS_ONLY(if (PrintTaskqueue) thread_state_set.print_taskqueue_stats());
1052 
1053   if (UseAdaptiveSizePolicy) {
1054     size_policy->minor_collection_end(gch->gc_cause());
1055     size_policy->avg_survived()->sample(from()->used());
1056   }
1057 
1058   // We need to use a monotonically non-decreasing time in ms
1059   // or we will see time-warp warnings and os::javaTimeMillis()
1060   // does not guarantee monotonicity.
1061   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
1062   update_time_of_last_gc(now);
1063 
1064   rp->set_enqueuing_is_done(true);
1065   if (rp->processing_is_mt()) {
1066     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
1067     rp->enqueue_discovered_references(&task_executor);
1068   } else {
1069     rp->enqueue_discovered_references(NULL);
1070   }
1071   rp->verify_no_references_recorded();
1072 
1073   gch->trace_heap_after_gc(gc_tracer());
1074   _gc_tracer.report_tenuring_threshold(tenuring_threshold());
1075 
1076   _gc_timer->register_gc_end();
1077 
1078   _gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
1079 }
1080 
1081 size_t ParNewGeneration::desired_plab_sz() {
1082   return _plab_stats.desired_plab_sz(GenCollectedHeap::heap()->workers()->active_workers());
1083 }
1084 
1085 static int sum;
1086 void ParNewGeneration::waste_some_time() {
1087   for (int i = 0; i < 100; i++) {
1088     sum += i;
1089   }
1090 }
1091 
1092 static const oop ClaimedForwardPtr = cast_to_oop<intptr_t>(0x4);
1093 
1094 // Because of concurrency, there are times where an object for which
1095 // "is_forwarded()" is true contains an "interim" forwarding pointer
1096 // value.  Such a value will soon be overwritten with a real value.
1097 // This method requires "obj" to have a forwarding pointer, and waits, if
1098 // necessary for a real one to be inserted, and returns it.
1099 
1100 oop ParNewGeneration::real_forwardee(oop obj) {
1101   oop forward_ptr = obj->forwardee();
1102   if (forward_ptr != ClaimedForwardPtr) {


< prev index next >