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: add Type API to mitigate issues around memory #427

Merged
merged 16 commits into from
Aug 6, 2022

Conversation

baszalmstra
Copy link
Collaborator

@baszalmstra baszalmstra commented Jul 20, 2022

This PR refactors the Type system. It exposes only: Type which is now your one and only handle for type information. Internally it uses reference counting and a system to ensure that cross-referencing types are not deallocated.

I also had to rewrite the FFI code for types because of this so I also made all the FFI code and tests a little more ergonomic/easy to use.

The only thing missing currently is the C++ code that accompanies the changes.

This does fix issue #423 .

Closes #423

@baszalmstra baszalmstra requested a review from Wodann July 20, 2022 15:22
@baszalmstra baszalmstra self-assigned this Jul 20, 2022
crates/mun_capi_utils/Cargo.toml Outdated Show resolved Hide resolved
crates/mun_capi_utils/Cargo.toml Show resolved Hide resolved
crates/mun_capi_utils/src/error.rs Outdated Show resolved Hide resolved
crates/mun_memory/Cargo.toml Outdated Show resolved Hide resolved
crates/mun_memory/Cargo.toml Outdated Show resolved Hide resolved
crates/mun_memory/src/diff.rs Outdated Show resolved Hide resolved
crates/mun_memory/src/type/ffi/pointer.rs Outdated Show resolved Hide resolved
crates/mun_memory/src/type/mod.rs Outdated Show resolved Hide resolved
crates/mun_runtime/src/function_info.rs Outdated Show resolved Hide resolved
crates/mun_runtime_capi/src/runtime.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 6, 2022

Codecov Report

Merging #427 (78a967a) into main (778fa5a) will increase coverage by 0.08%.
The diff coverage is 92.37%.

@@            Coverage Diff             @@
##             main     #427      +/-   ##
==========================================
+ Coverage   83.04%   83.13%   +0.08%     
==========================================
  Files         280      281       +1     
  Lines       16520    16648     +128     
==========================================
+ Hits        13719    13840     +121     
- Misses       2801     2808       +7     
Impacted Files Coverage Δ
crates/mun/src/ops/start.rs 0.00% <0.00%> (ø)
crates/mun_memory/src/gc.rs 100.00% <ø> (ø)
crates/mun_memory/tests/gc/alloc.rs 100.00% <ø> (ø)
crates/mun_runtime/tests/memory.rs 100.00% <ø> (ø)
crates/mun_runtime/src/reflection.rs 50.00% <33.33%> (ø)
crates/mun_runtime/src/adt.rs 79.27% <70.58%> (-0.11%) ⬇️
crates/mun_memory/src/type_table.rs 77.55% <78.57%> (+1.08%) ⬆️
crates/mun_memory/src/type/ffi/pointer.rs 86.25% <86.25%> (ø)
crates/mun_memory/src/type/mod.rs 88.32% <88.32%> (ø)
crates/mun_runtime/src/assembly.rs 82.66% <91.30%> (-2.05%) ⬇️
... and 23 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@baszalmstra baszalmstra marked this pull request as ready for review August 6, 2022 18:10
cpp/include/mun/type.h Outdated Show resolved Hide resolved
crates/mun_memory/src/type/mod.rs Show resolved Hide resolved
crates/mun_runtime/src/assembly.rs Outdated Show resolved Hide resolved
@Wodann Wodann merged commit e8f8b38 into mun-lang:main Aug 6, 2022
@Wodann Wodann added this to the Mun v0.4.0 milestone Dec 5, 2022
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.

Cyclic type reference causes hang
2 participants