Changeset 101091 in vbox
- Timestamp:
- Sep 12, 2023 12:42:45 PM (20 months ago)
- svn:sync-xref-src-repo-rev:
- 159060
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp
r101088 r101091 460 460 } 461 461 462 #ifdef VBOX_STRICT 463 /** 464 * Assertion helper that checks a collisions list count. 465 */ 466 static void iemTbCacheAssertCorrectCount(PIEMTBCACHE pTbCache, uint32_t idxHash, const char *pszOperation) 467 { 468 PIEMTB pTb = IEMTBCACHE_PTR_GET_TB(pTbCache->apHash[idxHash]); 469 int cLeft = IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]); 470 while (pTb) 471 { 472 pTb = pTb->pNext; 473 cLeft--; 474 } 475 AssertMsg(cLeft == 0, 476 ("idxHash=%#x cLeft=%d; entry count=%d; %s\n", 477 idxHash, cLeft, IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]), pszOperation)); 478 } 479 #endif 480 462 481 463 482 DECL_NO_INLINE(static, void) iemTbCacheAddWithPruning(PVMCPUCC pVCpu, PIEMTBCACHE pTbCache, PIEMTB pTb, uint32_t idxHash) … … 471 490 uintptr_t cInserted = 0; 472 491 PIEMTB pTbCollision = IEMTBCACHE_PTR_GET_TB(pTbCache->apHash[idxHash]); 492 473 493 pTbCache->apHash[idxHash] = NULL; /* Must NULL the entry before trying to free anything. */ 474 494 … … 504 524 iemTbAllocatorFree(pVCpu, apSortedTbs[idx]); 505 525 506 /* Chain the new TB together with the ones we like to keep of the existing507 ones and insert this list into the hash table. */526 /* Then chain the new TB together with the ones we like to keep of the 527 existing ones and insert this list into the hash table. */ 508 528 pTbCollision = pTb; 509 529 for (uintptr_t idx = 0; idx < cKeep; idx++) … … 512 532 513 533 pTbCache->apHash[idxHash] = IEMTBCACHE_PTR_MAKE(pTb, cKeep + 1); 534 #ifdef VBOX_STRICT 535 iemTbCacheAssertCorrectCount(pTbCache, idxHash, "add w/ pruning"); 536 #endif 514 537 515 538 STAM_PROFILE_STOP(&pTbCache->StatPrune, a); … … 534 557 pTb->pNext = IEMTBCACHE_PTR_GET_TB(pTbOldHead); 535 558 pTbCache->apHash[idxHash] = IEMTBCACHE_PTR_MAKE(pTb, cCollisions + 1); 559 #ifdef VBOX_STRICT 560 iemTbCacheAssertCorrectCount(pTbCache, idxHash, "add"); 561 #endif 536 562 } 537 563 else … … 552 578 uint32_t const idxHash = IEMTBCACHE_HASH(pTbCache, pTb->fFlags, pTb->GCPhysPc); 553 579 PIEMTB pTbHash = IEMTBCACHE_PTR_GET_TB(pTbCache->apHash[idxHash]); 554 555 /* At the head of the collision list? */ 580 uint32_t volatile cLength = IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]); RT_NOREF(cLength); 581 582 /* 583 * At the head of the collision list? 584 */ 556 585 if (pTbHash == pTb) 557 586 { … … 559 588 pTbCache->apHash[idxHash] = NULL; 560 589 else 590 { 561 591 pTbCache->apHash[idxHash] = IEMTBCACHE_PTR_MAKE(pTb->pNext, 562 592 IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]) - 1); 593 #ifdef VBOX_STRICT 594 iemTbCacheAssertCorrectCount(pTbCache, idxHash, "remove #1"); 595 #endif 596 } 563 597 return true; 564 598 } 565 599 566 /* Search the collision list. */ 600 /* 601 * Search the collision list. 602 */ 603 PIEMTB const pTbHead = pTbHash; 567 604 while (pTbHash) 568 605 { … … 571 608 { 572 609 pTbHash->pNext = pTb->pNext; 573 pTbCache->apHash[idxHash] = IEMTBCACHE_PTR_MAKE(pTbCache->apHash[idxHash], 574 IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]) - 1); 610 pTbCache->apHash[idxHash] = IEMTBCACHE_PTR_MAKE(pTbHead, IEMTBCACHE_PTR_GET_COUNT(pTbCache->apHash[idxHash]) - 1); 611 #ifdef VBOX_STRICT 612 iemTbCacheAssertCorrectCount(pTbCache, idxHash, "remove #2"); 613 #endif 575 614 return true; 576 615 }
Note:
See TracChangeset
for help on using the changeset viewer.