File size: 1,041 Bytes
806d4b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | /* Graphics Not Rendered in HTML */ 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 Adam task. TempleOS sym tables are implemented with an array of linked-lists. A num is generated from a string by 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 Hash Entry Types. Symbol Look-up (Used many places including the JIT Compiler and Loader.) 1) Symbol name is hashed by adding and shifting the ASCII of all chars. 2) hash table->body[] array is indexed. 3) Linked-lst is traversed until match of text and type of entry. 4) If not found, hash table->next table is searched. Duplicate entries are allowed -- they overshadow old entries. Address-to-Symbol Look-up (Slow because not important. We could use trees.) 1) FunSeg Cache is scanned. 2) Hash Tables are scanned. |