-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
analyze: use a common namespace for all local and global PointerIds (#…
…1164) Currently, each function has its own namespace for local `PointerId`s: `PointerId::local(3)` in function `f` is distinct from `PointerId::local(3)` in function `g`. This creates some problems for pointee type inference*. This branch puts all functions' local `PointerId`s into a common namespace, with each function occupying a different range in that space. This means each `PointerId` is now globally unique, and code that is analyzing one function can mention `PointerId`s from a different function without ambiguity. Most analyses still only look at a single function; these use a sparse `PointerTable` that has entries only for global `PointerId`s (that is, `PointerId`s in the range allocated for globals) and for the local `PointerId`s of the current function. Any analyses that need to consider cross-function local `PointerId`s can use a single large `GlobalPointerTable` instead. --- \* The specific issue is this: the allocation in lighttpd's `buffer_init` is not initialized inside that function, so correctly inferring the type requires unifying type variables interprocedurally. The type variables for the pointee analysis are tracked in a `VarTable`, which contains `LTy`s. We'd like to track variables from all functions in one big `VarTable`, so that we can unify variables that originated in different functions. However, `LTy`s may contain local `PointerId`s, so a shared `VarTable` could mix up local `PointerId`s from different functions/namespaces, producing nonsensical results. The fix being applied here is to put all `PointerId`s into a single namespace, so all type variables can be tracked in a common `VarTable`, and there is no longer an obstacle to unifying type variables from different functions.
- Loading branch information
Showing
13 changed files
with
647 additions
and
481 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.