Goose  Diff

Differences From Artifact [b11838e702]:

  • File bs/sema/overloadset.cpp — part of check-in [7bb051b826] at 2021-09-24 19:11:17 on branch trunk — Overload resolution: cache which overload was selected for a given argument tuple (user: achavasse size: 1697)

To Artifact [53e9233610]:

  • File bs/sema/overloadset.cpp — part of check-in [ec41139b5a] at 2021-10-23 16:34:55 on branch trunk — Implemented hashing of EIR terms (user: zlodo size: 1675)

50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
    }
}

optional< OverloadSet::Overload > OverloadSet::getResolutionFromCache( const Term& args ) const
{
    ProfileZoneScoped;


    for( auto&& [_,ovl] : Match( args, m_resolutionCache ) )
        return ovl;

    return nullopt;
}

void OverloadSet::addResolutionToCache( const Term& args, const Overload& ovl )
{
    ProfileZoneScoped;

    m_resolutionCache = Merge( m_resolutionCache, args,
        [&]( auto&& ) { return ovl; } );
}







>
|
|

|





<
|
<

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

67

68
    }
}

optional< OverloadSet::Overload > OverloadSet::getResolutionFromCache( const Term& args ) const
{
    ProfileZoneScoped;

    auto it = m_resolutionCache.find( args );
    if( it == m_resolutionCache.end() )
        return nullopt;

    return it->second;
}

void OverloadSet::addResolutionToCache( const Term& args, const Overload& ovl )
{
    ProfileZoneScoped;

    m_resolutionCache.emplace( args, ovl );

}