Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Orthogonal Persistence (64-Bit without Graph Copy) #4225

Merged
merged 399 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
399 commits
Select commit Hold shift + click to select a range
3d5db66
Adjust emscripten dependency for nix
luc-blaeser Jul 19, 2023
7832736
Use latest emscripten from nix unstable channel
luc-blaeser Jul 19, 2023
f7341a2
Adjust CI build
luc-blaeser Jul 19, 2023
21f2128
Adjust CI build
luc-blaeser Jul 19, 2023
29f626e
Adjust CI build
luc-blaeser Jul 19, 2023
0eb540e
Adjust CI build
luc-blaeser Jul 19, 2023
63c33b6
Add latest emscripten via nix `sources.json`
luc-blaeser Jul 19, 2023
65fef5c
Adjust emscripten dependency in `sources.json`
luc-blaeser Jul 19, 2023
ec0967f
Update sources.json
luc-blaeser Jul 19, 2023
2db098a
Update sources.json
luc-blaeser Jul 19, 2023
941f177
Disable base library tests
luc-blaeser Jul 20, 2023
34369b2
Adjust build
luc-blaeser Jul 20, 2023
0807c75
Adjust tests, disable benchmark
luc-blaeser Jul 20, 2023
f74e41e
Enable random tests on 64-bit
luc-blaeser Jul 20, 2023
bf5d125
Bug fix
luc-blaeser Jul 20, 2023
bd1a2c2
Exclude inter-actor quickcheck tests
luc-blaeser Jul 20, 2023
db05a9f
Downscale test for CI
luc-blaeser Jul 20, 2023
4d410b8
Remove unnecessary clean-up function
luc-blaeser Sep 13, 2023
279b799
Adjust `is_controller` system call
luc-blaeser Sep 13, 2023
3d0043d
Merge branch 'master' into luc/stable-heap64
luc-blaeser Sep 14, 2023
bc8b9af
Manual merge from master
luc-blaeser Sep 15, 2023
2a28ddf
Fix direct numeric conversions
luc-blaeser Sep 15, 2023
54ca5a4
Use `drun` with 64-bit main memory
luc-blaeser Sep 15, 2023
5a5ee75
Adjust callback signatures
luc-blaeser Sep 15, 2023
573cf31
Adjust ignore callback sentinel value
luc-blaeser Sep 15, 2023
283f3e1
Bug fix
luc-blaeser Sep 15, 2023
bb181f4
Merge branch 'master' into luc/wasm64
luc-blaeser Sep 15, 2023
f42d070
Remove memory reserve feature
luc-blaeser Sep 15, 2023
57365cb
Adjust CI build
luc-blaeser Sep 18, 2023
709b4b5
Adjust serialization
luc-blaeser Sep 18, 2023
99b62be
Bug fix
luc-blaeser Sep 18, 2023
1eadb55
Bug fix
luc-blaeser Sep 18, 2023
2f6c947
Bug fix
luc-blaeser Sep 19, 2023
3bc2978
Adjust IC system calls
luc-blaeser Sep 19, 2023
2543d8d
Adjust IC system calls
luc-blaeser Sep 19, 2023
bc46cf6
Bug fix
luc-blaeser Sep 19, 2023
fe122f5
Create Cargo.lock
luc-blaeser Sep 19, 2023
627519d
Adjust region and stable memory accesses
luc-blaeser Sep 19, 2023
ea2a593
Fix float format length
luc-blaeser Sep 19, 2023
4e335d3
Update nix setup
luc-blaeser Sep 19, 2023
f697643
Adjust tests
luc-blaeser Sep 19, 2023
4957b6f
Adjust nix config
luc-blaeser Sep 20, 2023
a9760b1
Adjust stabilization
luc-blaeser Sep 20, 2023
f5b916e
Bug fix
luc-blaeser Sep 20, 2023
79063f1
Adjust stable memory and region accesses
luc-blaeser Sep 20, 2023
b855b0b
Adjust region RTS calls
luc-blaeser Sep 20, 2023
bb2b369
Merge branch 'master' into luc/wasm64
luc-blaeser Sep 20, 2023
a40c398
Manual merge RTS tests
luc-blaeser Sep 20, 2023
18cb43a
Manual merge of compiler
luc-blaeser Sep 20, 2023
164498e
Adjust IC call
luc-blaeser Sep 20, 2023
e43f5cb
Update benchmark
luc-blaeser Sep 20, 2023
0300c85
Adjust test
luc-blaeser Sep 20, 2023
a211c76
Adjust test script
luc-blaeser Sep 20, 2023
ccd9c05
Adjust tests
luc-blaeser Sep 21, 2023
1cf08eb
Bug fix
luc-blaeser Sep 21, 2023
7cb7c0a
Adjust tests
luc-blaeser Sep 21, 2023
9ba6784
Adjust linker tests
luc-blaeser Sep 21, 2023
1011359
Minor refactoring
luc-blaeser Sep 21, 2023
5265794
Adjust test
luc-blaeser Sep 21, 2023
d79324d
Adjust CI build
luc-blaeser Sep 21, 2023
3f87582
Update IC dependency
luc-blaeser Sep 21, 2023
6c2a9ae
Wasm profiler does not support 64-bit
luc-blaeser Sep 21, 2023
c1720d6
Test case beyond 4GB
luc-blaeser Sep 22, 2023
9f9069f
Update CI test configuration
luc-blaeser Sep 22, 2023
0815fa9
Increase partitioned heap to 64GB
luc-blaeser Sep 22, 2023
cdb7bff
Update IC dependency
luc-blaeser Sep 25, 2023
eb7d904
Merge branch 'luc/wasm64' into luc/stable-heap64
luc-blaeser Sep 25, 2023
68f139a
Manual merge, to be continued
luc-blaeser Sep 25, 2023
4d5205a
Adjust BigInt literals
luc-blaeser Sep 25, 2023
ee6f3da
Bug fix
luc-blaeser Sep 26, 2023
a810196
Adjust tests
luc-blaeser Sep 26, 2023
0c668dd
Manual merge conflict resolution
luc-blaeser Sep 26, 2023
8063f8b
Code refactoring
luc-blaeser Sep 26, 2023
5f3c851
Update IC dependency
luc-blaeser Sep 26, 2023
b9c20e7
Increase data segment limit
luc-blaeser Sep 26, 2023
19785b5
Adjust test case
luc-blaeser Sep 26, 2023
4d4a186
Update migration test case
luc-blaeser Sep 26, 2023
a706eaf
Revert "Code refactoring"
luc-blaeser Sep 26, 2023
c5e6cb1
Adjust test case
luc-blaeser Sep 26, 2023
7f896da
Update benchmark results
luc-blaeser Sep 26, 2023
05687b0
Update documentation
luc-blaeser Sep 26, 2023
f3448fe
Update fingerprint to 64-bit
luc-blaeser Sep 27, 2023
3adfd8b
Merge branch 'master' into luc/stable-heap64
luc-blaeser Sep 27, 2023
041e7c1
Manual merge Rust allocator
luc-blaeser Sep 27, 2023
630bce7
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 27, 2023
25e5894
Remove memory reserve
luc-blaeser Sep 27, 2023
917988e
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 27, 2023
d4889f9
Test CI build
luc-blaeser Sep 27, 2023
18a6191
Refine memory compatibility check
luc-blaeser Sep 27, 2023
ad2c873
Add test case
luc-blaeser Sep 27, 2023
bd614e8
Distinguish blob and Nat8 arrays
luc-blaeser Sep 27, 2023
6045264
Bug fix
luc-blaeser Sep 27, 2023
96acdb0
Reformat code
luc-blaeser Sep 27, 2023
37ea7df
Update benchmark results
luc-blaeser Sep 27, 2023
3f7706c
Distinguish tuple type in memory compatibility check
luc-blaeser Sep 28, 2023
2e95996
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 28, 2023
b6b11ef
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 28, 2023
a31d45a
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 28, 2023
cba01a3
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Sep 29, 2023
283ad7a
Update IC dependency
luc-blaeser Oct 3, 2023
3345e97
Revert "Test CI build"
luc-blaeser Oct 3, 2023
7eb985f
Resolve merge conflicts
luc-blaeser Oct 4, 2023
890c9fd
Use 64-bit IC API
luc-blaeser Oct 4, 2023
348361f
Update IC dependency
luc-blaeser Oct 4, 2023
488eaa0
Update benchmark results
luc-blaeser Oct 5, 2023
63078d2
Adjust sanity checks
luc-blaeser Oct 6, 2023
e972ee3
Reformat
luc-blaeser Oct 6, 2023
255cacc
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Oct 18, 2023
0127158
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Oct 18, 2023
743c83f
Upgrade IC dependency, use persistence flag
luc-blaeser Oct 20, 2023
3bcfe23
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Oct 20, 2023
958f2f6
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Oct 20, 2023
58f3908
Update IC dependency
luc-blaeser Oct 20, 2023
7634812
Update IC dependency
luc-blaeser Oct 26, 2023
e99f1a0
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Oct 27, 2023
db8da2f
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 6, 2023
c2c7952
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 8, 2023
6b53f62
Manual resolution of undetected merge conflicts
luc-blaeser Nov 8, 2023
44f3200
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 15, 2023
df0030e
Manual merge conflict resolution
luc-blaeser Nov 15, 2023
9493e20
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 15, 2023
021e800
Resolve merge conflicts
luc-blaeser Nov 15, 2023
b038151
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 15, 2023
040ee0f
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Nov 22, 2023
0288ccb
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 15, 2023
673b7c2
Manual merge conflict resolution
luc-blaeser Dec 15, 2023
874e920
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 15, 2023
ec54297
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 19, 2023
9e4287c
Manual merge: Adjust test
luc-blaeser Dec 19, 2023
113f1fa
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 19, 2023
dd095e9
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 19, 2023
a02e9de
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 20, 2023
dcb4fca
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 20, 2023
a9aae27
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 20, 2023
9698f31
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 21, 2023
97590a1
Update base library dependency
luc-blaeser Dec 21, 2023
d01f039
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Dec 21, 2023
c92f870
Manual merge conflict resolution
luc-blaeser Dec 21, 2023
b85c1fa
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jan 4, 2024
ee01e06
Updating nix hashes
github-actions[bot] Jan 4, 2024
b4b2076
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jan 9, 2024
554406b
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Feb 2, 2024
4301053
Limit array length because of optimized array iterator
luc-blaeser Feb 8, 2024
c58ed1a
Code refactoring
luc-blaeser Feb 8, 2024
4644555
Update benchmark results
luc-blaeser Feb 8, 2024
eb41b07
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Feb 13, 2024
e39a125
Update motoko base dependency
luc-blaeser Feb 13, 2024
5a252ce
Enhanced Orthogonal Persistence: Use Passive Data Segments (64-Bit) (…
luc-blaeser Feb 22, 2024
38b1ef8
Update IC dependency
luc-blaeser Feb 22, 2024
7996b86
Merge Preparation: Precise Tagging + Enhanced Orthogonal Persistence …
luc-blaeser Feb 29, 2024
ba4facc
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Feb 29, 2024
c0d3d6a
Manual merge conflict resolution
luc-blaeser Feb 29, 2024
b6191d9
Update Motoko base depedency
luc-blaeser Mar 8, 2024
1480f65
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 8, 2024
d5bc0b8
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 11, 2024
bb8e7d7
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 11, 2024
181f1cb
Manual merge conflict resolution
luc-blaeser Mar 11, 2024
a31a11f
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 11, 2024
9f96c71
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 15, 2024
6421a24
Manual merge conflict resolution
luc-blaeser Mar 15, 2024
6fec30a
Optimization: Object Pooling for Enhanced Orthogonal Persistence (#4465)
luc-blaeser Mar 20, 2024
da19f25
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 20, 2024
e1237ac
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 25, 2024
a55e541
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Mar 27, 2024
588204f
Update .gitignore
luc-blaeser Mar 28, 2024
4e628b3
Enhanced Orthogonal Persistence: Refactor 64-bit Port of SLEB128 for …
luc-blaeser Apr 5, 2024
5f975ba
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 5, 2024
09c00cb
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 8, 2024
e7861e7
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 10, 2024
aeb7aee
Adjust data segment loading
luc-blaeser Apr 10, 2024
8b68dad
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
0e43a20
Manual merge conflict resolution
luc-blaeser Apr 11, 2024
4cc4b56
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
060312b
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
f905718
Manual merge conflict resolution
luc-blaeser Apr 11, 2024
811a9b6
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
0808ebd
Manual merge conflict resolution
luc-blaeser Apr 11, 2024
16f5ef1
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
b84d3ae
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 11, 2024
c7bcf45
Update benchmark results
luc-blaeser Apr 11, 2024
c80e7a0
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 12, 2024
884645f
Manual merge conflict resolution
luc-blaeser Apr 12, 2024
3d4fd4d
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Apr 12, 2024
4ac623d
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 3, 2024
753914d
Update Motoko base dependency
luc-blaeser May 3, 2024
e319e22
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 3, 2024
ed6362f
Manual merge conflict resolution
luc-blaeser May 3, 2024
38cb834
Apply the expected shift distance
luc-blaeser May 3, 2024
dd0fa8b
Remove redundant code
luc-blaeser May 3, 2024
ab27dc7
Code refactoring: Move constant
luc-blaeser May 3, 2024
665e726
Add a debug assertion
luc-blaeser May 3, 2024
64fcb47
Code refactoring: Reduce code difference
luc-blaeser May 3, 2024
4900f29
Update comment
luc-blaeser May 10, 2024
5a680e0
Represent function indices as `i32`
luc-blaeser May 10, 2024
b15c54a
Use pointer compression on Candid destabilization
luc-blaeser May 14, 2024
6f87078
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 14, 2024
9bd6537
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 14, 2024
034a40b
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 14, 2024
a3aff8d
Manual merge conflict resolution
luc-blaeser May 14, 2024
ec633e3
Fix test case
luc-blaeser May 14, 2024
c2981bf
Add comment
luc-blaeser May 15, 2024
7907423
Add TODO comment
luc-blaeser May 15, 2024
c6dcd68
Code refactoring: Arithmetics
luc-blaeser May 15, 2024
8701eda
Fix boundary check in small `Int` `pow` function
luc-blaeser May 15, 2024
5ceaf0e
Code refactoring: `Nat` conversions
luc-blaeser May 15, 2024
146c87e
Code refactoring: Remove redundant blank.
luc-blaeser May 15, 2024
ea20c6c
Fix tagging for `hashBlob`
luc-blaeser May 16, 2024
c9938d0
Remove redundant shifts for signed bit count operations
luc-blaeser May 16, 2024
2f51fdd
Reenable randomized tests
luc-blaeser May 16, 2024
ce83f15
Update quickcheck documentation
luc-blaeser May 16, 2024
e0120f0
Revert unwanted modification in test case
luc-blaeser May 16, 2024
ddb51c2
Adjust test case to original configuration
luc-blaeser May 16, 2024
8672540
Try to run original `map-upgrades` test
luc-blaeser May 16, 2024
255742c
Tests for wasi stable memory beyond 4GB
luc-blaeser May 16, 2024
305b22b
Update expected test result
luc-blaeser May 16, 2024
6cbc83e
Code refactoring: Linker
luc-blaeser May 16, 2024
3a3e8fc
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 17, 2024
03c17c9
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 22, 2024
a3016a7
Optimizations
luc-blaeser May 23, 2024
c8bac95
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser May 24, 2024
fd505cb
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 7, 2024
b6a5f2a
Merge branch 'luc/stable-heap-merge-object-tagging' into luc/stable-h…
luc-blaeser Jun 7, 2024
f606202
Manual merge conflict resolution
luc-blaeser Jun 7, 2024
72381f9
Merge branch 'luc/stable-heap-merge-object-tagging' into luc/stable-h…
luc-blaeser Jun 7, 2024
7de20a1
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 17, 2024
f31bfad
Merge branch 'luc/stable-heap64' into luc/stable-heap64-merge-object-…
luc-blaeser Jun 17, 2024
1eae575
Use 64-bit version of Tom's math library
luc-blaeser Jun 17, 2024
2ca72c1
Add benchmark case
luc-blaeser Jun 17, 2024
4edc164
Optimize float to int conversion for 64-bit
luc-blaeser Jun 17, 2024
8524d54
Merge branch 'luc/stable-heap64' into luc/stable-heap64-merge-object-…
luc-blaeser Jun 18, 2024
b62d149
Manual merge conflict resolution
luc-blaeser Jun 18, 2024
2482f6b
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 21, 2024
32a7378
Merge branch 'luc/stable-heap64' into luc/stable-heap64-merge-object-…
luc-blaeser Jun 21, 2024
09c06e6
Merge branch 'luc/stable-heap-merge-object-tagging' into luc/stable-h…
luc-blaeser Jun 24, 2024
d9cc976
Experiment Remove `musl`/`libc` dependency from RTS (#4577)
luc-blaeser Jun 25, 2024
bb2b2c5
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 25, 2024
cc1fa0b
Manual merge conflict resolution
luc-blaeser Jun 25, 2024
66cdd22
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 26, 2024
14ca175
Unbounded Number of Heap Partitions for 64-Bit (#4556)
luc-blaeser Jun 26, 2024
6edbb37
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jun 27, 2024
793eb24
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jul 8, 2024
83a6043
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jul 8, 2024
c2c0525
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Jul 22, 2024
18636f8
EOP: Support Unknown Main Memory Capacity in 64-Bit (#4585)
luc-blaeser Jul 22, 2024
0e5fe25
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Aug 9, 2024
f150a32
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Aug 9, 2024
0e06483
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Aug 19, 2024
690eff2
Merge branch 'luc/stable-heap' into luc/stable-heap64
luc-blaeser Aug 19, 2024
0de3aeb
EOP: Integrating Latest IC with Memory 64 (#4610)
luc-blaeser Aug 20, 2024
a9184eb
Enhanced Orthogonal Persistence (64-Bit with Graph Copy) (#4475)
luc-blaeser Aug 26, 2024
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
19 changes: 13 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ let ic-ref-run =
cp ${ic-hs-pkgs.ic-hs}/bin/ic-ref-run $out/bin
''; in

let
nixos-unstable = import nixpkgs.sources.nixpkgs-unstable {};
in

let haskellPackages = nixpkgs.haskellPackages.override {
overrides = import nix/haskell-packages.nix nixpkgs subpath;
}; in
Expand All @@ -35,6 +39,7 @@ let
wasmtime
rust-bindgen
python3
nixos-unstable.emscripten
] ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
libiconv
];
Expand Down Expand Up @@ -193,7 +198,7 @@ rec {
name = "motoko-rts-deps";
src = subpath ./rts;
sourceRoot = "rts/motoko-rts-tests";
sha256 = "sha256-jN5nx5UNBHlYKnC0kk90h6mWPUNrqPS7Wln2TixbGgA=";
sha256 = "sha256-YEw2AFi15JVKP7owsPDoBT3qSegOO90FRn2qoUBAICw=";
copyLockfile = true;
};

Expand Down Expand Up @@ -241,6 +246,7 @@ rec {
"directory" = "$(stripHash ${allDeps})"
__END__


${llvmEnv}
export TOMMATHSRC=${nixpkgs.sources.libtommath}
export MUSLSRC=${nixpkgs.sources.musl-wasi}/libc-top-half/musl
Expand Down Expand Up @@ -415,7 +421,7 @@ rec {
'';
};

# wasm-profiler is not compatible with passive data segments
# wasm-profiler is not compatible with passive data segments and memory64
# profiling-graphs = testDerivation {
# src = test_src "perf";
# buildInputs =
Expand Down Expand Up @@ -481,7 +487,7 @@ rec {
perf = perf_subdir "perf" [ moc nixpkgs.drun ];
bench = perf_subdir "bench" [ moc nixpkgs.drun ic-wasm ];
# viper = test_subdir "viper" [ moc nixpkgs.which nixpkgs.openjdk nixpkgs.z3 ];
# TODO: profiling-graph is excluded because the underlying partity_wasm is deprecated and does not support passive data segments.
# TODO: profiling-graph is excluded because the underlying partity_wasm is deprecated and does not support passive data segments and memory64.
inherit qc lsp unit candid coverage;
}) // { recurseForDerivations = true; };

Expand Down Expand Up @@ -526,7 +532,7 @@ rec {
doInstallCheck = true;
test = ./test + "/test-${n}.js";
installCheckPhase = ''
NODE_PATH=$out/bin node $test
NODE_PATH=$out/bin node --experimental-wasm-memory64 $test
'';
};
in
Expand Down Expand Up @@ -749,8 +755,9 @@ EOF
check-grammar
check-error-codes
] ++
builtins.attrValues tests ++
builtins.attrValues js;
builtins.attrValues tests
++ builtins.attrValues js
;
};

viperServer = nixpkgs.fetchurl {
Expand Down
54 changes: 25 additions & 29 deletions design/OrthogonalPersistence.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
# Orthogonal Persistence (Stable Heap)
# Orthogonal Persistence (64-Bit, Scalable Upgrades)

This realizes the vision of keeping the canister main memory persistent even across upgrades and thus allows scalable upgrades.
Canister upgrades do no longer involve serialization and deserialization to and from secondary stable memory.
This implements the vision of **enhanced orthogonal persistence** in Motoko that combines:
* **Stable heap**: Persisting the program main memory across canister upgrades.
* **64-bit heap**: Extending the main memory to 64-bit for large-scaled persistence.

## Purpose
* **Instantenous upgrades**: New program versions simply resume on the existing main memory and have access to the memory-compatible data.
As a result, the use of secondary storage (explicit stable memory, dedicated stable data structures, DB-like storage abstractions) will no longer be necessary: Motoko developers can directly work on their normal object-oriented program structures that are automatically persisted and retained across program version changes.

## Advantages
Compared to the existing orthogonal persistence in Motoko, this design offers:
* **Instantaneous upgrades**: New program versions immediately resume from the existing main memory and have access to the memory-compatible data.
* **Scalable upgrades**: The upgrade mechanism scales with larger heaps and in contrast to serialization, does not hit IC instruction limits.

## Broader Vision
In the longer term, this approach aims to enable **true orthogonal persistence** that is simple, flexible, efficient, and scalable.
While this version implements the runtime support for 32-bit memory, this could be leveraged to 64-bit persistent main memory in future.
As a result, the use of secondary storage (explicit stable memory, dedicated stable data structures, DB-like storage abstractions) will no longer be necessary:
Motoko developers could directly work on their normal object-oriented program structures that are automatically persisted and retained across program version changes.
With 64-bit main memory, large-scaled orthogonal persistence would be enabled, supported by the incremental GC that is designed to also scale in 64-bit.
Compared to the explicit use of stable memory, this design improves:
* **Simplicity**: Developers do not need to deal with explicit stable memory.
* **Performance**: No copying to and from the separate stable memory is necessary.

## Design
The stable heap is based on the following main properties:
* Extension of the IC to retain main memory on upgrades.
* Supporting 64-bit main memory on the IC.
* A long-term memory layout that is invariant to new compiled program versions.
* A fast memory compatibility check performed on each canister upgrade.
* Incremental garbage collection using a partitioned heap.

### IC Extension
As a prerequisite for the stable heap support, the IC runtime support has to be extended in order not to erase the main memory on upgrades.
This is realized in a specific IC PR (https://github.com/luc-blaeser/ic/tree/luc/stable-heap-on-release) that retains the main memory even on upgrades, similar to normal canister message execution.
The necessary IC extensions are implemented in a separate PR: https://github.com/dfinity/ic/pull/143
This PR is based on these extensions.

### Memory Layout
In a co-design between the compiler and the runtime system, the main memory is arranged in the following structure, invariant of the compiled program version:
Expand Down Expand Up @@ -65,10 +67,9 @@ This compatibility check serves as an additional safety measure on top of the DF
### Garbage Collection
The implementation focuses on the incremental GC and abandons the other GCs because the GCs use different memory layouts. For example, the incremental GC uses a partitioned heap with objects carrying a forwarding pointer.

The incremental GC is chosen because it is designed to scale on large heaps and the stable heap design also aims to increase scalability. Moreover, it is suited to scale on 64-bit memory in future.
The incremental GC is chosen because it is designed to scale on large heaps and the stable heap design also aims to increase scalability.

The garbage collection state needs to be persisted and retained across upgrades.
This is because the GC may not yet be completed at the time of an upgrade, such that object forwarding is still in use. The partition table is stored as part of the GC state.
The garbage collection state needs to be persisted and retained across upgrades. This is because the GC may not yet be completed at the time of an upgrade, such that object forwarding is still in use. The partition table is stored as part of the GC state.

The garbage collector uses two kinds of roots:
* Persistent roots: These refer to root objects that need to survive canister upgrades.
Expand All @@ -82,14 +83,13 @@ The transient roots are referenced by the Wasm data segments and comprise:
* All canister variables of the current version, including flexible variables.

### Main Actor
On an upgrade, the main actor is recreated and existing stable variables are recovered from the persistent root.
The remaining actor variables, the flexible fields as well as new stable variables, are (re)initialized.
On an upgrade, the main actor is recreated and existing stable variables are recovered from the persistent root. The remaining actor variables, the flexible fields as well as new stable variables, are (re)initialized.
As a result, the GC can collect unreachable flexible objects of previous canister versions.
Unused stable variables of former versions can also be reclaimed by the GC.

### No Static Heap
The static heap is abandoned and former static objects need to be allocated in the dynamic heap.
This is because these objects may also need to survive upgrades and must not be not overwritten by new data segments.
This is because these objects may also need to survive upgrades and must not be not overwritten by new data segments. The incremental GC also operates on these objects, meaning that forwarding pointer resolution is also necessary for these objects.

The incremental GC also operates on these objects, meaning that forwarding pointer resolution is also necessary for these objects.

Expand All @@ -114,18 +114,14 @@ This is acceptable because the RTS only uses small size for data segments (e.g.
As an optimization, the top-level `null` pointer is represented as a constant sentinel value pointing to the last unallocated Wasm page. This allows fast null tests without involving forwarding pointer resolution of potential non-null comparand pointers.

### Migration Path
When migrating from the old serialization-based stabilization to the new stable heap, the old data is deserialized one last time from stable memory and then placed in the new stable heap layout.
Once operating on the stable heap, the system prevents downgrade attempts to the old serialization-based persistence.
When migrating from the old serialization-based stabilization to the new stable heap, the old data is deserialized one last time from stable memory and then placed in the new stable heap layout. Once operating on the stable heap, the system prevents downgrade attempts to the old serialization-based persistence. Assuming that the persistent memory layout needs to be changed in the future, a future version of the compiler/runtime system can perform such upgrade by serializing/deserializing the heap to stable memory.

### Old Stable Memory
The old stable memory remains equally accessible as secondary memory with the new support.

## Current Limitations
* Freeing old object fields: While new program versions can drop object fields, the runtime system should also delete the redundant fields of persistent objects of previous program versions. This could be realized during garbage collection when objects are copied. For this purpose, the runtime system may maintain a set of field hashes in use and consult this table during garbage collection.
* Bounded Rust call stack size: The Rust call stack size needs to be bounded and can no longer be configured by the user.
* The Wasm profiler (only used for the flamegraphs) is no longer applicable because the underlying `parity-wasm` crate lacks full support of passive data segments. A re-implementation of the profiler would be needed.

## Related PRs

* IC with stable main memory support: https://github.com/luc-blaeser/ic/tree/luc/stable-heap-on-release
* Wasm64 Support for Motoko: https://github.com/dfinity/motoko/pull/4136
* The incremental GC only allows 64 GB. Transitioning to a dynamic partition table would be necessary to go beyond this limit. This is to be be implemented in a separate PR.
* The floating point display format differs in Wasm64 for special values, e.g. `nan` becomes `NaN`. There is currently no support for hexadecimal floating point text formatting.
* Workaround for Rust needed to build PIC (position-independent code) libraries. Explicit use of `emscripten` via LLVM IR.
* `ic-wasm` would need to be extended to support memory64 and passive data segments. The Wasm optimizations in `test/bench` are thus currently deactivated.
* The Wasm profiler is no longer applicable because the underlying `parity-wasm` crate seems deprecated. A re-implementation of the profiler would be needed.
22 changes: 17 additions & 5 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@
"version": "v1.2.0"
},
"motoko-base": {
"branch": "next-moc",
"branch": "pull/589/head",
"description": "The Motoko base library",
"homepage": null,
"homepage": "",
"owner": "dfinity",
"repo": "motoko-base",
"rev": "dfabfc3201950263a0057f5d1a78d2ede5c87478",
"sha256": "1wd9rcmhg82h08l3gz3gmn2xpgalvf679w7yz2g35yzbg2b5g2fd",
"rev": "1aa2b8638245d7541e646f5edd326b2384ee92b4",
"sha256": "128v62p0wizncmp7d3zb3gxnagd11gnr29msqjb90k7f4klxpaiv",
"type": "tarball",
"url": "https://github.com/dfinity/motoko-base/archive/dfabfc3201950263a0057f5d1a78d2ede5c87478.tar.gz",
"url": "https://github.com/dfinity/motoko-base/archive/1aa2b8638245d7541e646f5edd326b2384ee92b4.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"motoko-matchers": {
Expand Down Expand Up @@ -133,6 +133,18 @@
"url": "https://github.com/mozilla/nixpkgs-mozilla/archive/1ca9ee7192f973fd67b0988bdd77b8c11ae245a6.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-unstable": {
"branch": "master",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9d2864289e65d0dc841123ae86bc7b3f77b6d12d",
"sha256": "0f3bcphzrjm1hs81mhpfx1hqxfnbvhhv5hv82wi1h3f735i279ja",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/9d2864289e65d0dc841123ae86bc7b3f77b6d12d.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ocaml-vlq": {
"branch": "v0.2.0",
"builtin": false,
Expand Down
3 changes: 1 addition & 2 deletions rts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
mo-rts.wasm
mo-rts-debug.wasm
mo*.wasm
_build
Loading