Skip to content

Feature adapt swift6 - #37

Open
pbk20191 wants to merge 76 commits into
masterfrom
feature/swift6
Open

Feature adapt swift6#37
pbk20191 wants to merge 76 commits into
masterfrom
feature/swift6

Conversation

@pbk20191

Copy link
Copy Markdown
Owner
  • Adapt Swift 6 Concurrency
  • Full Typed Throw
  • New Actor Isolation model

pbk20191 added 30 commits May 30, 2024 19:21
Conflicts:
	Sources/Tetra/Combine/ExperimentalMapTask.swift
Conflicts:
	Sources/Tetra/Combine/CompatAsyncThrowingPublisher.swift
Conflicts:
	Sources/Tetra/Combine/Combine+Concurrency.swift
	Sources/Tetra/Concurrency/AsyncTypedSequence.swift
…ehavior change in swift 6 which cause test fail
Fix Escaping Function Block crash in Debug mode
# Conflicts:
#	Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift
# Conflicts:
#	Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift
# Conflicts:
#	Sources/Tetra/Concurrency/CoreDataStack+Concurrency.swift
# Conflicts:
#	Sources/Tetra/Combine/ExperimentalMapTask.swift
#	Sources/Tetra/Combine/Publishers+MapTask.swift
#	Sources/Tetra/Combine/Publishers+TryMapTask.swift
@pbk20191
pbk20191 force-pushed the feature/swift6 branch 3 times, most recently from 9f6c8b8 to df57fdc Compare January 30, 2025 14:40
pbk20191 and others added 4 commits February 11, 2026 13:13
- StackBoundRunLoopExecutor (SerialExecutor facade) + KQScheduler engine over
  the ported SlicedJobQueue, wrapping a kqueue in a CFFileDescriptor run-loop
  source. Facade owns the run frame; stack-bound engine lifetime, pendingJobPop
  wake elision, producerGate quiescence.
- KQueueSelector (EVFILT_USER wake + 3-clock-domain EVFILT_TIMER) and
  SerialExecutorRef (current-executor peek via swift_task_getCurrentExecutor).
- Timer path: owning-thread ThreeArray<Timestamp?> armed set with arm-if-earlier;
  QoS-once boost release; per-lane drain fairness cap in runBatch.
- Gate SchedulingExecutor/RunLoopExecutor/MainExecutor SPI conformances behind
  the opt-in `SchedulingExecutorSPI` package trait (off by default so release
  toolchains build; TaskExecutor stays unconditional).
- Fix ThreeArray init precondition (5 -> 3) and SlicedJobQueue QoS-override
  install condition (was inverted).
- Tests: 14 (executor behavior, kqueue selector, engine lifetime/dealloc).

Also carries in-progress swift6 branch changes (CoreData/Combine/SwiftUI).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Syscall and protocol work on the kqueue run-loop engine, ported from
swift-platform-executors' StackBoundRunLoopExecutor2:

* Drop the per-lane thread QoS floor in the drain (platform convention:
  effective priority is thread base + producer overrides, as in
  libdispatch runloop queues; jobs are never demoted below the thread's
  base). Removes up to 6 __bsdthread_ctl traps per pump pass; background
  chain throughput improved ~3x in A/B measurement.
* Producer-arms timer protocol: enqueueTimer arms EVFILT_TIMER directly
  under the timer lock (armIfEarlierLocked) — no EVFILT_USER wake per
  timer enqueue, and the inPump owning-thread special case is gone.
* Merge armed deadlines into the TimerState lock (heaps + armed + FIFO
  sequence behind one createCheckedStateLock), replacing the unlocked
  owning-thread-only armed record.
* timerCount fast path: skip the fire/arm passes (no lock, no clock
  reads) when no timers exist; clock reads are lazy per non-empty heap.
* Move fired timer jobs into the ready lanes outside the timer lock via
  a reused dueBuffer, with thread:nil so the pump installs no override
  for jobs it is about to drain itself.
* Equal-deadline timers now pop in enqueue (FIFO) order via a sequence
  tie-break in TimestampJob.
* Priority->lane mapping uses the reference's inclusive band boundaries
  (>= 33/25/21/17); named priorities are unchanged.
* Wrap the drain pass in an explicit autoreleasepool (defensive for the
  bare-thread run loops on older OS floors).
* Move the capped lane drain from SlicedJobQueue.runBatch into the
  engine (drainReadyJobs/processLane), leaving SlicedJobQueue as a pure
  lanes+boost container; inline ThreeElement/FiveElement replace the
  rawLayout arrays.

Behavior pins in DrainSyscallDisciplineTests: QoS discipline, mid-pump
re-arm without producer wake, autorelease draining per pass, FIFO
tie-break, and the lane band mapping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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