VirtualBox

Changeset 105997 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Sep 10, 2024 8:55:10 AM (4 months ago)
Author:
vboxsync
Message:

VMM/IEM: Introduce a ReturnZero label when using per-chunk tail code, saving one instruction per TB. (todo 16) bugref:10720

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

Legend:

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

    r105877 r105997  
    20962096    pReNative->Core.u64ArgVars             = UINT64_MAX;
    20972097
    2098     AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 23);
    20992098    pReNative->aidxUniqueLabels[0]         = UINT32_MAX;
    21002099    pReNative->aidxUniqueLabels[1]         = UINT32_MAX;
     
    21202119    pReNative->aidxUniqueLabels[21]        = UINT32_MAX;
    21212120    pReNative->aidxUniqueLabels[22]        = UINT32_MAX;
     2121#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
     2122    pReNative->aidxUniqueLabels[23]        = UINT32_MAX;
     2123    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 24);
     2124#else
     2125    AssertCompile(RT_ELEMENTS(pReNative->aidxUniqueLabels) == 23);
     2126#endif
    21222127
    21232128    pReNative->idxLastCheckIrqCallNo       = UINT32_MAX;
     
    89498954        STR_CASE_CMN(CheckBranchMiss);
    89508955        STR_CASE_CMN(Return);
     8956#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
     8957        STR_CASE_CMN(ReturnZero);
     8958#endif
    89518959        STR_CASE_CMN(ReturnBreak);
    89528960        STR_CASE_CMN(ReturnBreakFF);
     
    97849792         * Emit the epilog code.
    97859793         */
     9794        aoffLabels[kIemNativeLabelType_ReturnZero] = off;
     9795        off = iemNativeEmitGprZero(pReNative, off, IEMNATIVE_CALL_RET_GREG);
     9796
    97869797        aoffLabels[kIemNativeLabelType_Return] = off;
    97879798        off = iemNativeEmitCoreEpilog(pReNative, off);
     
    98839894        /* Make sure we've generate code for all labels. */
    98849895        for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(aoffLabels); i++)
    9885             Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_Return);
    9886 #endif
     9896            Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnZero);
     9897# endif
    98879898    }
    98889899    IEMNATIVE_CATCH_LONGJMP_BEGIN(pReNative, rc);
     
    99229933    for (uint32_t i = kIemNativeLabelType_Invalid + 1; i < RT_ELEMENTS(pCtx->apExitLabels); i++)
    99239934    {
    9924         Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_Return);
     9935        Assert(aoffLabels[i] != 0 || i == kIemNativeLabelType_ReturnZero);
    99259936        pCtx->apExitLabels[i] = &paFinalCommonCodeRx[aoffLabels[i]];
    99269937        Log10(("    apExitLabels[%u]=%p %s\n", i, pCtx->apExitLabels[i], iemNativeGetLabelName((IEMNATIVELABELTYPE)i, true)));
     
    1018010191        off = iemNativeRegFlushPendingWrites(pReNative, off);
    1018110192
     10193#ifndef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
    1018210194        /*
    1018310195         * Successful return, so clear the return register (eax, w0).
     
    1018510197        off = iemNativeEmitGprZero(pReNative, off, IEMNATIVE_CALL_RET_GREG);
    1018610198
    10187 #ifndef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
    1018810199        /*
    1018910200         * Emit the epilog code.
     
    1019610207         */
    1019710208        //off = iemNativeEmitBrk(pReNative, off, 0x1227);
    10198         off = iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_Return);
     10209        off = iemNativeEmitTbExit(pReNative, off, kIemNativeLabelType_ReturnZero);
    1019910210#endif
    1020010211
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r105895 r105997  
    501501    kIemNativeLabelType_ReturnWithFlags,
    502502    kIemNativeLabelType_NonZeroRetOrPassUp,
     503#ifdef IEMNATIVE_WITH_RECOMPILER_PER_CHUNK_TAIL_CODE
     504    kIemNativeLabelType_ReturnZero,             /**< Sets eax/w0 to zero and returns. */
     505#endif
    503506    kIemNativeLabelType_Return,
    504507    /** The last fixup for branches that can span almost the whole TB length.
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