Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ The headline artifact is a states-explored reduction table: naive DFS → +hashi
Concurrency bugs — race conditions, deadlocks, missed signals — are notoriously hard to find because they depend on exact thread ordering. Rather than running a program once and hoping for the right schedule, this checker systematically explores every distinct interleaving and reports the exact `(thread, step)` schedule that reaches a bad state.

The selected [#12 bounded Java bytecode workstream](docs/plans/bytecode-contract.md)
now exposes the initial **bounded, sequentially consistent bytecode profile**: annotated fixed actors,
now exposes a **bounded, sequentially consistent bytecode heap profile**: annotated fixed actors,
exact DFS, monitor deadlocks, declared checks, artifact-bound evidence and strict replay through the
library, CLI, reports and viewer. Start with the [compiled lost-update and two-lock examples](examples/bytecode/README.md).
The [94C release ledger](docs/measurements/94C-bytecode-release.md) records validation and limitations;
[94B](docs/measurements/94B-bytecode-concurrency.md) owns the batching measurements and preservation argument.
Objects/arrays, general exceptions, wider primitives/libraries and additional bytecode search strategies
library, CLI, reports and viewer. Actor-created objects, primitive/reference arrays, aliases, closed hierarchy dispatch and transitive publication are supported. Start with the [compiled lost-update and two-lock examples](examples/bytecode/README.md).
The [95 heap ledger](docs/measurements/95-bytecode-heap.md) records heap acceptance and the extended batching argument;
[94C](docs/measurements/94C-bytecode-release.md) records initial release compatibility, and
[94B](docs/measurements/94B-bytecode-concurrency.md) records the earlier setup-only batching measurements.
General exceptions, wider primitive computation/libraries and additional bytecode search strategies
remain later phases. Weak-memory work remains unselected.

The project is a spec-driven proof of concept for small explicit models, bounded `.ilv` source and a
Expand Down
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ tasks.register<JavaExec>("profileBytecode") {
args(output.get(), fork.get())
}

// Spec95 heap measurement uses the same fixed heap and compacting collector as the94B runner.
tasks.register<JavaExec>("profileBytecodeHeap") {
group = "verification"
description = "Measure instruction/reference bytecode execution (Spec 95)"
dependsOn(tasks.testClasses)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("dev.samhb.interleave.bytecode.BytecodeHeapMeasurementTest")
javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(26)) })
minHeapSize = "512m"
maxHeapSize = "512m"
// Eliminate SerialGC dead-space retention, which otherwise contaminates live-heap deltas.
jvmArgs("-XX:+UseSerialGC", "-XX:MarkSweepDeadRatio=0")
val fork = providers.gradleProperty("profileFork").orElse("1")
val output = providers.gradleProperty("bytecodeProfileOutput")
.orElse(layout.buildDirectory.dir("reports/bytecode-heap-profile/fork-${fork.get()}").get().asFile.absolutePath)
args(output.get(), fork.get())
}

tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(26)
Expand Down
3 changes: 2 additions & 1 deletion docs/measurements/94C-compare-mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
parser.add_argument('baseline_classes',type=Path,help='Baseline build/classes/java/main directory')
parser.add_argument('feature_classes',type=Path,help='Feature build/classes/java/main directory')
parser.add_argument('--javap',default='javap',help='JDK 26 javap executable')
parser.add_argument('--replacement-report',action='append',help='Whole-class replacement XML in evidence; repeat in chronological order (default: historical94C reports)')
args=parser.parse_args()
EVIDENCE=args.evidence

Expand Down Expand Up @@ -77,7 +78,7 @@ def finish():

# Replace whole classes with the latest recorded run, never individual favorable mutants.
rows=list(E.parse(EVIDENCE/'affected-census.xml').getroot())
for name in ('postfix-focused.xml','final-codec-dto.xml','final-report-pit.xml'):
for name in (args.replacement_report or ('postfix-focused.xml','final-codec-dto.xml','final-report-pit.xml')):
current=list(E.parse(EVIDENCE/name).getroot())
assert current, name
replaced={m.findtext('mutatedClass') for m in current}
Expand Down
493 changes: 493 additions & 0 deletions docs/measurements/95-bytecode-heap.md

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions docs/plans/bytecode-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Objective and status

**Selected; 94A/94B implemented, 94C initial public profile locally accepted; PR/CI/manual review pending.** Approved scope: controlled interpretation of compiled Java for fixed
**Selected; 94A/94B/94C merged, 95 heap profile implemented and locally verified; draft PR/CI/manual acceptance pending.** Approved scope: controlled interpretation of compiled Java for fixed
actors under bounded sequential consistency (SC). The first public release must find a real lost update
and a two-lock deadlock through loading, search, evidence, strict replay, library/CLI, reports and viewer.
No target-code host-JVM fallback is permitted. This is not unrestricted Java or full Java Memory Model coverage.
Expand All @@ -14,7 +14,8 @@ and parked conditional/deferred tasks remain unselected. The specification PR es
evidence. The [94A implementation ledger](../measurements/94A-bytecode-foundation.md) records subsequent
loader/single-actor evidence; [the94B ledger](../measurements/94B-bytecode-concurrency.md) records
internal concurrent execution, batching preservation and measured setup-only sharedness costs. The [94C ledger](../measurements/94C-bytecode-release.md) records public library/CLI, replay and consumer
verification. Broader heap costs, restricted DPOR and JPF gates remain pending. [Vocabulary](../../CONTEXT.md) owns domain terms; this document
verification. The [95 ledger](../measurements/95-bytecode-heap.md) records dynamic heap/sharedness
measurements and local heap-profile acceptance. Restricted DPOR and JPF gates remain pending. [Vocabulary](../../CONTEXT.md) owns domain terms; this document
owns common behavior, interface seams, verification and phase boundaries.

## Sequential delivery and ownership
Expand Down Expand Up @@ -226,7 +227,9 @@ failure into PASS. An earlier established finding remains recorded if a later br
## Faults, monitors and verdicts

Model null field/monitor access as NullPointerException and integer divide/remainder zero as
ArithmeticException. Preserve prior instruction effects; the faulting opcode follows JVM semantics
ArithmeticException. Phase95 adds supported array/cast faults and the dynamic
IncompatibleClassChangeError for an incompatible interface receiver; statically known linkage failures
still reject during loading. Preserve prior instruction effects; the faulting opcode follows JVM semantics
and consumes fuel. Required cleanup/unwinding runs, then an uncaught actor exception is
VIOLATION/UNCAUGHT_EXCEPTION, distinct from CHECK_FALSE. Capture actor, exception type, throwing
class/method/descriptor/BCI, and interpreted frames; do not use a host stack as target evidence.
Expand Down Expand Up @@ -288,8 +291,8 @@ Cell limits bound modeled storage, not JVM bytes. Metadata/input caps and a glob
abort protect implementation overhead; report external safety aborts honestly as INCOMPLETE. Allocation,
cell and depth cutoffs name the omitted allocation/invoke location, reason and configured limit.
For simultaneous failures use fuel first, then opcode dynamic validity (e.g. negative length), then
array/String length, allocation count, cells, depth as applicable. Failed allocations charge no cells
or identities; an executed allocating opcode consumes fuel even if it cannot allocate. No exception
array/String length, allocation count, cells, depth as applicable. Each failed component allocation charges no cells
or identity; earlier successful multidimensional components remain committed as specified in95; an executed allocating opcode consumes fuel even if it cannot allocate. No exception
object allocation is required for initial modeled VM faults: bounded pending-fault metadata belongs
to actor state, with no fabricated user-visible Throwable before 96.

Expand Down Expand Up @@ -430,7 +433,8 @@ state relation, event matching, counterexample tests and limits. A green suite a

[verified, 94B] Reference/batched tiny-fixture measurements, setup-only sharedness costs and batching
preservation are recorded in the [94B ledger](../measurements/94B-bytecode-concurrency.md).
[unverified] Broader-heap sharedness costs, optimized reduction measurements and JPF compatibility.
[measured]95 records tiny cyclic/array heap fixtures and actual sharedness work; larger-graph costs
remain unmeasured. [unverified] Optimized reduction measurements and JPF compatibility.
[deferred research] Frozen exhausted actors, fuel-free cycle detection, broader cyclic DPOR and
initializer allowlists. None is a release requirement or implied optimization opportunity.

Expand Down
4 changes: 2 additions & 2 deletions docs/plans/future-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ milestones (94A–94C, 95–101). #11 and deferred/conditional work remain unsel
|---|---|---|---|---|---|
| 10 | Symmetry reduction — complete | High | Spec-set | [Spec 75](../specs/active/75-thread-symmetry-canonicalization.md), [Spec 76](../specs/active/76-source-symmetry-exact-search.md) and [Spec 77](../specs/active/77-source-symmetry-strategy-composition.md) shipped in PRs #117–119. Final composition merged at `d8ad49e`: checked source symmetry for exact DFS, static POR, DPOR and CBS, including iterative CBS and original-identity evidence. | Completed in three coherent stages: canonicalization/mappings; checked exact DFS and evidence; exact POR/DPOR/CBS composition with proof, callers and regressions. K1 / [Spec 89](../specs/active/89-approximate-symmetry-dfs-por.md) adds approximate bitstate composition for explicit DFS/static POR; [Spec 90](../specs/active/90-approximate-symmetry-cbs.md) adds CBS in K2; [Spec 91](../specs/active/91-approximate-symmetry-dpor.md) adds DPOR and all-strategy consumers in K3, completing B9 with PR #134 merged at `3d5c09e`. Arbitrary custom-store composition remains unsupported. [Spec 84](../specs/active/84-certified-symmetry-backends.md) adds a separately selected HASHED/ORDERED library storage choice under post-task-#10 B6. B10 [declarative JSON spec set](declarative-symmetry-contract.md) is selected: Specs 92/93 merged in PR #135; L1 exact support merged in PR #136 at `013c963`; L2 approximate support merged in PR #137 at `aebb919`, completing B10. All selected post-task-#10 follow-ups are complete. #12 is subsequently selected separately; #11 and deferred/conditional work remain parked. |
| 11 | Relaxed memory models | Very High | Spec-set | Fundamental semantics change — needs formal spec | Stage one selected memory model: state/transition foundations; complete execution and witness support; supported search/reduction integration. Keep each additional memory model separate. Exact PR count follows the semantics/proof scope. |
| 12 | Bounded Java bytecode checking — selected, initial public release | Very High | Spec-set | Controlled JDK 26 Class-File API interpretation of fixed actors under bounded SC; no target host execution. | [Shared contract and Specs 94A–101](bytecode-contract.md): internal foundation (94A), concurrent feasibility gate (94B), complete public release (94C), then heap, exceptions, core library, CBS, restricted DPOR, narrow atomics and bitstate. 94A adds internal loading/single-actor execution; [foundation evidence](../measurements/94A-bytecode-foundation.md). 94B adds internal concurrent exact DFS, checks and measured batching; [concurrency evidence](../measurements/94B-bytecode-concurrency.md). 94C adds public BYTECODE loading, strict replay, CLI, reports and viewer; [release evidence](../measurements/94C-bytecode-release.md). Target ten sequential implementation PRs; broader heap, DPOR measurements and JPF acceptance remain pending. |
| 12 | Bounded Java bytecode checking — selected, initial public release | Very High | Spec-set | Controlled JDK 26 Class-File API interpretation of fixed actors under bounded SC; no target host execution. | [Shared contract and Specs 94A–101](bytecode-contract.md): internal foundation (94A), concurrent feasibility gate (94B), complete public release (94C), then heap, exceptions, core library, CBS, restricted DPOR, narrow atomics and bitstate. 94A adds internal loading/single-actor execution; [foundation evidence](../measurements/94A-bytecode-foundation.md). 94B adds internal concurrent exact DFS, checks and measured batching; [concurrency evidence](../measurements/94B-bytecode-concurrency.md). 94C adds public BYTECODE loading, strict replay, CLI, reports and viewer; [release evidence](../measurements/94C-bytecode-release.md). Target ten sequential implementation PRs; 95 broader heap is implemented and locally verified, with draft PR/CI/manual acceptance pending in its [ledger](../measurements/95-bytecode-heap.md). DPOR measurements and JPF acceptance remain future gates. |

## Deferred

Expand Down Expand Up @@ -211,4 +211,4 @@ actors under bounded SC. 94A provides internal loading/single-actor interpretati
[foundation ledger](../measurements/94A-bytecode-foundation.md) records its evidence. 94B adds internal
concurrent exact DFS, pure checks and measured reference/batched execution; the
[concurrency ledger](../measurements/94B-bytecode-concurrency.md) records its evidence. 94C adds the initial public release through strict replay and consumers;
[release ledger](../measurements/94C-bytecode-release.md). Broader heap, optimized reduction and JPF acceptance remain pending.
[release ledger](../measurements/94C-bytecode-release.md). 95 broader heap is implemented and locally verified, with draft PR/CI/manual acceptance pending in the [heap ledger](../measurements/95-bytecode-heap.md). Optimized reduction and JPF acceptance remain future gates.
2 changes: 1 addition & 1 deletion docs/specs/active/94C-bytecode-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Objective

Deliver initial public bytecode release as one coherent stage of bounded Java bytecode checking.
**Type: delta. Status: local acceptance complete; release gates recorded in the [94C ledger](../../measurements/94C-bytecode-release.md).** The
**Type: delta. Status: merged in PR141 at5385a3c; release gates recorded in the [94C ledger](../../measurements/94C-bytecode-release.md).** The
[shared #12 contract](../../plans/bytecode-contract.md) is normative for common semantics, limits,
interface signatures, profile exclusions, phase ownership and verification. This spec owns 94C only.

Expand Down
16 changes: 8 additions & 8 deletions docs/specs/active/95-bytecode-heap.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!-- Roadmap #12 / 95: implementation milestone specification; no production implementation in this PR. -->
<!-- Roadmap #12 / 95: heap-profile implementation and acceptance contract. -->
# Spec 95: Objects, arrays and dispatch

## Objective

Deliver objects, arrays and dispatch as one coherent stage of bounded Java bytecode checking.
**Type: delta. Status: specified, not implemented or measured.** The
**Type: delta. Status: implemented and locally verified; draft PR/CI/manual acceptance pending.**
Actual evidence and release limitations are recorded in the [95 ledger](../../measurements/95-bytecode-heap.md). The
[shared #12 contract](../../plans/bytecode-contract.md) is normative for common semantics, limits,
interface signatures, profile exclusions, phase ownership and verification. This spec owns 95 only.

Expand Down Expand Up @@ -50,7 +51,7 @@ the shared failure priority, preserving prior committed instructions and explici
allocation effects when a later component hits a budget. No GC/renumbering SHALL occur.
5. **R5 — Complete extension.** WHEN this broader profile is selected, THE SYSTEM SHALL extend strict
replay/evidence/consumers and the two-mode preservation argument with dynamic allocation, dispatch and
publication cases. New dynamic VM faults SHALL follow initial unwind/uncaught semantics; user catch remains rejected.
publication cases. New dynamic VM faults SHALL follow initial unwind/uncaught semantics, including the JVM's dynamic IncompatibleClassChangeError for an incompatible interface receiver; user catch remains rejected.

## Failure Modes & Edge Cases

Expand Down Expand Up @@ -104,16 +105,15 @@ choose existing equivalent modules at implementation after connected-source insp
- [verified] Planning main is `2a242c4`; the existing engine has immutable Program, forward SourceStep
continuations and source-specific evidence. The shared contract records inspected integration constraints.
- [approved decision] This milestone and the shared contract define the selected behavior/release boundary.
- [unverified] This milestone's bytecode implementation, measurements, compiler/runtime acceptance and
mutation results. No authoring review establishes those results.
- [implementation] The heap profile is implemented; its ledger records final local checks, fresh mutation comparisons, measurements and completed reviews. Authoring review never establishes runtime acceptance.

## Tests

`heapAliasesAndDispatchMatchJvm` (R1/R2), `arrayFaultsRemainDynamic` (R2),
`transitivePublicationPrecedesVisibleEscape` (R3), `escapeRetainsAllocatorCharges` (R4),
`reversedAllocationsKeepNamespacedIdentity` (R4), `heapProfileReplaysAcrossConsumers` (R5).
Kill omitted inherited cells, actor-global allocation sequence, reversible sharing and alias-copy errors.
These are intended behavioral contracts/test names, not tests already implemented or executed.
These names describe the acceptance contracts. The implementation ledger maps them to actual tests and records executed evidence.
Use independent expected values/oracles, preserve distinct regression cases and save generated seeds.

## Constraints
Expand Down Expand Up @@ -142,6 +142,6 @@ publication; record completed/quota/error status through agent-setup without inv
- 94B/95/96/97: review the batching preservation argument for every newly admitted behavior; 99/100/101:
review reduction admission/resource/product obligations in addition to runtime tests.

The specification-only PR runs document/link/structure validation, reader review and required actual
CodeRabbit invocations. It does not run Java/PIT/browser feature checks for code that does not exist.
The historical specification-only PR ran document/link/structure validation, reader review and required actual
CodeRabbit invocations. Implementation now requires the Java/PIT/browser gates above and its own actual review.
After publishing this milestone's implementation PR, report its link and stop; do not watch CI.
Loading
Loading