1270 trace_size = java_lang_Throwable::trace_size, |
1269 trace_size = java_lang_Throwable::trace_size, |
1271 trace_chunk_size = java_lang_Throwable::trace_chunk_size |
1270 trace_chunk_size = java_lang_Throwable::trace_chunk_size |
1272 }; |
1271 }; |
1273 |
1272 |
1274 // constructor for new backtrace |
1273 // constructor for new backtrace |
1275 BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL), _dirty(false) { |
1274 BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL) { |
1276 expand(CHECK); |
1275 expand(CHECK); |
1277 _backtrace = _head; |
1276 _backtrace = _head; |
1278 _index = 0; |
1277 _index = 0; |
1279 } |
1278 } |
1280 |
1279 |
1281 void flush() { |
|
1282 // The following appears to have been an optimization to save from |
|
1283 // doing a barrier for each individual store into the _methods array, |
|
1284 // but rather to do it for the entire array after the series of writes. |
|
1285 // That optimization seems to have been lost when compressed oops was |
|
1286 // implemented. However, the extra card-marks below was left in place, |
|
1287 // but is now redundant because the individual stores into the |
|
1288 // _methods array already execute the barrier code. CR 6918185 has |
|
1289 // been filed so the original code may be restored by deferring the |
|
1290 // barriers until after the entire sequence of stores, thus re-enabling |
|
1291 // the intent of the original optimization. In the meantime the redundant |
|
1292 // card mark below is now disabled. |
|
1293 if (_dirty && _methods != NULL) { |
|
1294 #if 0 |
|
1295 BarrierSet* bs = Universe::heap()->barrier_set(); |
|
1296 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
|
1297 bs->write_ref_array((HeapWord*)_methods->base(), _methods->length()); |
|
1298 #endif |
|
1299 _dirty = false; |
|
1300 } |
|
1301 } |
|
1302 |
|
1303 void expand(TRAPS) { |
1280 void expand(TRAPS) { |
1304 flush(); |
|
1305 |
|
1306 objArrayHandle old_head(THREAD, _head); |
1281 objArrayHandle old_head(THREAD, _head); |
1307 Pause_No_Safepoint_Verifier pnsv(&_nsv); |
1282 Pause_No_Safepoint_Verifier pnsv(&_nsv); |
1308 |
1283 |
1309 objArrayOop head = oopFactory::new_objectArray(trace_size, CHECK); |
1284 objArrayOop head = oopFactory::new_objectArray(trace_size, CHECK); |
1310 objArrayHandle new_head(THREAD, head); |
1285 objArrayHandle new_head(THREAD, head); |
1340 } |
1314 } |
1341 |
1315 |
1342 _methods->obj_at_put(_index, method); |
1316 _methods->obj_at_put(_index, method); |
1343 _bcis->ushort_at_put(_index, bci); |
1317 _bcis->ushort_at_put(_index, bci); |
1344 _index++; |
1318 _index++; |
1345 _dirty = true; |
|
1346 } |
1319 } |
1347 |
1320 |
1348 methodOop current_method() { |
1321 methodOop current_method() { |
1349 assert(_index >= 0 && _index < trace_chunk_size, "out of range"); |
1322 assert(_index >= 0 && _index < trace_chunk_size, "out of range"); |
1350 return methodOop(_methods->obj_at(_index)); |
1323 return methodOop(_methods->obj_at(_index)); |