Polyglot Resolution via Inverted Symbol Map
, the call-graph builder in Eulix
PRISM is the part of libeulix that decides, for every call in your code, which function it calls. It works from syntax alone, with no build step and no type checker, so it runs on large repositories that mix languages.
- Full name
- Polyglot Resolution via Inverted Symbol Map
- Part of
- libeulix (Rust)
- Versions
- v2, scope-aware and the default; v1, name-only and fastest
- Checked against
- go/types, javac, jedi, rust-analyzer, the TypeScript checker and libclang
What PRISM does
A call graph records which function calls which. Eulix uses it to answer caller and callee questions straight from the index, and to pull related code into retrieval.
Getting every edge right usually takes a full type checker for each language, which is slow and often unavailable. PRISM keeps an index from every name to its definitions instead (the inverted symbol map) and resolves each call with a lookup.
How PRISM v2 picks a target
For a call to a name, v2 looks for a definition in this order and stops at the first match:
- the same file;
- the files that file imports;
- the same directory;
- the whole project, but only when few definitions share the name.
Methods, and when it declines to guess
For a method call such as self.validate(), v2 starts at the method’s own class and walks up through its parent classes.
When a name is shared by too many definitions to guess responsibly, PRISM draws no edge at all. A missing edge misleads retrieval less than a wrong one.
v1 and v2
PRISM v1 links every call to the first definition with that name. It is the fastest option and uses little memory on very large repositories, at the cost of wrong edges on common names like run or handle. v2 adds scope, imports and class hierarchy, and is the default.
How accurate it is
On eight projects, one per language, 98.6% of the edges PRISM v2 drew were correct, against 54.6% for v1. Each edge was checked against the call sites the language’s own compiler tooling resolves.
Recall is the trade-off: v2 skips calls whose receiver type isn’t written in the source, so Rust and C++ miss more edges than they get wrong.
PRISM documentation
- PRISM v2The default resolver: the scope ladder, receivers and PHP rules.
- PRISM v1The name-only resolver and when it is the right choice.
- Call-graph accuracyPrecision and recall per language, and how they were measured.
- PRISM v2 methodologyThe formal write-up, with the full maths.
- Parser and PRISM issuesOpen problems and workarounds.
- libeulix overviewThe Rust analysis engine PRISM is part of.