Skip to content

feat: isolate symbol and eval runtime state - #925

Merged
fglock merged 1 commit into
masterfrom
feature/perl-threads-phases-8de9
Aug 11, 2026
Merged

feat: isolate symbol and eval runtime state#925
fglock merged 1 commit into
masterfrom
feature/perl-threads-phases-8de9

Conversation

@fglock

@fglock fglock commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • implement Perl threads plan phases 8d, 8e, and 9 as the requested combined PR
  • isolate glob/stash aliases and stash enumeration caches per runtime
  • isolate declarations, package/class/field/version services, and generated classloaders
  • isolate RuntimeCode eval registries, caches, callsites, inline caches, and backend flags
  • preserve existing static facades and generated-bytecode compatibility
  • batch runtime lookup on hot call paths to keep the full benchmark matrix within budget
  • simplify design progress tracking so completed history lives in commits and PRs

Thread compatibility flags remain disabled.

Phase boundaries

Phase 8d includes stash aliases, resolved-alias caching, glob aliases, and the stash enumeration cache. Runtime stashes themselves already live in the runtime-owned global hash table.

Phase 8e includes declared global sets, package-existence caching, generated classloaders, ClassRegistry, FieldRegistry, and package-version storage. Warning/feature registries remain compile state for Phase 10. NameNormalizer bless identity remains deferred to the lifecycle/cloning phase.

Phase 9 adds RuntimeCodeRuntimeState for eval IDs/classes/method handles/contexts, anonymous and interpreted code, pad constants, method callsites, inline method caches, and runtime-dependent interpreter/disassembly/lexical-alias flags. Generated fallback bytecode uses a runtime-aware interpreted-code facade.

Validation

  • exact-tree make: passed
  • make test-all: core 83.0%, bundled modules 80.8%
  • Scalar::Util 1.70: JVM and interpreter passed
  • Moo 2.005005: JVM and interpreter passed
  • focused stash, glob, strict-vars, localization, and eval tests: JVM and interpreter passed
  • one interpreter eval/goto miss reproduced identically on merged master and is pre-existing
  • no PerlOnJava3 test workers remained after validation

Performance

Three-run CPU-time medians against exact merged base ff04a83a6:

Benchmark Base This PR Delta
global 27.31s 24.81s -9%
lexical 10.01s 8.63s -14%
method 5.73s 4.95s -14%
closure 153.45s 149.59s -3%
regex 4.76s 4.66s -2%
eval string 70.48s 67.72s -4%

All six gates are within the 5% regression budget.

Implement Perl threads plan phases 8d, 8e, and 9 as the requested combined
change while keeping both compiler backends functional and thread feature
flags disabled.

Phase 8d moves stash aliases, resolved-alias caching, glob aliases, and stash
enumeration caches into GlobalRuntimeState. Static map facades remain stable
for existing compiler and runtime consumers, while equal-version stash cache
entries can no longer leak between runtimes.

Phase 8e moves declared scalar/array/hash sets, package-existence caching,
generated classloaders, Perl class registration, field inheritance metadata,
and package versions into the bound runtime. Reset replaces only that
runtime's loader and package services. NameNormalizer bless identity remains
deferred to the lifecycle/cloning phase; warning and feature registries remain
behind the compilation lock for Phase 10.

Phase 9 adds RuntimeCodeRuntimeState for eval IDs, classes, method handles,
contexts, anonymous/interpreted code registries, pad constants, method
callsites, inline method caches, and runtime-dependent backend flags. Generated
fallback bytecode retrieves interpreted code through a runtime-aware facade.
Hot subroutine entry and exit paths batch PerlRuntime lookup so the complete
six-benchmark matrix remains within budget.

Tests cover nested and concurrent bindings, conflicting aliases/stashes,
strict declaration isolation, package/class/field/version state, classloader
replacement, cache reset ownership, concurrent eval IDs, mixed backend eval
closures, and method dispatch. The exact-tree make passes; make test-all is
core 83.0% and bundled modules 80.8%. Scalar::Util 1.70, Moo 2.005005, and
focused stash/glob/eval tests pass on both backends. One interpreter eval/goto
miss was reproduced exactly on merged master. Same-base three-run CPU medians
improve by roughly 9% global, 14% lexical, 14% method, 3% closure, 2% regex,
and 4% eval-string.

Simplify dev/design/concurrency.md progress tracking per maintainer direction:
completed history is recovered from commit and PR messages, while the living
document retains current status, next steps, and open questions. Phase 10 is
next.

Generated with [Codex](https://openai.com/codex)

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
@fglock
fglock merged commit 01e3ddd into master Aug 11, 2026
2 checks passed
@fglock
fglock deleted the feature/perl-threads-phases-8de9 branch August 11, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant