Repository: dotnet/runtime
File: src/coreclr/jit/flowgraph.cpp (C++)

Code before:
    return fgAddCodeDscMap;
}

//------------------------------------------------------------------------
// fgCreateAddCodeDsc: Indicate that a particular throw helper block will
//   be needed by the method.
//
// Arguments:
//   srcBlk  - the block that needs an entry;
//   kind    - the kind of exception;
//
// Returns:
//    newly added AddCodeDsc
//
Compiler::AddCodeDsc* Compiler::fgCreateAddCodeDsc(BasicBlock* srcBlk, SpecialCodeKind kind)
{
    // Cannot allow new demands once we have created throw helper blocks
    //
    assert(!fgRngChkThrowAdded);

    // Fetch block data and designator
    //
    AcdKeyDesignator dsg     = AcdKeyDesignator::KD_NONE;
    unsigned const   refData = (kind == SCK_FAIL_FAST) ? 0 : bbThrowIndex(srcBlk, &dsg);

    // Allocate a new entry and prepend it to the list
    //
    AddCodeDsc* add  = new (this, CMK_BasicBlock) AddCodeDsc;
    add->acdDstBlk   = nullptr;
    add->acdTryIndex = srcBlk->bbTryIndex;

    // For non-funclet EH we don't constrain ACD placement via handler regions
    add->acdHndIndex = srcBlk->bbHndIndex;

    add->acdKeyDsg = dsg;
    add->acdKind   = kind;

    // This gets set true in the stack level setter
    // if there's still a need for this helper
    add->acdUsed = false;

#if !FEATURE_FIXED_OUT_ARGS
    add->acdStkLvl     = 0;
    add->acdStkLvlInit = false;
#endif // !FEATURE_FIXED_OUT_ARGS
    INDEBUG(add->acdNum = acdCount++);

    // Add to map
    //
    AddCodeDscMap* const map = fgGetAddCodeDscMap();
    AddCodeDscKey        key(add);

Review comment (suggestion):
This comment says the new `AddCodeDsc` is “prepended … to the list”, but the implementation now inserts it into `AddCodeDscMap` (and no list is being maintained here). Updating the comment would help avoid confusion about the data structure/insertion semantics.
```suggestion
    // Allocate a new entry and add it to the AddCodeDscMap
```

Code after:
    return fgAddCodeDscMap;
}

//------------------------------------------------------------------------
// fgCreateAddCodeDsc: Indicate that a particular throw helper block will
//   be needed by the method.
//
// Arguments:
//   srcBlk  - the block that needs an entry;
//   kind    - the kind of exception;
//
// Returns:
//    newly added AddCodeDsc
//
Compiler::AddCodeDsc* Compiler::fgCreateAddCodeDsc(BasicBlock* srcBlk, SpecialCodeKind kind)
{
    // Cannot allow new demands once we have created throw helper blocks
    //
    assert(!fgRngChkThrowAdded);

    // Fetch block data and designator
    //
    AcdKeyDesignator dsg     = AcdKeyDesignator::KD_NONE;
    unsigned const   refData = (kind == SCK_FAIL_FAST) ? 0 : bbThrowIndex(srcBlk, &dsg);

    // Allocate a new entry and add it to the AddCodeDscMap
    //
    AddCodeDsc* add  = new (this, CMK_BasicBlock) AddCodeDsc;
    add->acdDstBlk   = nullptr;
    add->acdTryIndex = srcBlk->bbTryIndex;

    // For non-funclet EH we don't constrain ACD placement via handler regions
    add->acdHndIndex = srcBlk->bbHndIndex;

    add->acdKeyDsg = dsg;
    add->acdKind   = kind;

    // This gets set true in the stack level setter
    // if there's still a need for this helper
    add->acdUsed = false;

#if !FEATURE_FIXED_OUT_ARGS
    add->acdStkLvl     = 0;
    add->acdStkLvlInit = false;
#endif // !FEATURE_FIXED_OUT_ARGS
    INDEBUG(add->acdNum = acdCount++);

    // Add to map
    //
    AddCodeDscMap* const map = fgGetAddCodeDscMap();
    AddCodeDscKey        key(add);