Class SymRegistry


  • public class SymRegistry
    extends Object
    The bidirectional registry of syms and sym-handles.

    A sym-handle is an int value between 1 and 0x3fff_ffff corresponding to a sym. A handle is generated when getHandle(String) is called for the sym for the first time.

    The registry can be accessed from multiple threads concurrently.

    • Method Detail

      • getHandle

        public int getHandle​(String sym)
        Registers or gets the handle of the sym.
        Parameters:
        sym - the sym.
        Returns:
        the handle.
        Throws:
        IllegalStateException - if the sym is not registered yet, and the registry does not have capacity for the new sym.
      • getSym

        public String getSym​(int handle)
        Returns the corresponding sym for the handle.
        Parameters:
        handle - the handle.
        Returns:
        the corresponding sym for the handle.
        Throws:
        IllegalArgumentException - if the specified handle is not registered.
      • isValidHandle

        public boolean isValidHandle​(int handle)
        Returns true if the handle is registered.
        Parameters:
        handle - the handle.
        Returns:
        true if the handle is registered.