$WW,1$$SP,"",BI=1$


























There is a symbol (hash) table for each task.  When a sym is not found, the parent task's sym table is checked.  All tasks chain back to the $FG,2$Adam$FG$ task.

TempleOS sym tables are implemented with an array of linked-lists.  A num is generated from a string by $LK,"HashStr",A="MN:HashStr"$() to index into the array of linked-lists.  Multiple strings can generate the same num, so linked-lists are built.  Newer entries overshadow older ones.

There are various types of entries.  See $LK,"Hash Entry Types",A="MN:HTT_EXPORT_SYS_SYM"$.

$FG,5$Symbol Look-up$FG$ (Used many places including the $LK,"JIT Compiler",A="FF:::/Compiler/Lex.CPP,HashFind"$ and $LK,"Loader",A="FF:::/Kernel/KLoad.CPP,HashFind"$.)
1) Symbol name is $LK,"hashed",A="MN:SYS_HASH_STR"$ by adding and shifting the ASCII of all chars.
2) $LK,"hash table",A="MN:CHashTable"$->body[] array is indexed.
3) Linked-lst is traversed until match of text and type of entry.
4) If not found, $LK,"hash table",A="MN:CHashTable"$->next table is searched.

Duplicate entries are allowed -- they overshadow old entries.

$FG,5$Address-to-Symbol Look-up$FG$ (Slow because not important. We could use trees.)
1) PSect Cache is $LK,"scanned",A="MN:PSectCacheFind"$.
2) Hash Tables are $LK,"scanned",A="MN:PSectFind"$.
             0     Cat H  _   Cbs h      Dog    _   Dog       Bird Z      p      x         o               >     <     @     P  o   
)   '   )   ?   
)   ?   %  ?   
%  ?   %  '   
%  '   )   '   
=   '   =   ?   
            
            
Q   '   Q   ?   
  '     ?   
-  '   -  ?   
A  '   A  ?   
  '     ?   
&           
          
     &      
&      &      
:      :      
N      N      
b      b      
v      v      
2     2     
F     F     
Z     Z     
          
            
            
            
            
   ?         
            
         ?   
   ?      ?         &         3   )   3            C    