-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Environment: ensure that the global frame does at most two lookups
When we try to access a variable, we do a lookup in the environment. The globalframe has a parent field, so we have no limit on the number of lookups. It may do multiple lookups until it finds a value or the parent is null. With this CL: - globalframe represents the symbols from the file - globalframe.parent represents the universe (builtins) - globalframe.parent.parent won't exist So it's at most two lookups. Later, we should reduce to just one lookup. After that, we can have further optimizations (e.g. array lookup instead of hashmap lookup). #5637 RELNOTES: None. PiperOrigin-RevId: 211143657
- Loading branch information
Showing
3 changed files
with
32 additions
and
54 deletions.
There are no files selected for viewing
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