Skip to content

docs: multiplicity v2 incremental re-implementation plan#489

Merged
fglock merged 1 commit intomasterfrom
docs/multiplicity-v2-plan
Apr 11, 2026
Merged

docs: multiplicity v2 incremental re-implementation plan#489
fglock merged 1 commit intomasterfrom
docs/multiplicity-v2-plan

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 11, 2026

Summary

Adds a detailed incremental re-implementation plan for multiplicity after PR #480 was reverted (PR #487).

Root cause of the revert

RuntimeRegex.matchRegexWithTimeout() spawns executor threads for alarm-based regex timeout. After the multiplicity migration, these threads had no PerlRuntime bound via ThreadLocal, causing IllegalStateException when accessing per-runtime regex state. This broke CPAN::Module::parse_version -> MM->parse_version('jar:PERL5LIB/Scalar/Util.pm') -> Moo tests.

What this plan changes

Instead of one 96-file PR, the work is broken into 16 independently testable phases:

  • Phase 1: Thread-safety fixes (AtomicInteger counters) — minimal risk
  • Phases 2-10: Incremental state migration (I/O, CallerStack, DynamicScope, regex, InheritanceResolver, GlobalVariable, RuntimeCode, WarningBits, ByteCodeSourceMapper)
  • Phase 11: COMPILE_LOCK for compilation thread safety
  • Phase 12: Thread binding for all background threads (the specific fix for the revert)
  • Phase 13: Per-runtime CWD + PID
  • Phase 14: Performance optimization (Tier 1-3 from multiplicity-opt branch)
  • Phase 15: JvmClosureTemplate + eval STRING fixes
  • Phase 16: Demo + documentation

Each phase has its own validation gate: make + make test-all + Scalar::Util version check.

Reference branches

  • feature/multiplicity — original implementation (diff target for each phase)
  • feature/multiplicity-opt — performance optimizations
  • feature/multiplicity-v2 — post-revert fixes

Test plan

  • make passes
  • Documentation-only change, no code behavior affected

Generated with Devin

PR #480 was reverted due to a Scalar::Util version parsing error
that broke Moo tests. Root cause: regex timeout executor threads
had no PerlRuntime bound via ThreadLocal.

This plan breaks the original 96-file monolithic PR into 16
independently testable phases, each with its own validation gate.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 1eea8c3 into master Apr 11, 2026
2 checks passed
@fglock fglock deleted the docs/multiplicity-v2-plan branch April 11, 2026 11:34
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