Skip to content

feat(threads): implement phases 17 through 20 - #931

Merged
fglock merged 5 commits into
masterfrom
feature/perl-threads-phases-17-20
Aug 12, 2026
Merged

feat(threads): implement phases 17 through 20#931
fglock merged 5 commits into
masterfrom
feature/perl-threads-phases-17-20

Conversation

@fglock

@fglock fglock commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • add the internal platform-thread control block, runtime-family registry, parent/child ownership, completion/error state, and one-shot join/detach transitions
  • expose the deliberately unadvertised basic threads API with identity-map cloning of entry CODE/arguments and context-correct cloning of join results
  • add controlled threads->exit, retained uncaught errors, nested threads, child-owned END handling, and explicit safe limitations for kill
  • implement threads::shared, share, is_shared, shared_clone, and real :shared marking for supported scalar/array/hash storage
  • keep Config thread capability flags disabled until the Phase 22 activation matrix
  • update the living concurrency and attributes design documents; detailed completed-phase history remains in commit and PR history

Commit boundaries

  1. Phase 17: internal control blocks
  2. Phase 18: basic Perl API
  3. Phase 19: lifecycle semantics
  4. Phase 20: shared storage

Each commit preserves a functional compiler and is independently reviewable/revertible.

Validation

  • make — PASS
  • new basic, lifecycle, and shared-storage tests — PASS with system Perl
  • the three new semantic tests — PASS on PerlOnJava JVM and interpreter backends
  • make test-all — completed successfully with the established partial-support baseline: core 83.1%, bundled modules 80.8%

Deferred intentionally

  • locks and condition variables (Phase 21)
  • Config activation and the broader core/CPAN compatibility matrix (Phase 22)
  • safe asynchronous kill semantics
  • sharing policies for blessed and tied storage

fglock and others added 5 commits August 12, 2026 12:50
Implement platform-thread ownership, runtime-family IDs, parent relationships,
completion and error capture, one-shot join/detach transitions, and registry
cleanup. Runtime snapshots created for managed threads retain the family
registry without exposing the Perl threads API or changing Config flags.

See dev/design/concurrency.md Phase 17.

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

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
Replace the detached harness stub with working create/new/async, identity,
listing, state, join, detach, yield, and equality operations. The thread entry
CODE reference and arguments share the runtime snapshot identity map; return
values cross back through a new graph clone in the caller's context.

Keep Config thread capability flags disabled until the activation phase.
See dev/design/concurrency.md Phase 18.

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

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
Add a dedicated thread-exit unwind, retain uncaught errors for error(), run
child-owned END queues before completion, support nested thread ownership, and
clean joined or detached registry entries without unsafe Java thread stopping.
Materialize lazy named subs before snapshots so child API calls do not retain
parent-only compiler suppliers.

The kill API remains an explicit no-op until a safe compatible mechanism is
defined. See dev/design/concurrency.md Phase 19.

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

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
Implement threads::shared share, is_shared, and shared_clone plus real :shared
attribute handling for scalar, array, and hash storage. Shared nodes retain
identity across ithread graph clones, aggregates use synchronized backing
collections, and scalar payloads provide cross-thread visibility.

Reject blessed and tied storage in this first tranche; locks and condition
variables remain Phase 21. Update the living design and attribute reference.
See dev/design/concurrency.md Phase 20.

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

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
Rebase the phase 17-20 train onto the runtime fixes merged in PRs 927
and 930, then repair the remaining thread activation regressions.

Keep lazy named subroutines lazy across runtime snapshots while rebinding
their compiler suppliers to the source runtime and cloning the completed
definition into the child. Avoid BEGIN-time compiler-lock deadlocks by
retaining the detached stub boundary until ithreads are advertised.

Also reject directory-only classpath resources from require, restoring the
RT #24404 behavior after adding the threads/shared.pm resource directory.

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

Co-Authored-By: Codex <223018245+openai-codex[bot]@users.noreply.github.com>
@fglock
fglock force-pushed the feature/perl-threads-phases-17-20 branch from 641e3d6 to 51cbf1d Compare August 12, 2026 12:12
@fglock
fglock merged commit 7de9f00 into master Aug 12, 2026
2 checks passed
@fglock
fglock deleted the feature/perl-threads-phases-17-20 branch August 12, 2026 12:33
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