Skip to content

feat(memory): JVM/Android Storage bindings — SegmentStorage (FFM), MappedFileStorage, DirectBufferStorage, MappedBufferStorage (SKEEP-003 P2, S1.1b) - #1063

Merged
michalharakal merged 1 commit into
developfrom
feature/1019-storage-jvm-offheap-mapped
Aug 23, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/1019-storage-jvm-offheap-mapped

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Summary

SKEEP-003 slice S1.1b (milestone M1 #1002, PRD M1-F1): the JVM and Android bindings of the OffHeap and Mapped storage kinds (§4.8.1 / §4.8.2) — where bytes live is a policy decision; these are the concrete kinds the planner and scopes pick from.

Stacked on #1061 (TraceSink + Storage, after #1062 merged into that branch); retarget to develop after it merges.

Test plan

Full local gate (scripts/pr-gate.sh, JDK 25); results in the first comment. Targeted: lang-core sk.ainet.lang.memory.* 44/44 (jvmTest).

Closes #1019

🤖 Generated with Claude Code

…ppedFileStorage (FileChannel.map), DirectBufferStorage, MappedBufferStorage (SKEEP-003 P2)

Milestone M1 (#1002), PRD M1-F1. SKEEP-003 §4.8.1 / §4.8.2: where bytes
live is a policy decision; these are the JVM and Android bindings of the
OffHeap and Mapped storage kinds.

- jvmMain SegmentStorage : Storage.OffHeap — a MemorySegment in an Arena;
  allocate(bytes, scope, arena?) owns a private Arena.ofShared() and
  frees it on close, or takes the scope's arena (the Forward bump-slab
  pattern of #1021); borrow(segment) / borrow(FloatArray) via
  MemorySegment.ofArray — zero-copy, never freed by us; slice() = asSlice
  alias; segment() accessor throws StorageClosedException after close.
- jvmMain MappedFileStorage : Storage.Mapped — FileChannel.map READ_ONLY
  into an Arena.ofShared(); closing unmaps; path + fileOffset kept for
  describe(); slices carry their file offset.
- jvmAndroidMain DirectBufferStorage : Storage.OffHeap (direct
  ByteBuffer, outside the ART heap — #922) and MappedBufferStorage :
  Storage.Mapped (MappedByteBuffer, SKEEP-002 / #921); little-endian
  duplicates handed out per call; close marks the storage dead.
- Allocation / Free trace events; MemoryDomain HOST_OFFHEAP / MMAP_FILE.
- JvmStorageTest (arena ownership vs caller arena, alias over the same
  bytes, borrowed array zero-copy, mapped file read + unmap, direct and
  mapped buffers). BCV: lang-core jvm dump regenerated (additions only).

Closes #1019

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michalharakal

Copy link
Copy Markdown
Contributor Author

Local gate scripts/pr-gate.sh (JDK 25) on 4f61f29 (rebased onto #1061 after #1062 merged into it): all legs passed — jvmTest · apiCheck · verifyNpmPins jsTest wasmJsTest wasmWasiTest · linuxX64Test · assemble (incl. compileAndroidMain) · :skainet-test:skainet-test-java:test.

Targeted: lang-core sk.ainet.lang.memory.* 44/44 (jvmTest).

Base automatically changed from feature/1017-trace-sink-api to develop August 23, 2026 12:45
@michalharakal
michalharakal merged commit 65275f6 into develop Aug 23, 2026
3 checks passed
@michalharakal
michalharakal deleted the feature/1019-storage-jvm-offheap-mapped branch August 23, 2026 12:45
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.

[S1.1b] P2: JVM/Android Storage.OffHeap (FFM MemorySegment / direct ByteBuffer) and Storage.Mapped (FileChannel.map)

1 participant