273 |
273 |
274 recording.stop(); |
274 recording.stop(); |
275 List<RecordedEvent> events = Events.fromRecording(recording); |
275 List<RecordedEvent> events = Events.fromRecording(recording); |
276 |
276 |
277 // Determine which safepoints included single and bulk revocation VM operations |
277 // Determine which safepoints included single and bulk revocation VM operations |
278 Set<Integer> vmOperationsSingle = new HashSet<>(); |
278 Set<Long> vmOperationsSingle = new HashSet<>(); |
279 Set<Integer> vmOperationsBulk = new HashSet<>(); |
279 Set<Long> vmOperationsBulk = new HashSet<>(); |
280 |
280 |
281 for (RecordedEvent event : events) { |
281 for (RecordedEvent event : events) { |
282 if (event.getEventType().getName().equals(EventNames.ExecuteVMOperation)) { |
282 if (event.getEventType().getName().equals(EventNames.ExecuteVMOperation)) { |
283 String operation = event.getValue("operation"); |
283 String operation = event.getValue("operation"); |
284 Integer safepointId = event.getValue("safepointId"); |
284 Long safepointId = event.getValue("safepointId"); |
285 |
285 |
286 if (operation.equals("RevokeBias")) { |
286 if (operation.equals("RevokeBias")) { |
287 vmOperationsSingle.add(safepointId); |
287 vmOperationsSingle.add(safepointId); |
288 } else if (operation.equals("BulkRevokeBias")) { |
288 } else if (operation.equals("BulkRevokeBias")) { |
289 vmOperationsBulk.add(safepointId); |
289 vmOperationsBulk.add(safepointId); |
295 int bulkRevokeCount = 0; |
295 int bulkRevokeCount = 0; |
296 |
296 |
297 // Match all revoke events to a corresponding VMOperation event |
297 // Match all revoke events to a corresponding VMOperation event |
298 for (RecordedEvent event : events) { |
298 for (RecordedEvent event : events) { |
299 if (event.getEventType().getName().equals(EventNames.BiasedLockRevocation)) { |
299 if (event.getEventType().getName().equals(EventNames.BiasedLockRevocation)) { |
300 Integer safepointId = event.getValue("safepointId"); |
300 Long safepointId = event.getValue("safepointId"); |
301 String lockClass = ((RecordedClass)event.getValue("lockClass")).getName(); |
301 String lockClass = ((RecordedClass)event.getValue("lockClass")).getName(); |
302 if (lockClass.equals(MyLock.class.getName())) { |
302 if (lockClass.equals(MyLock.class.getName())) { |
303 Asserts.assertTrue(vmOperationsSingle.contains(safepointId)); |
303 Asserts.assertTrue(vmOperationsSingle.contains(safepointId)); |
304 revokeCount++; |
304 revokeCount++; |
305 } |
305 } |
306 } else if (event.getEventType().getName().equals(EventNames.BiasedLockClassRevocation)) { |
306 } else if (event.getEventType().getName().equals(EventNames.BiasedLockClassRevocation)) { |
307 Integer safepointId = event.getValue("safepointId"); |
307 Long safepointId = event.getValue("safepointId"); |
308 String lockClass = ((RecordedClass)event.getValue("revokedClass")).getName(); |
308 String lockClass = ((RecordedClass)event.getValue("revokedClass")).getName(); |
309 if (lockClass.toString().equals(MyLock.class.getName())) { |
309 if (lockClass.toString().equals(MyLock.class.getName())) { |
310 Asserts.assertTrue(vmOperationsBulk.contains(safepointId)); |
310 Asserts.assertTrue(vmOperationsBulk.contains(safepointId)); |
311 bulkRevokeCount++; |
311 bulkRevokeCount++; |
312 } |
312 } |