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

feat: core lib improvments & multiple bug fixes #331

Merged
merged 35 commits into from
Sep 27, 2023
Merged

Conversation

Chronostasys
Copy link
Member

@Chronostasys Chronostasys commented Sep 9, 2023

This is a large pr. As porting libc and improve std lib are long term tasks, I decided to
merge this pr before its done as there's already too much bug fixes and code changes.

modification list

  • trait refactors & bug fixes
    • fix many bugs when combining trait with generics
    • enhance trait cast ability
  • improve std lib & core lib
    • port more libc functions & provide some abstractions
    • add hash function for all primitive types and most of core types
    • add hashtable structure
  • gc improvements
    • fix global tracing bugs
    • fix large obj madvice not aligned ub
    • fix wrong finding immix block hole logic & rm useless variables
  • lsp improvements
    • add basic codelens support

close #340
close #321
half done #316

@Chronostasys Chronostasys marked this pull request as draft September 9, 2023 08:47
@github-actions
Copy link

github-actions bot commented Sep 9, 2023

Benchmark for 7898a07

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 81.1±89.12ns 86.3±88.87ns +6.41%
allocation bench/singlethread gc alloc benchmark small objects 14.1±5.27ns 13.5±4.26ns -4.26%
multithreads(2) gc benchmark--65535 small objects(per thread) 1158.2±60.59µs 1211.3±245.10µs +4.58%
plimmixgc/multi-thread gc stress benchmark small objects 933.7±41.87ms 924.6±46.00ms -0.97%
plimmixgc/singlethread gc stress benchmark small objects 807.6±18.54ms 805.0±15.23ms -0.32%
singlethread gc benchmark--65535 small objects 1092.9±2.70µs 1083.8±2.25µs -0.83%

@github-actions
Copy link

Benchmark for 1873461

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 79.4±90.17ns 81.1±92.47ns +2.14%
allocation bench/singlethread gc alloc benchmark small objects 14.9±0.57ns 14.9±1.04ns 0.00%
multithreads(2) gc benchmark--65535 small objects(per thread) 1263.7±269.87µs 1231.9±281.37µs -2.52%
plimmixgc/multi-thread gc stress benchmark small objects 1032.3±50.74ms 1032.1±60.36ms -0.02%
plimmixgc/singlethread gc stress benchmark small objects 927.9±19.56ms 925.6±20.02ms -0.25%
singlethread gc benchmark--65535 small objects 1119.2±5.78µs 1103.8±1.77µs -1.38%

1. add monad functions to `Result` type
2. update io read function to use `Result` monad
3. fix some of the generated visit function not found during link time when optimization level is greater than 0.
4. update test expects
@github-actions
Copy link

Benchmark for edb083a

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 77.9±78.13ns 79.2±64.42ns +1.67%
allocation bench/singlethread gc alloc benchmark small objects 15.2±2.99ns 15.3±2.43ns +0.66%
multithreads(2) gc benchmark--65535 small objects(per thread) 1328.6±378.26µs 1317.4±271.08µs -0.84%
plimmixgc/multi-thread gc stress benchmark small objects 1205.5±26.76ms 1168.3±28.90ms -3.09%
plimmixgc/singlethread gc stress benchmark small objects 1081.7±19.02ms 1086.1±23.19ms +0.41%
singlethread gc benchmark--65535 small objects 1132.6±10.83µs 1103.1±7.47µs -2.60%

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #331 (7762482) into master (5e6ff62) will increase coverage by 0.58%.
The diff coverage is 81.15%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #331      +/-   ##
==========================================
+ Coverage   85.80%   86.38%   +0.58%     
==========================================
  Files         100      103       +3     
  Lines       21214    22126     +912     
==========================================
+ Hits        18202    19114     +912     
  Misses       3012     3012              
Files Coverage Δ
immix/src/allocator/global_allocator.rs 77.44% <100.00%> (ø)
immix/src/bigobj.rs 75.00% <100.00%> (ø)
immix/src/block.rs 92.53% <100.00%> (-0.09%) ⬇️
immix/src/mmap.rs 76.92% <100.00%> (+2.68%) ⬆️
src/ast/builder/mod.rs 33.33% <ø> (ø)
src/ast/diag.rs 61.65% <ø> (ø)
src/ast/node/cast.rs 94.93% <100.00%> (ø)
src/ast/node/function/generator.rs 98.94% <100.00%> (+<0.01%) ⬆️
src/ast/node/implement.rs 90.71% <100.00%> (+0.67%) ⬆️
src/ast/node/interface.rs 85.95% <100.00%> (-3.04%) ⬇️
... and 33 more

... and 7 files with indirect coverage changes

@github-actions
Copy link

Benchmark for 98c6698

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 75.7±69.51ns 77.7±62.31ns +2.64%
allocation bench/singlethread gc alloc benchmark small objects 15.1±1.51ns 16.4±7.55ns +8.61%
multithreads(2) gc benchmark--65535 small objects(per thread) 1217.4±162.80µs 1138.9±50.14µs -6.45%
plimmixgc/multi-thread gc stress benchmark small objects 1035.5±27.41ms 1016.4±28.26ms -1.84%
plimmixgc/singlethread gc stress benchmark small objects 934.1±17.37ms 932.8±23.09ms -0.14%
singlethread gc benchmark--65535 small objects 1118.9±3.39µs 1092.1±3.39µs -2.40%

@github-actions
Copy link

Benchmark for 88d1804

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 86.1±93.24ns 91.8±120.51ns +6.62%
allocation bench/singlethread gc alloc benchmark small objects 17.8±1.80ns 17.9±2.65ns +0.56%
multithreads(2) gc benchmark--65535 small objects(per thread) 1532.1±70.34µs 1449.4±67.81µs -5.40%
plimmixgc/multi-thread gc stress benchmark small objects 1186.8±28.44ms 1199.0±51.23ms +1.03%
plimmixgc/singlethread gc stress benchmark small objects 1090.1±23.10ms 1104.7±20.35ms +1.34%
singlethread gc benchmark--65535 small objects 1391.8±42.12µs 1341.5±30.87µs -3.61%

module之前包含的所有submodule都是直接存的值,每次clone整个依赖树跟着clone,文件一多直接卡爆

现在我把submodule搞了个rc,直接300ms->20ms,遥遥领先!
@github-actions
Copy link

Benchmark for c3dfb7c

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 70.5±41.68ns 76.6±44.78ns +8.65%
allocation bench/singlethread gc alloc benchmark small objects 20.0±6.85ns 18.4±1.31ns -8.00%
multithreads(2) gc benchmark--65535 small objects(per thread) 1482.4±288.75µs 1559.5±254.93µs +5.20%
plimmixgc/multi-thread gc stress benchmark small objects 1408.2±81.29ms 1349.3±36.64ms -4.18%
plimmixgc/singlethread gc stress benchmark small objects 1226.9±45.82ms 1208.9±50.17ms -1.47%
singlethread gc benchmark--65535 small objects 1251.5±128.91µs 1271.1±98.73µs +1.57%

@github-actions
Copy link

Benchmark for d096712

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 71.7±38.96ns 85.1±95.25ns +18.69%
allocation bench/singlethread gc alloc benchmark small objects 18.9±7.46ns 18.1±3.76ns -4.23%
multithreads(2) gc benchmark--65535 small objects(per thread) 1526.6±381.28µs 1495.7±329.50µs -2.02%
plimmixgc/multi-thread gc stress benchmark small objects 1216.7±67.51ms 1192.7±30.89ms -1.97%
plimmixgc/singlethread gc stress benchmark small objects 1080.9±22.07ms 1064.5±17.25ms -1.52%
singlethread gc benchmark--65535 small objects 1333.7±19.74µs 1304.3±14.96µs -2.20%

@github-actions
Copy link

Benchmark for ce43835

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 80.4±85.52ns 85.8±101.39ns +6.72%
allocation bench/singlethread gc alloc benchmark small objects 13.7±3.18ns 14.0±4.23ns +2.19%
multithreads(2) gc benchmark--65535 small objects(per thread) 1239.6±273.12µs 1194.9±257.63µs -3.61%
plimmixgc/multi-thread gc stress benchmark small objects 912.1±24.72ms 913.9±18.88ms +0.20%
plimmixgc/singlethread gc stress benchmark small objects 802.3±17.96ms 831.7±19.33ms +3.66%
singlethread gc benchmark--65535 small objects 1088.6±2.53µs 1100.1±4.24µs +1.06%

1. generic trait implicit cast use placeholder function to build vtable
2. array visit function's counter noy initialized to zero
@github-actions
Copy link

Benchmark for 1c9988c

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 77.1±77.03ns 99.5±111.28ns +29.05%
allocation bench/singlethread gc alloc benchmark small objects 15.2±2.05ns 15.1±1.57ns -0.66%
multithreads(2) gc benchmark--65535 small objects(per thread) 1409.5±66.52µs 1405.8±225.42µs -0.26%
plimmixgc/multi-thread gc stress benchmark small objects 1064.8±24.88ms 1088.8±62.07ms +2.25%
plimmixgc/singlethread gc stress benchmark small objects 966.6±23.96ms 959.6±19.38ms -0.72%
singlethread gc benchmark--65535 small objects 1215.1±49.57µs 1161.6±22.32µs -4.40%

@github-actions
Copy link

Benchmark for 25a8ce7

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 73.5±36.13ns 78.9±80.00ns +7.35%
allocation bench/singlethread gc alloc benchmark small objects 20.4±15.61ns 19.8±10.57ns -2.94%
multithreads(2) gc benchmark--65535 small objects(per thread) 1540.5±402.55µs 1592.3±132.26µs +3.36%
plimmixgc/multi-thread gc stress benchmark small objects 1260.6±60.30ms 1240.6±56.68ms -1.59%
plimmixgc/singlethread gc stress benchmark small objects 1114.3±26.43ms 1098.8±18.14ms -1.39%
singlethread gc benchmark--65535 small objects 1353.1±26.37µs 1338.0±17.36µs -1.12%

Previous implementation set the generic type to it's trait bound type during
analysis, witch causing issue during code gen process, also generation useless code
even when a generic function is not use. This commit will construct a new temporary type
which auto implements the corrsponding trait bounds, and avoid code gen completely when
generic function is not instanciated.
@github-actions
Copy link

Benchmark for ccbb9d0

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 73.6±45.83ns 88.5±102.18ns +20.24%
allocation bench/singlethread gc alloc benchmark small objects 18.2±3.94ns 18.2±4.06ns 0.00%
multithreads(2) gc benchmark--65535 small objects(per thread) 1470.6±265.73µs 1538.3±339.87µs +4.60%
plimmixgc/multi-thread gc stress benchmark small objects 1207.5±53.27ms 1187.0±36.34ms -1.70%
plimmixgc/singlethread gc stress benchmark small objects 1051.9±27.17ms 1056.7±31.09ms +0.46%
singlethread gc benchmark--65535 small objects 1358.7±10.11µs 1358.7±3.05µs 0.00%

@github-actions
Copy link

Benchmark for da21b6d

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 82.9±81.36ns 98.4±128.69ns +18.70%
allocation bench/singlethread gc alloc benchmark small objects 13.9±6.70ns 14.0±0.79ns +0.72%
multithreads(2) gc benchmark--65535 small objects(per thread) 1150.2±28.05µs 1138.4±83.09µs -1.03%
plimmixgc/multi-thread gc stress benchmark small objects 927.7±43.00ms 916.8±29.13ms -1.17%
plimmixgc/singlethread gc stress benchmark small objects 798.4±20.21ms 804.0±19.66ms +0.70%
singlethread gc benchmark--65535 small objects 1090.5±8.00µs 1049.2±10.25µs -3.79%

this may cause segment fault occasionally
@github-actions
Copy link

Benchmark for 3dbd9c0

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 75.9±68.96ns 96.0±105.36ns +26.48%
allocation bench/singlethread gc alloc benchmark small objects 18.2±5.44ns 15.0±1.93ns -17.58%
multithreads(2) gc benchmark--65535 small objects(per thread) 1178.3±215.18µs 1192.7±259.33µs +1.22%
plimmixgc/multi-thread gc stress benchmark small objects 1206.6±100.70ms 1225.4±52.74ms +1.56%
plimmixgc/singlethread gc stress benchmark small objects 972.1±44.61ms 930.1±38.50ms -4.32%
singlethread gc benchmark--65535 small objects 1038.3±74.17µs 1070.2±89.19µs +3.07%

@github-actions
Copy link

Benchmark for 209f776

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 89.5±96.61ns 84.7±90.47ns -5.36%
allocation bench/singlethread gc alloc benchmark small objects 13.5±2.76ns 14.2±5.72ns +5.19%
multithreads(2) gc benchmark--65535 small objects(per thread) 1184.0±188.63µs 1204.0±263.25µs +1.69%
plimmixgc/multi-thread gc stress benchmark small objects 921.2±31.93ms 963.6±71.32ms +4.60%
plimmixgc/singlethread gc stress benchmark small objects 825.1±23.38ms 821.6±17.13ms -0.42%
singlethread gc benchmark--65535 small objects 1072.4±7.07µs 1064.3±13.32µs -0.76%

@github-actions
Copy link

Benchmark for b25da3d

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 85.0±90.94ns 85.0±82.07ns 0.00%
allocation bench/singlethread gc alloc benchmark small objects 13.4±3.90ns 14.8±6.43ns +10.45%
multithreads(2) gc benchmark--65535 small objects(per thread) 1214.3±55.00µs 1175.8±189.55µs -3.17%
plimmixgc/multi-thread gc stress benchmark small objects 914.7±20.66ms 940.4±34.34ms +2.81%
plimmixgc/singlethread gc stress benchmark small objects 783.5±15.53ms 817.6±21.44ms +4.35%
singlethread gc benchmark--65535 small objects 1093.2±5.54µs 1056.5±1.76µs -3.36%

@github-actions
Copy link

Benchmark for 1fe2627

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 76.3±49.20ns 76.9±78.89ns +0.79%
allocation bench/singlethread gc alloc benchmark small objects 19.8±10.89ns 19.8±5.35ns 0.00%
multithreads(2) gc benchmark--65535 small objects(per thread) 1588.2±497.87µs 1451.5±92.07µs -8.61%
plimmixgc/multi-thread gc stress benchmark small objects 1231.8±44.06ms 1232.6±46.39ms +0.06%
plimmixgc/singlethread gc stress benchmark small objects 1093.3±16.48ms 1096.2±25.40ms +0.27%
singlethread gc benchmark--65535 small objects 1331.3±14.15µs 1328.2±11.13µs -0.23%

@github-actions
Copy link

Benchmark for aa161c0

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 71.7±37.78ns 77.1±50.53ns +7.53%
allocation bench/singlethread gc alloc benchmark small objects 18.6±5.50ns 19.3±1.21ns +3.76%
multithreads(2) gc benchmark--65535 small objects(per thread) 1541.5±365.48µs 1537.9±277.43µs -0.23%
plimmixgc/multi-thread gc stress benchmark small objects 1485.1±169.85ms 1178.3±43.30ms -20.66%
plimmixgc/singlethread gc stress benchmark small objects 1083.9±20.94ms 1071.9±27.85ms -1.11%
singlethread gc benchmark--65535 small objects 1384.8±18.38µs 1369.1±4.07µs -1.13%

@github-actions
Copy link

Benchmark for 6638e8f

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 88.2±100.00ns 89.2±80.73ns +1.13%
allocation bench/singlethread gc alloc benchmark small objects 13.9±1.81ns 15.6±3.17ns +12.23%
multithreads(2) gc benchmark--65535 small objects(per thread) 1091.2±119.96µs 1197.8±140.05µs +9.77%
plimmixgc/multi-thread gc stress benchmark small objects 1070.0±30.02ms 1189.9±36.85ms +11.21%
plimmixgc/singlethread gc stress benchmark small objects 836.0±31.16ms 985.7±31.40ms +17.91%
singlethread gc benchmark--65535 small objects 949.5±40.91µs 994.3±45.34µs +4.72%

@Chronostasys Chronostasys marked this pull request as ready for review September 27, 2023 09:14
@github-actions
Copy link

Benchmark for 886ebfe

Click to view benchmark
Test Base PR %
allocation bench/malloc benchmark small objects 76.1±73.61ns 82.4±78.07ns +8.28%
allocation bench/singlethread gc alloc benchmark small objects 15.3±2.61ns 16.4±2.24ns +7.19%
multithreads(2) gc benchmark--65535 small objects(per thread) 1334.9±359.04µs 1312.8±273.57µs -1.66%
plimmixgc/multi-thread gc stress benchmark small objects 1065.4±36.85ms 1056.8±46.23ms -0.81%
plimmixgc/singlethread gc stress benchmark small objects 949.8±17.65ms 978.7±24.33ms +3.04%
singlethread gc benchmark--65535 small objects 1133.9±11.46µs 1138.6±10.67µs +0.41%

This was referenced Sep 27, 2023
@Chronostasys Chronostasys changed the title Feat/libc feat: core lib improvments & multiple bug fixes Sep 27, 2023
@Chronostasys Chronostasys added this to the 1.0.0 milestone Sep 27, 2023
@Chronostasys Chronostasys merged commit b62dc34 into master Sep 27, 2023
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.

trait to subtrait cast add hash functions
2 participants