mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
77 lines
No EOL
2 KiB
Text
Executable file
77 lines
No EOL
2 KiB
Text
Executable file
$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.HC,HashFind"$ and $LK,"Loader",A="FF:::/Kernel/KLoad.HC,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) FunSeg Cache is $LK,"scanned",A="MN:FunSegCacheFind"$.
|
||
2) Hash Tables are $LK,"scanned",A="MN:FunSegFind"$.
|
||
|