Skip to content

Document why reset() intentionally skips NAME_CACHE/NAME_TABLE #149

@rocketman-code

Description

@rocketman-code

Context

PR #147 added a global interned name table (NAME_TABLE) with a thread-local cache (NAME_CACHE) for function name lookups. The reset() function clears all other thread-local state (STACK, RECORDS, REGISTERED, INVOCATIONS, FRAME_BUFFER, FRAMES) but intentionally does not clear the name cache or table.

Why it's correct

The intern table is append-only and IDs are stable -- clearing it during reset() would invalidate cached IDs in other threads' NAME_CACHE, causing stale lookups. Leaving it alone is the safer choice.

Ask

Add a brief comment in reset() explaining why NAME_CACHE and NAME_TABLE are intentionally not cleared. This aids future maintainability.

Scope

piano-runtime/src/collector.rs, reset() function (~line 776).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions