VirtualBox

Ignore:
Timestamp:
Nov 29, 2023 9:09:08 PM (14 months ago)
Author:
vboxsync
Message:

VMM/IEM: Fixed problem in iemNativeEmitStoreGregU16 where we ended up not loading a stack-bound variable into register when calling iemNativeVarAllocRegister. Delayed stack space allocation till we really need it, so that idxStackSlot and idxReg together indicates whether a variable has been initialized or not. Some other arm fixes. bugref:10371

File:
1 edited

Legend:

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

    r102370 r102385  
    149149DECL_FORCE_INLINE(void) iemNativeRegClearGstRegShadowingOne(PIEMRECOMPILERSTATE pReNative, uint8_t idxHstReg,
    150150                                                            IEMNATIVEGSTREG enmGstReg, uint32_t off);
     151
     152static uint8_t iemNativeVarGetStackSlot(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar);
    151153
    152154
     
    24152417            uint32_t const idxVar = ASMBitFirstSetU32(fVars) - 1;
    24162418            uint8_t const  idxReg = pReNative->Core.aVars[idxVar].idxReg;
     2419/** @todo Prevent active variables from changing here... */
    24172420            if (   idxReg < RT_ELEMENTS(pReNative->Core.aHstRegs)
    24182421                && (RT_BIT_32(idxReg) & fRegMask)
     
    24302433                if (pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack)
    24312434                {
    2432                     AssertStmt(pReNative->Core.aVars[idxVar].idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS,
    2433                                IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_REG_IPE_8));
    2434                     *poff = iemNativeEmitStoreGprByBp(pReNative, *poff, iemNativeVarCalcBpDisp(pReNative, idxVar), idxReg);
     2435                    uint8_t const idxStackSlot = iemNativeVarGetStackSlot(pReNative, idxVar);
     2436                    *poff = iemNativeEmitStoreGprByBp(pReNative, *poff, iemNativeStackCalcBpDisp(idxStackSlot), idxReg);
    24352437                }
    24362438
     
    25492551     * Otherwise we must spill the register onto the stack.
    25502552     */
    2551     uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     2553    uint8_t const idxStackSlot = iemNativeVarGetStackSlot(pReNative, idxVar);
    25522554    Log12(("iemNativeRegMoveOrSpillStackVar: spilling idxVar=%d/idxReg=%d onto the stack (slot %#x bp+%d, off=%#x)\n",
    25532555           idxVar, idxRegOld, idxStackSlot, iemNativeStackCalcBpDisp(idxStackSlot), off));
    2554     AssertStmt(idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_REG_IPE_7));
    25552556    off = iemNativeEmitStoreGprByBp(pReNative, off, iemNativeStackCalcBpDisp(idxStackSlot), idxRegOld);
    25562557
     
    53385339
    53395340/**
     5341 * Gets the stack slot for a stack variable, allocating one if necessary.
     5342 *
     5343 * Calling this function implies that the stack slot will contain a valid
     5344 * variable value.  The caller deals with any register currently assigned to the
     5345 * variable, typically by spilling it into the stack slot.
     5346 *
     5347 * @returns The stack slot number.
     5348 * @param   pReNative   The recompiler state.
     5349 * @param   idxVar      The variable.
     5350 * @throws  VERR_IEM_VAR_OUT_OF_STACK_SLOTS
     5351 */
     5352static uint8_t iemNativeVarGetStackSlot(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar)
     5353{
     5354    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar);
     5355    Assert(pReNative->Core.aVars[idxVar].enmKind == kIemNativeVarKind_Stack);
     5356
     5357    /* Already got a slot? */
     5358    uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     5359    if (idxStackSlot != UINT8_MAX)
     5360    {
     5361        Assert(idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS);
     5362        return idxStackSlot;
     5363    }
     5364
     5365    /*
     5366     * A single slot is easy to allocate.
     5367     * Allocate them from the top end, closest to BP, to reduce the displacement.
     5368     */
     5369    if (pReNative->Core.aVars[idxVar].cbVar <= sizeof(uint64_t))
     5370    {
     5371        unsigned const iSlot = ASMBitLastSetU32(~pReNative->Core.bmStack) - 1;
     5372        AssertStmt(iSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
     5373        pReNative->Core.bmStack |= RT_BIT_32(iSlot);
     5374        pReNative->Core.aVars[idxVar].idxStackSlot = (uint8_t)iSlot;
     5375        Log11(("iemNativeVarSetKindToStack: idxVar=%d iSlot=%#x\n", idxVar, iSlot));
     5376        return (uint8_t)iSlot;
     5377    }
     5378
     5379    /*
     5380     * We need more than one stack slot.
     5381     *
     5382     * cbVar -> fBitAlignMask: 16 -> 1; 32 -> 3; 64 -> 7;
     5383     */
     5384    AssertCompile(RT_IS_POWER_OF_TWO(IEMNATIVE_FRAME_VAR_SLOTS)); /* If not we have to add an overflow check. */
     5385    Assert(pReNative->Core.aVars[idxVar].cbVar <= 64);
     5386    uint32_t const fBitAlignMask = RT_BIT_32(ASMBitLastSetU32(pReNative->Core.aVars[idxVar].cbVar) - 4) - 1;
     5387    uint32_t       fBitAllocMask = RT_BIT_32((pReNative->Core.aVars[idxVar].cbVar + 7) >> 3) - 1;
     5388    uint32_t       bmStack       = ~pReNative->Core.bmStack;
     5389    while (bmStack != UINT32_MAX)
     5390    {
     5391/** @todo allocate from the top to reduce BP displacement. */
     5392        unsigned const iSlot = ASMBitFirstSetU32(bmStack) - 1;
     5393        AssertStmt(iSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
     5394        if (!(iSlot & fBitAlignMask))
     5395        {
     5396            if ((bmStack & (fBitAllocMask << iSlot)) == (fBitAllocMask << iSlot))
     5397            {
     5398                pReNative->Core.bmStack |= (fBitAllocMask << iSlot);
     5399                pReNative->Core.aVars[idxVar].idxStackSlot = (uint8_t)iSlot;
     5400                Log11(("iemNativeVarSetKindToStack: idxVar=%d iSlot=%#x/%#x (cbVar=%#x)\n",
     5401                       idxVar, iSlot, fBitAllocMask, pReNative->Core.aVars[idxVar].cbVar));
     5402                return (uint8_t)iSlot;
     5403            }
     5404        }
     5405        bmStack |= fBitAlignMask << (iSlot & ~fBitAlignMask);
     5406    }
     5407    AssertFailedStmt(IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
     5408}
     5409
     5410
     5411/**
    53405412 * Changes the variable to a stack variable.
    53415413 *
     
    53455417 * @param   pReNative   The recompiler state.
    53465418 * @param   idxVar      The variable.
    5347  * @throws  VERR_IEM_VAR_OUT_OF_STACK_SLOTS, VERR_IEM_VAR_IPE_2
     5419 * @throws  VERR_IEM_VAR_IPE_2
    53485420 */
    53495421static void iemNativeVarSetKindToStack(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar)
     
    53605432        pReNative->Core.aVars[idxVar].enmKind = kIemNativeVarKind_Stack;
    53615433
    5362         if (pReNative->Core.aVars[idxVar].idxStackSlot == UINT8_MAX)
    5363         {
    5364             if (pReNative->Core.aVars[idxVar].cbVar <= sizeof(uint64_t))
    5365             {
    5366                 unsigned const iSlot = ASMBitFirstSetU32(~pReNative->Core.bmStack) - 1;
    5367                 AssertStmt(iSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
    5368                 pReNative->Core.bmStack |= RT_BIT_32(iSlot);
    5369                 pReNative->Core.aVars[idxVar].idxStackSlot = iSlot;
    5370                 Log11(("iemNativeVarSetKindToStack: idxVar=%d iSlot=%#x\n", idxVar, iSlot));
    5371                 return;
    5372             }
    5373             /* cbVar -> fBitAlignMask: 16 -> 1; 32 -> 3; 64 -> 7;*/
    5374             AssertCompile(RT_IS_POWER_OF_TWO(IEMNATIVE_FRAME_VAR_SLOTS)); /* If not we have to add an overflow check. */
    5375             Assert(pReNative->Core.aVars[idxVar].cbVar <= 64);
    5376             uint32_t const fBitAlignMask = RT_BIT_32(ASMBitLastSetU32(pReNative->Core.aVars[idxVar].cbVar) - 4) - 1;
    5377             uint32_t       fBitAllocMask = RT_BIT_32((pReNative->Core.aVars[idxVar].cbVar + 7) >> 3) - 1;
    5378             uint32_t       bmStack       = ~pReNative->Core.bmStack;
    5379             while (bmStack != UINT32_MAX)
    5380             {
    5381                 unsigned const iSlot = ASMBitFirstSetU32(bmStack) - 1;
    5382                 AssertStmt(iSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
    5383                 if (!(iSlot & fBitAlignMask))
    5384                 {
    5385                     if ((bmStack & (fBitAllocMask << iSlot)) == (fBitAllocMask << iSlot))
    5386                     {
    5387                         pReNative->Core.bmStack |= (fBitAllocMask << iSlot);
    5388                         pReNative->Core.aVars[idxVar].idxStackSlot = iSlot;
    5389                         Log11(("iemNativeVarSetKindToStack: idxVar=%d iSlot=%#x/%#x (cbVar=%#x)\n",
    5390                                idxVar, iSlot, fBitAllocMask, pReNative->Core.aVars[idxVar].cbVar));
    5391                         return;
    5392                     }
    5393                 }
    5394                 bmStack |= fBitAlignMask << (iSlot & ~fBitAlignMask);
    5395             }
    5396             AssertFailedStmt(IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_OUT_OF_STACK_SLOTS));
    5397         }
     5434        /* Note! We don't allocate a stack slot here, that's only done when a
     5435                 slot is actually needed to hold a variable value. */
    53985436    }
    53995437}
     
    55455583 * @param   idxVar      The variable.
    55465584 * @param   poff        Pointer to the instruction buffer offset.
    5547  *                      In case a register needs to be freed up.
    5548  */
    5549 DECL_HIDDEN_THROW(uint8_t) iemNativeVarAllocRegister(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar, uint32_t *poff)
     5585 *                      In case a register needs to be freed up or the value
     5586 *                      loaded off the stack.
     5587 * @param  fInitialized Set if the variable must already have been initialized.
     5588 *                      Will throw VERR_IEM_VAR_NOT_INITIALIZED if this is not
     5589 *                      the case.
     5590 */
     5591DECL_HIDDEN_THROW(uint8_t) iemNativeVarAllocRegister(PIEMRECOMPILERSTATE pReNative, uint8_t idxVar,
     5592                                                     uint32_t *poff, bool fInitialized = false)
    55505593{
    55515594    IEMNATIVE_ASSERT_VAR_IDX(pReNative, idxVar);
    55525595    Assert(pReNative->Core.aVars[idxVar].cbVar <= 8);
     5596/** @todo we must mark the variable as active and add a release function to
     5597 *        mark it as inactive, otherwise temporary register allocations may
     5598 *        cause the variable to be spilled onto the stack. */
    55535599
    55545600    uint8_t idxReg = pReNative->Core.aVars[idxVar].idxReg;
     
    56195665    iemNativeRegMarkAllocated(pReNative, idxReg, kIemNativeWhat_Var, idxVar);
    56205666    pReNative->Core.aVars[idxVar].idxReg = idxReg;
     5667
     5668    /*
     5669     * Load it off the stack if we've got a stack slot.
     5670     */
     5671    uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     5672    if (idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS)
     5673    {
     5674        int32_t const offDispBp = iemNativeStackCalcBpDisp(idxStackSlot);
     5675        switch (pReNative->Core.aVars[idxVar].cbVar)
     5676        {
     5677            case 1: *poff = iemNativeEmitLoadGprByBpU8( pReNative, *poff, idxReg, offDispBp); break;
     5678            case 2: *poff = iemNativeEmitLoadGprByBpU16(pReNative, *poff, idxReg, offDispBp); break;
     5679            case 3: AssertFailed(); RT_FALL_THRU();
     5680            case 4: *poff = iemNativeEmitLoadGprByBpU32(pReNative, *poff, idxReg, offDispBp); break;
     5681            default: AssertFailed(); RT_FALL_THRU();
     5682            case 8: *poff = iemNativeEmitLoadGprByBp(   pReNative, *poff, idxReg, offDispBp); break;
     5683        }
     5684    }
     5685    else
     5686    {
     5687        Assert(idxStackSlot == UINT8_MAX);
     5688        AssertStmt(!fInitialized, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED));
     5689    }
    56215690    return idxReg;
    56225691}
     
    57095778    else
    57105779    {
    5711         uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
    5712         AssertStmt(idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_7));
    5713         int32_t const offDispBp = iemNativeStackCalcBpDisp(idxStackSlot);
     5780        uint8_t const idxStackSlot = iemNativeVarGetStackSlot(pReNative, idxVar);
     5781        int32_t const offDispBp    = iemNativeStackCalcBpDisp(idxStackSlot);
    57145782        switch (pReNative->Core.aVars[idxVar].cbVar)
    57155783        {
     
    57785846{
    57795847    uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
    5780     Assert(idxStackSlot == UINT8_MAX || idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS);
    57815848    if (idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS)
    57825849    {
     
    57905857        pReNative->Core.aVars[idxVar].idxStackSlot = UINT8_MAX;
    57915858    }
     5859    else
     5860        Assert(idxStackSlot == UINT8_MAX);
    57925861}
    57935862
     
    60286097                if (idxRegOld < RT_ELEMENTS(pReNative->Core.aHstRegs))
    60296098                {
    6030                     uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     6099                    uint8_t const idxStackSlot = iemNativeVarGetStackSlot(pReNative, idxVar);
    60316100                    Log12(("iemNativeEmitCallCommon: spilling idxVar=%d/idxReg=%d (referred to by %d) onto the stack (slot %#x bp+%d, off=%#x)\n",
    60326101                           idxVar, idxRegOld, pReNative->Core.aVars[idxVar].idxReferrerVar,
    60336102                           idxStackSlot, iemNativeStackCalcBpDisp(idxStackSlot), off));
    6034                     AssertStmt(idxStackSlot < IEMNATIVE_FRAME_VAR_SLOTS, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_REG_IPE_7));
    60356103                    off = iemNativeEmitStoreGprByBp(pReNative, off, iemNativeStackCalcBpDisp(idxStackSlot), idxRegOld);
    60366104
     
    61286196                {
    61296197                    case kIemNativeVarKind_Stack:
    6130                         AssertStmt(pReNative->Core.aVars[idxVar].idxStackSlot != UINT8_MAX,
    6131                                    IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_3));
     6198                    {
     6199                        uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     6200                        AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED));
    61326201                        off = iemNativeEmitLoadGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG /* is free */,
    6133                                                        iemNativeVarCalcBpDisp(pReNative, idxVar));
     6202                                                       iemNativeStackCalcBpDisp(idxStackSlot));
    61346203                        off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDisp, IEMNATIVE_CALL_ARG0_GREG);
    61356204                        continue;
     6205                    }
    61366206
    61376207                    case kIemNativeVarKind_Immediate:
     
    61416211                    case kIemNativeVarKind_VarRef:
    61426212                    {
    6143                         uint8_t const idxOtherVar = pReNative->Core.aVars[idxVar].u.idxRefVar;
     6213                        uint8_t const idxOtherVar    = pReNative->Core.aVars[idxVar].u.idxRefVar;
    61446214                        Assert(idxOtherVar < RT_ELEMENTS(pReNative->Core.aVars));
    6145                         AssertStmt(   pReNative->Core.aVars[idxOtherVar].idxStackSlot != UINT8_MAX
    6146                                    && pReNative->Core.aVars[idxOtherVar].idxReg       == UINT8_MAX,
    6147                                    IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_4));
    6148                         off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG,
    6149                                                       iemNativeStackCalcBpDisp(pReNative->Core.aVars[idxOtherVar].idxStackSlot));
     6215                        uint8_t const idxStackSlot   = iemNativeVarGetStackSlot(pReNative, idxOtherVar);
     6216                        int32_t const offBpDispOther = iemNativeStackCalcBpDisp(idxStackSlot);
     6217                        uint8_t const idxRegOther    = pReNative->Core.aVars[idxOtherVar].idxReg;
     6218                        if (idxRegOther < RT_ELEMENTS(pReNative->Core.aHstRegs))
     6219                        {
     6220                            off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDispOther, idxRegOther);
     6221                            pReNative->Core.aVars[idxOtherVar].idxReg = UINT8_MAX;
     6222                        }
     6223                        Assert(   pReNative->Core.aVars[idxOtherVar].idxStackSlot != UINT8_MAX
     6224                               && pReNative->Core.aVars[idxOtherVar].idxReg       == UINT8_MAX);
     6225                        off = iemNativeEmitLeaGprByBp(pReNative, off, IEMNATIVE_CALL_ARG0_GREG, offBpDispOther);
    61506226                        off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDisp, IEMNATIVE_CALL_ARG0_GREG);
    61516227                        continue;
     
    62026278                    {
    62036279                        case kIemNativeVarKind_Stack:
    6204                             AssertStmt(pReNative->Core.aVars[idxVar].idxStackSlot != UINT8_MAX,
    6205                                        IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_3));
    6206                             off = iemNativeEmitLoadGprByBp(pReNative, off, idxArgReg, iemNativeVarCalcBpDisp(pReNative, idxVar));
     6280                        {
     6281                            uint8_t const idxStackSlot = pReNative->Core.aVars[idxVar].idxStackSlot;
     6282                            AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED));
     6283                            off = iemNativeEmitLoadGprByBp(pReNative, off, idxArgReg, iemNativeStackCalcBpDisp(idxStackSlot));
    62076284                            continue;
     6285                        }
    62086286
    62096287                        case kIemNativeVarKind_Immediate:
     
    62136291                        case kIemNativeVarKind_VarRef:
    62146292                        {
    6215                             uint8_t const idxOtherVar = pReNative->Core.aVars[idxVar].u.idxRefVar;
     6293                            uint8_t const idxOtherVar    = pReNative->Core.aVars[idxVar].u.idxRefVar;
    62166294                            Assert(idxOtherVar < RT_ELEMENTS(pReNative->Core.aVars));
    6217                             AssertStmt(   pReNative->Core.aVars[idxOtherVar].idxStackSlot != UINT8_MAX
    6218                                        && pReNative->Core.aVars[idxOtherVar].idxReg       == UINT8_MAX,
    6219                                        IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_4));
    6220                             off = iemNativeEmitLeaGprByBp(pReNative, off, idxArgReg,
    6221                                                           iemNativeStackCalcBpDisp(pReNative->Core.aVars[idxOtherVar].idxStackSlot));
     6295                            uint8_t const idxStackSlot   = iemNativeVarGetStackSlot(pReNative, idxOtherVar);
     6296                            int32_t const offBpDispOther = iemNativeStackCalcBpDisp(idxStackSlot);
     6297                            uint8_t const idxRegOther    = pReNative->Core.aVars[idxOtherVar].idxReg;
     6298                            if (idxRegOther < RT_ELEMENTS(pReNative->Core.aHstRegs))
     6299                            {
     6300                                off = iemNativeEmitStoreGprByBp(pReNative, off, offBpDispOther, idxRegOther);
     6301                                pReNative->Core.aVars[idxOtherVar].idxReg = UINT8_MAX;
     6302                            }
     6303                            Assert(   pReNative->Core.aVars[idxOtherVar].idxStackSlot != UINT8_MAX
     6304                                   && pReNative->Core.aVars[idxOtherVar].idxReg       == UINT8_MAX);
     6305                            off = iemNativeEmitLeaGprByBp(pReNative, off, idxArgReg, offBpDispOther);
    62226306                            continue;
    62236307                        }
     
    67826866    else
    67836867    {
    6784         AssertStmt(pReNative->Core.aVars[idxValueVar].idxStackSlot != UINT8_MAX,
    6785                    IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_IPE_4));
     6868        uint8_t const idxStackSlot = pReNative->Core.aVars[idxValueVar].idxStackSlot;
     6869        AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED));
    67866870        if (idxGstTmpReg >= 8)
    67876871            pbCodeBuf[off++] = X86_OP_REX_R;
    67886872        pbCodeBuf[off++] = 0x8b;
    6789         off = iemNativeEmitGprByBpDisp(pbCodeBuf, off, idxGstTmpReg, iemNativeVarCalcBpDisp(pReNative, idxValueVar), pReNative);
     6873        off = iemNativeEmitGprByBpDisp(pbCodeBuf, off, idxGstTmpReg, iemNativeStackCalcBpDisp(idxStackSlot), pReNative);
    67906874    }
    67916875
    67926876#elif defined(RT_ARCH_ARM64)
    67936877    /* bfi w1, w2, 0, 16 - moves bits 15:0 from idxVarReg to idxGstTmpReg bits 15:0. */
    6794     uint8_t const    idxVarReg   = iemNativeVarAllocRegister(pReNative, idxValueVar, &off);
     6878    uint8_t const    idxVarReg   = iemNativeVarAllocRegister(pReNative, idxValueVar, &off, true /*fInitialized*/);
    67956879    uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
    67966880    pu32CodeBuf[off++] = Armv8A64MkInstrBfi(idxGstTmpReg, idxVarReg, 0, 16);
     
    75167600        {
    75177601            off = iemNativeEmitLoadGprImm64(pReNative, off, idxRegRet, u32EffAddr);
    7518             uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 2);
    7519             pu32CodeBuf[off++] = Armv8A64MkInstrMovZ(idxRegRet, u32EffAddr);
    75207602            if (idxRegBase != UINT8_MAX)
     7603            {
     7604                uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
    75217605                pu32CodeBuf[off++] = Armv8A64MkInstrAddSubReg(false /*fSub*/, idxRegRet, idxRegRet, idxRegBase, false /*f64Bit*/);
     7606            }
    75227607        }
    75237608        if (idxRegIndex != UINT8_MAX)
     
    77157800        else
    77167801        {
     7802            uint8_t const idxStackSlot = pReNative->Core.aVars[idxVarGCPtrMem].idxStackSlot;
     7803            AssertStmt(idxStackSlot != UINT8_MAX, IEMNATIVE_DO_LONGJMP(pReNative, VERR_IEM_VAR_NOT_INITIALIZED));
    77177804            AssertFailed(); /** @todo This was probably caused by iemNativeRegMoveAndFreeAndFlushAtCall above. Improve... */
    7718             off = iemNativeEmitLoadGprByBp(pReNative, off, idxRegArgGCPtrMem, iemNativeVarCalcBpDisp(pReNative, idxVarGCPtrMem));
     7805            off = iemNativeEmitLoadGprByBp(pReNative, off, idxRegArgGCPtrMem, iemNativeStackCalcBpDisp(idxStackSlot));
    77197806            if (offDisp)
    77207807                off = iemNativeEmitAddGprImm(pReNative, off, idxRegArgGCPtrMem, offDisp);
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