#string #symbol #pointers #cache #global #stored #grow

yanked mv-symbol-pool

A static, global string table for Move tools

0.1.0 May 22, 2022

#7 in #grow


Used in mv-ir-to-bytecode

Apache-2.0

14KB
178 lines

A global, uniqued cache of strings that is never purged. Inspired by servo/string-cache.

This module provides storage for strings that are meant to remain in use for the entire running duration of a program. Strings that are stored in this global, static cache are never evicted, and so the memory consumed by them can only ever grow.

The strings can be accessed via the Symbol type, which acts as a pointer to the underlying string data.

NOTE: If you're looking for a #[forbid(unsafe_code)] attribute here, you won't find one: symbol-pool (and its inspiration, servo/string-cache) uses unsafe Rust in order to store and dereference Symbol pointers to strings.

Dependencies

~0.4–1MB
~22K SLoC