VirtualBox

Changeset 104100 in vbox for trunk/src


Ignore:
Timestamp:
Mar 28, 2024 2:07:36 AM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Optimize kIemTbDbgEntryType_NativeOffset emitting, caching the previous offset instead of searching backwards for it. bugref:10370

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r104099 r104100  
    32363236#ifdef IEMNATIVE_WITH_TB_DEBUG_INFO
    32373237    pReNative->pDbgInfo->cEntries          = 0;
     3238    pReNative->pDbgInfo->offNativeLast     = UINT32_MAX;
    32383239#endif
    32393240    pReNative->pTbOrg                      = pTb;
     
    37123713
    37133714    /*
    3714      * Search backwards to see if we've got a similar record already.
    3715      */
    3716     uint32_t idx     = pDbgInfo->cEntries;
    3717     uint32_t idxStop = idx > 16 ? idx - 16 : 0;
    3718     while (idx-- > idxStop)
    3719         if (pDbgInfo->aEntries[idx].Gen.uType == kIemTbDbgEntryType_NativeOffset)
    3720         {
    3721             if (pDbgInfo->aEntries[idx].NativeOffset.offNative == off)
    3722                 return;
    3723             AssertStmt(pDbgInfo->aEntries[idx].NativeOffset.offNative < off,
    3724                        IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_DBGINFO_IPE_2));
    3725             break;
    3726         }
     3715     * Do we need this one?
     3716     */
     3717    uint32_t const offPrev = pDbgInfo->offNativeLast;
     3718    if (offPrev == off)
     3719        return;
     3720    AssertStmt(offPrev < off || offPrev == UINT32_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_DBGINFO_IPE_2));
    37273721
    37283722    /*
     
    37323726    pEntry->NativeOffset.uType     = kIemTbDbgEntryType_NativeOffset;
    37333727    pEntry->NativeOffset.offNative = off;
     3728    pDbgInfo->offNativeLast = off;
    37343729}
    37353730
     
    47904785            iemNativeDbgInfoAddGuestRegDirty(pReNative, false /*fSimdReg*/, enmGstReg, idxReg);
    47914786# endif
    4792 
    47934787            pReNative->Core.bmGstRegShadowDirty |= RT_BIT_64(enmGstReg);
    47944788        }
     
    48234817        iemNativeDbgInfoAddGuestRegDirty(pReNative, false /*fSimdReg*/, enmGstReg, idxRegNew);
    48244818# endif
    4825 
    48264819        pReNative->Core.bmGstRegShadowDirty |= RT_BIT_64(enmGstReg);
    48274820    }
     
    86038596            iemNativeDbgInfoAddGuestRegDirty(pReNative, false /*fSimdReg*/, enmGstReg, idxReg);
    86048597# endif
    8605 
    86068598            pReNative->Core.bmGstRegShadowDirty |= RT_BIT_64(enmGstReg);
    86078599        }
     
    1009010082#ifdef IEMNATIVE_WITH_DELAYED_PC_UPDATING
    1009110083                        case kIemTbDbgEntryType_DelayedPcUpdate:
    10092                             pHlp->pfnPrintf(pHlp,
    10093                                             "  Updating guest PC value by %u (cInstrSkipped=%u)\n",
     10084                            pHlp->pfnPrintf(pHlp, "  Updating guest PC value by %u (cInstrSkipped=%u)\n",
    1009410085                                            pDbgInfo->aEntries[iDbgEntry].DelayedPcUpdate.offPc,
    1009510086                                            pDbgInfo->aEntries[iDbgEntry].DelayedPcUpdate.cInstrSkipped);
     
    1010110092                        {
    1010210093                            PCIEMTBDBGENTRY const pEntry    = &pDbgInfo->aEntries[iDbgEntry];
    10103                             const char * const    pszGstReg =   pEntry->GuestRegDirty.fSimdReg
    10104                                                               ? g_aGstSimdShadowInfo[pEntry->GuestRegDirty.idxGstReg].pszName
    10105                                                               : g_aGstShadowInfo[pEntry->GuestRegDirty.idxGstReg].pszName;
    10106                             const char * const    pszHstReg =   pEntry->GuestRegDirty.fSimdReg
    10107                                                               ? g_apszIemNativeHstSimdRegNames[pEntry->GuestRegDirty.idxHstReg]
    10108                                                               : g_apszIemNativeHstRegNames[pEntry->GuestRegDirty.idxHstReg];
    10109                             pHlp->pfnPrintf(pHlp,
    10110                                             "  Guest register %s (shadowed by %s) is now dirty\n",
     10094                            const char * const    pszGstReg = pEntry->GuestRegDirty.fSimdReg
     10095                                                            ? g_aGstSimdShadowInfo[pEntry->GuestRegDirty.idxGstReg].pszName
     10096                                                            : g_aGstShadowInfo[pEntry->GuestRegDirty.idxGstReg].pszName;
     10097                            const char * const    pszHstReg = pEntry->GuestRegDirty.fSimdReg
     10098                                                            ? g_apszIemNativeHstSimdRegNames[pEntry->GuestRegDirty.idxHstReg]
     10099                                                            : g_apszIemNativeHstRegNames[pEntry->GuestRegDirty.idxHstReg];
     10100                            pHlp->pfnPrintf(pHlp, "  Guest register %s (shadowed by %s) is now marked dirty (intent)\n",
    1011110101                                            pszGstReg, pszHstReg);
    1011210102                            continue;
     
    1011410104
    1011510105                        case kIemTbDbgEntryType_GuestRegWriteback:
    10116                             pHlp->pfnPrintf(pHlp,
    10117                                             "  Writing dirty %s registers (gst %#RX64)\n",
     10106                            pHlp->pfnPrintf(pHlp, "  Writing dirty %s registers (gst %#RX32)\n",
    1011810107                                            pDbgInfo->aEntries[iDbgEntry].GuestRegWriteback.fSimdReg ? "SIMD" : "general",
    1011910108                                            pDbgInfo->aEntries[iDbgEntry].GuestRegWriteback.fGstReg);
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r104095 r104100  
    11371137    /** Number of entries in aEntries. */
    11381138    uint32_t        cEntries;
     1139    /** The offset of the last kIemTbDbgEntryType_NativeOffset record. */
     1140    uint32_t        offNativeLast;
    11391141    /** Debug info entries. */
    11401142    RT_FLEXIBLE_ARRAY_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette