gccrs: Prioritize predicate items in method resolution
gccrs method resolution now checks predicate items first, potentially speeding up lookups.
As part of ongoing efforts to optimize method resolution in gccrs, this commit modifies the resolution logic to check predicate items before other lookup mechanisms. This change is expected to improve performance by potentially finding the correct method faster.
In Details
This commit continues the optimization series for gccrs's method resolution. It alters MethodResolver::select in typecheck/rust-hir-dot-operator.cc to prioritize checking 'predicate items' (likely constraints or associated types that must be satisfied) upfront. This is a heuristic performance improvement, aiming to avoid more expensive lookups when a resolution can be quickly satisfied by predicates.
- gccrs
- The GCC frontend for the Rust programming language. It translates Rust code into GCC's internal representation (GIMPLE) for optimization and code generation.
- Method Resolution
- The process by which a compiler determines which specific function or method to call when given a name, especially in object-oriented or trait-based systems. In Rust, this involves looking up methods defined in traits and their implementations.
- Predicate Items
- In the context of Rust trait resolution, predicate items likely refer to constraints or conditions that must be met for a particular trait implementation to be applicable. This could involve checking type parameters or associated types.