Skip to content

Commit 7e77edb

Browse files
committed
Use page-table presence checks in checker link stores
The checker's link-store wrappers answered Has by calling TryGet, so presence checks still resolved arena indexes even though the paged store can answer from the page entry alone. Route them to the store presence checks so checker queries get the cheaper path.
1 parent 31ee229 commit 7e77edb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎tsc/internal/checker/links.go‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ func (s *nodeLinkStore[V]) Get(node *ast.Node) *V {
2828
}
2929

3030
func (s *nodeLinkStore[V]) Has(node *ast.Node) bool {
31-
return s.TryGet(node) != nil
31+
id := uint64(s.gen.GetNodeId(node))
32+
if id >= ast.BlockIdOffset && id < ast.BlockIdOffset+maxPageLinkCount {
33+
return s.pages.Has(id - ast.BlockIdOffset)
34+
}
35+
return s.links.Has(id)
3236
}
3337

3438
func (s *nodeLinkStore[V]) TryGet(node *ast.Node) *V {
@@ -54,7 +58,11 @@ func (s *symbolLinkStore[V]) Get(symbol *ast.Symbol) *V {
5458
}
5559

5660
func (s *symbolLinkStore[V]) Has(symbol *ast.Symbol) bool {
57-
return s.TryGet(symbol) != nil
61+
id := uint64(s.gen.GetSymbolId(symbol))
62+
if id >= ast.BlockIdOffset && id < ast.BlockIdOffset+maxPageLinkCount {
63+
return s.pages.Has(id - ast.BlockIdOffset)
64+
}
65+
return s.links.Has(id)
5866
}
5967

6068
func (s *symbolLinkStore[V]) TryGet(symbol *ast.Symbol) *V {

0 commit comments

Comments
 (0)