Stack graphs: Name resolution at scale

11/02/2022
by   Douglas A. Creager, et al.
0

We present stack graphs, an extension of Visser et al.'s scope graphs framework. Stack graphs power Precise Code Navigation at GitHub, allowing users to navigate name binding references both within and across repositories. Like scope graphs, stack graphs encode the name binding information about a program in a graph structure, in which paths represent valid name bindings. Resolving a reference to its definition is then implemented with a simple path-finding search. GitHub hosts millions of repositories, containing petabytes of total code, implemented in hundreds of different programming languages, and receiving thousands of pushes per minute. To support this scale, we ensure that the graph construction and path-finding judgments are file-incremental: for each source file, we create an isolated subgraph without any knowledge of, or visibility into, any other file in the program. This lets us eliminate the storage and compute costs of reanalyzing file versions that we have already seen. Since most commits change a small fraction of the files in a repository, this greatly amortizes the operational costs of indexing large, frequently changed repositories over time. To handle type-directed name lookups (which require "pausing" the current lookup to resolve another name), our name resolution algorithm maintains a stack of the currently paused (but still pending) lookups. Stack graphs can be constructed via a purely syntactic analysis of the program's source code, using a new declarative graph construction language. This means that we can extract name binding information for every repository without any per-package configuration, and without having to invoke an arbitrary, untrusted, package-specific build process.

READ FULL TEXT

page 3

page 4

page 6

research
09/21/2018

SCC: Automatic Classification of Code Snippets

Determining the programming language of a source code file has been cons...
research
06/03/2019

A Language-Agnostic Model for Semantic Source Code Labeling

Code search and comprehension have become more difficult in recent years...
research
06/18/2022

Fusing Industry and Academia at GitHub (Experience Report)

GitHub hosts hundreds of millions of code repositories written in hundre...
research
04/29/2020

Analyzing Smart Contracts: From EVM to a sound Control-Flow Graph

The EVM language is a simple stack-based language with words of 256 bits...
research
01/21/2021

Content-Based Textual File Type Detection at Scale

Programming language detection is a common need in the analysis of large...
research
08/22/2018

Reproducible data citations for computational research

The general purpose of a scientific publication is the exchange and spre...
research
07/27/2016

Comparing the Performance of Graphical Structure Learning Algorithms with TETRAD

In this report we describe a tool for comparing the performance of causa...

Please sign up or login with your details

Forgot password? Click here to reset