1098 int new_edges = 1; 1099 int iterations = 0; 1100 do { 1101 while ((new_edges > 0) && 1102 (iterations++ < CG_BUILD_ITER_LIMIT)) { 1103 double start_time = time.seconds(); 1104 time.start(); 1105 new_edges = 0; 1106 // Propagate references to phantom_object for nodes pushed on _worklist 1107 // by find_non_escaped_objects() and find_field_value(). 1108 new_edges += add_java_object_edges(phantom_obj, false); 1109 for (int next = 0; next < java_objects_length; ++next) { 1110 JavaObjectNode* ptn = java_objects_worklist.at(next); 1111 new_edges += add_java_object_edges(ptn, true); 1112 1113 #define SAMPLE_SIZE 4 1114 if ((next % SAMPLE_SIZE) == 0) { 1115 // Each 4 iterations calculate how much time it will take 1116 // to complete graph construction. 1117 time.stop(); 1118 double stop_time = time.seconds(); 1119 double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; 1120 double time_until_end = time_per_iter * (double)(java_objects_length - next); 1121 if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { 1122 timeout = true; 1123 break; // Timeout 1124 } 1125 start_time = stop_time; 1126 time.start(); 1127 } 1128 #undef SAMPLE_SIZE 1129 1130 } 1131 if (timeout) break; 1132 if (new_edges > 0) { 1133 // Update escape states on each iteration if graph was updated. 1134 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { 1135 return false; // Nothing to do. 1136 } 1137 } | 1098 int new_edges = 1; 1099 int iterations = 0; 1100 do { 1101 while ((new_edges > 0) && 1102 (iterations++ < CG_BUILD_ITER_LIMIT)) { 1103 double start_time = time.seconds(); 1104 time.start(); 1105 new_edges = 0; 1106 // Propagate references to phantom_object for nodes pushed on _worklist 1107 // by find_non_escaped_objects() and find_field_value(). 1108 new_edges += add_java_object_edges(phantom_obj, false); 1109 for (int next = 0; next < java_objects_length; ++next) { 1110 JavaObjectNode* ptn = java_objects_worklist.at(next); 1111 new_edges += add_java_object_edges(ptn, true); 1112 1113 #define SAMPLE_SIZE 4 1114 if ((next % SAMPLE_SIZE) == 0) { 1115 // Each 4 iterations calculate how much time it will take 1116 // to complete graph construction. 1117 time.stop(); 1118 // Poll for requests from shutdown mechanism to quiesce compiler 1119 // because Connection graph construction may take long time. 1120 CompileBroker::maybe_block(); 1121 double stop_time = time.seconds(); 1122 double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; 1123 double time_until_end = time_per_iter * (double)(java_objects_length - next); 1124 if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { 1125 timeout = true; 1126 break; // Timeout 1127 } 1128 start_time = stop_time; 1129 time.start(); 1130 } 1131 #undef SAMPLE_SIZE 1132 1133 } 1134 if (timeout) break; 1135 if (new_edges > 0) { 1136 // Update escape states on each iteration if graph was updated. 1137 if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { 1138 return false; // Nothing to do. 1139 } 1140 } |