Changeset 105179 in vbox
- Timestamp:
- Jul 8, 2024 10:38:14 AM (7 months ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp
r105178 r105179 946 946 pTb->pabOpcodes = NULL; 947 947 948 ASMBitClear(&pTbAllocator->bmAllocated, IEMTBALLOC_IDX_MAKE(pTbAllocator, idxChunk, idxInChunk)); 948 if (pTbAllocator->idxTbCacheFree < RT_ELEMENTS(pTbAllocator->apTbFreeCache)) 949 pTbAllocator->apTbFreeCache[pTbAllocator->idxTbCacheFree++] = pTb; 950 else 951 ASMBitClear(&pTbAllocator->bmAllocated, IEMTBALLOC_IDX_MAKE(pTbAllocator, idxChunk, idxInChunk)); 949 952 Assert(pTbAllocator->cInUseTbs > 0); 950 953 … … 1092 1095 Assert(pTbAllocator->cInUseTbs < pTbAllocator->cTotalTbs); 1093 1096 1094 int idxTb; 1095 if (pTbAllocator->iStartHint < pTbAllocator->cTotalTbs) 1096 idxTb = ASMBitNextClear(pTbAllocator->bmAllocated, 1097 pTbAllocator->cTotalTbs, 1098 pTbAllocator->iStartHint & ~(uint32_t)63); 1097 PIEMTB pTb; 1098 if (pTbAllocator->idxTbCacheFree) 1099 pTb = pTbAllocator->apTbFreeCache[--pTbAllocator->idxTbCacheFree]; 1099 1100 else 1100 idxTb = -1; 1101 if (idxTb < 0) 1102 { 1103 idxTb = ASMBitFirstClear(pTbAllocator->bmAllocated, pTbAllocator->cTotalTbs); 1104 AssertLogRelReturn(idxTb >= 0, NULL); 1105 } 1106 Assert((uint32_t)idxTb < pTbAllocator->cTotalTbs); 1107 pTbAllocator->iStartHint = idxTb; 1108 ASMBitSet(pTbAllocator->bmAllocated, idxTb); 1109 1110 /** @todo shift/mask optimization for power of two IEMTB sizes. */ 1111 uint32_t const idxChunk = IEMTBALLOC_IDX_TO_CHUNK(pTbAllocator, idxTb); 1112 uint32_t const idxTbInChunk = IEMTBALLOC_IDX_TO_INDEX_IN_CHUNK(pTbAllocator, idxTb, idxChunk); 1113 PIEMTB const pTb = &pTbAllocator->aChunks[idxChunk].paTbs[idxTbInChunk]; 1114 Assert(pTb->idxAllocChunk == idxChunk); 1101 { 1102 int idxTb; 1103 if (pTbAllocator->iStartHint < pTbAllocator->cTotalTbs) 1104 idxTb = ASMBitNextClear(pTbAllocator->bmAllocated, 1105 pTbAllocator->cTotalTbs, 1106 pTbAllocator->iStartHint & ~(uint32_t)63); 1107 else 1108 idxTb = -1; 1109 if (idxTb < 0) 1110 { 1111 idxTb = ASMBitFirstClear(pTbAllocator->bmAllocated, pTbAllocator->cTotalTbs); 1112 AssertLogRelReturn(idxTb >= 0, NULL); 1113 } 1114 Assert((uint32_t)idxTb < pTbAllocator->cTotalTbs); 1115 pTbAllocator->iStartHint = idxTb; 1116 ASMBitSet(pTbAllocator->bmAllocated, idxTb); 1117 1118 /** @todo shift/mask optimization for power of two IEMTB sizes. */ 1119 uint32_t const idxChunk = IEMTBALLOC_IDX_TO_CHUNK(pTbAllocator, idxTb); 1120 uint32_t const idxTbInChunk = IEMTBALLOC_IDX_TO_INDEX_IN_CHUNK(pTbAllocator, idxTb, idxChunk); 1121 pTb = &pTbAllocator->aChunks[idxChunk].paTbs[idxTbInChunk]; 1122 Assert(pTb->idxAllocChunk == idxChunk); 1123 } 1115 1124 1116 1125 pTbAllocator->cInUseTbs += 1; -
trunk/src/VBox/VMM/include/IEMInternal.h
r105177 r105179 1490 1490 * See iemTbAllocatorFreeupNativeSpace for details. */ 1491 1491 uint32_t iPruneNativeFrom; 1492 uint32_t uPadding; 1492 /** Index into IEMTBALLOCATOR::aFreeCache were the next freed TB can be stored 1493 * (0 means the cache is empty, 32 the cache is full). */ 1494 uint32_t idxTbCacheFree; 1493 1495 1494 1496 /** Statistics: Number of TB allocation calls. */ … … 1503 1505 /** The delayed free list (see iemTbAlloctorScheduleForFree). */ 1504 1506 PIEMTB pDelayedFreeHead; 1507 /* Cache of recently freed TBs for immediate consumption by the allocator. */ 1508 PIEMTB apTbFreeCache[32]; 1505 1509 1506 1510 /** Allocation chunks. */
Note:
See TracChangeset
for help on using the changeset viewer.