VirtualBox

Changeset 104283 in vbox


Ignore:
Timestamp:
Apr 10, 2024 5:46:25 PM (10 months ago)
Author:
vboxsync
Message:

VMM/IEM: Gather statistics on the exit behavior of native TBs, bugref:10653 [redo, can't allocate the temp registers before the loop because the result be IEMNATIVE_CALL_ARG0_GREG which gets clobbered shortly after]

File:
1 edited

Legend:

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

    r104282 r104283  
    61956195    return off;
    61966196}
     6197
     6198
     6199/**
     6200 * Emits code to update the TB exit reason statistics.
     6201 */
     6202DECL_INLINE_THROW(uint32_t)
     6203iemNativeEmitNativeTbExitStats(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t const offVCpu)
     6204{
     6205    uint8_t const idxStatsTmp1 = iemNativeRegAllocTmp(pReNative, &off);
     6206    uint8_t const idxStatsTmp2 = iemNativeRegAllocTmp(pReNative, &off);
     6207    off = iemNativeEmitIncStamCounterInVCpu(pReNative, off, idxStatsTmp1, idxStatsTmp2, offVCpu);
     6208    iemNativeRegFreeTmp(pReNative, idxStatsTmp1);
     6209    iemNativeRegFreeTmp(pReNative, idxStatsTmp2);
     6210
     6211    return off;
     6212}
    61976213#endif /* VBOX_WITH_STATISTICS */
    61986214
     
    62106226
    62116227#ifdef VBOX_WITH_STATISTICS
    6212         uint8_t const idxStatsTmp1 = iemNativeRegAllocTmp(pReNative, &off);
    6213         uint8_t const idxStatsTmp2 = iemNativeRegAllocTmp(pReNative, &off);
    6214         off = iemNativeEmitIncStamCounterInVCpu(pReNative, off, idxStatsTmp1, idxStatsTmp2,
    6215                                                 RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitReturnWithFlags));
    6216         iemNativeRegFreeTmp(pReNative, idxStatsTmp1);
    6217         iemNativeRegFreeTmp(pReNative, idxStatsTmp2);
     6228        off = iemNativeEmitNativeTbExitStats(pReNative, off, RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitReturnWithFlags));
    62186229#endif
    62196230
     
    62386249
    62396250#ifdef VBOX_WITH_STATISTICS
    6240         uint8_t const idxStatsTmp1 = iemNativeRegAllocTmp(pReNative, &off);
    6241         uint8_t const idxStatsTmp2 = iemNativeRegAllocTmp(pReNative, &off);
    6242         off = iemNativeEmitIncStamCounterInVCpu(pReNative, off, idxStatsTmp1, idxStatsTmp2,
    6243                                                 RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitReturnBreak));
    6244         iemNativeRegFreeTmp(pReNative, idxStatsTmp1);
    6245         iemNativeRegFreeTmp(pReNative, idxStatsTmp2);
     6251        off = iemNativeEmitNativeTbExitStats(pReNative, off, RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbExitReturnBreak));
    62466252#endif
    62476253
     
    92339239
    92349240#ifdef VBOX_WITH_STATISTICS
    9235         {
    9236             uint8_t const idxStatsTmp1 = iemNativeRegAllocTmp(pReNative, &off);
    9237             uint8_t const idxStatsTmp2 = iemNativeRegAllocTmp(pReNative, &off);
    9238             off = iemNativeEmitIncStamCounterInVCpu(pReNative, off, idxStatsTmp1, idxStatsTmp2,
    9239                                                     RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbFinished));
    9240             iemNativeRegFreeTmp(pReNative, idxStatsTmp1);
    9241             iemNativeRegFreeTmp(pReNative, idxStatsTmp2);
    9242         }
     9241        off = iemNativeEmitNativeTbExitStats(pReNative, off, RT_UOFFSETOF(VMCPUCC, iem.s.StatNativeTbFinished));
    92439242#endif
    92449243
     
    92919290        if (fTailLabels)
    92929291        {
    9293 #ifdef VBOX_WITH_STATISTICS
    9294             uint8_t const idxStatsTmp1 = iemNativeRegAllocTmp(pReNative, &off);
    9295             uint8_t const idxStatsTmp2 = iemNativeRegAllocTmp(pReNative, &off);
    9296 #endif
    9297 
    92989292            do
    92999293            {
     
    93099303
    93109304#ifdef VBOX_WITH_STATISTICS
    9311                     off = iemNativeEmitIncStamCounterInVCpu(pReNative, off, idxStatsTmp1, idxStatsTmp2,
    9312                                                             g_aSimpleTailLabels[enmLabel].offVCpuStats);
     9305                    off = iemNativeEmitNativeTbExitStats(pReNative, off, g_aSimpleTailLabels[enmLabel].offVCpuStats);
    93139306#endif
    93149307
     
    93229315
    93239316            } while (fTailLabels);
    9324 
    9325 #ifdef VBOX_WITH_STATISTICS
    9326             iemNativeRegFreeTmp(pReNative, idxStatsTmp1);
    9327             iemNativeRegFreeTmp(pReNative, idxStatsTmp2);
    9328 #endif
    93299317        }
    93309318    }
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