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

improvement(memory): full support for struct memory mapping #171

Merged
merged 7 commits into from
May 14, 2020

Conversation

Wodann
Copy link
Collaborator

@Wodann Wodann commented May 8, 2020

In addition to previous available struct memory mapping, this PR adds:

  • field mapping for gc -> gc, gc -> value, value -> value, value -> gc structs of the same type
  • zero-initialisation for gc -> gc, gc -> value, value -> value, value -> gc structs of the different types

It also fixes a bug with "identity" memory mapping; i.e. when only an old type pointer needed to be replaced with a new pointer to the same type information, instead of actually mapping memory.

@Wodann Wodann requested a review from baszalmstra May 8, 2020 16:27
@Wodann Wodann self-assigned this May 8, 2020
@codecov
Copy link

codecov bot commented May 8, 2020

Codecov Report

Merging #171 into master will increase coverage by 0.07%.
The diff coverage is 86.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #171      +/-   ##
==========================================
+ Coverage   82.87%   82.94%   +0.07%     
==========================================
  Files         163      163              
  Lines       11269    11509     +240     
==========================================
+ Hits         9339     9546     +207     
- Misses       1930     1963      +33     
Impacted Files Coverage Δ
crates/mun_memory/src/gc.rs 100.00% <ø> (ø)
crates/mun_memory/src/gc/root_ptr.rs 89.47% <ø> (ø)
crates/mun_memory/tests/diff/util.rs 83.47% <0.00%> (-1.48%) ⬇️
crates/mun_memory/tests/gc/util.rs 90.90% <0.00%> (-9.10%) ⬇️
crates/mun_memory/src/gc/mark_sweep.rs 79.90% <75.75%> (-6.66%) ⬇️
crates/mun_hir/src/ty.rs 86.77% <78.94%> (-1.69%) ⬇️
crates/mun_memory/src/mapping.rs 96.66% <97.77%> (+1.75%) ⬆️
crates/mun_codegen/src/type_info.rs 67.60% <100.00%> (ø)
crates/mun_memory/src/diff.rs 96.62% <100.00%> (+0.62%) ⬆️
crates/mun_runtime/src/garbage_collector.rs 93.61% <100.00%> (+0.43%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 954448f...8a4e9b1. Read the comment docs.

@Wodann Wodann force-pushed the improvement/struct-mapping branch from c98364b to 6fefc2c Compare May 11, 2020 11:54
Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had one question but overall it looks good. Currently the colors of all nodes will always be white unless we are currently allocating so that all looks good too.

crates/mun_memory/src/lib.rs Outdated Show resolved Hide resolved
@Wodann Wodann requested a review from baszalmstra May 13, 2020 08:39
@Wodann
Copy link
Collaborator Author

Wodann commented May 13, 2020

I've added a commit that resolves your comment. Could you please review it @baszalmstra?

@Wodann Wodann force-pushed the improvement/struct-mapping branch 2 times, most recently from 6217ca6 to b7fcf06 Compare May 13, 2020 19:34
as memory mapping requires knowledge about a struct's memory kind, this
needed to be added to one of the memory::Type{..} traits. TypeLayout
seemed most applicable
this also fixes "identity" memory mapping, where only an old type
pointer needed to be replaced with a new pointer to the same type
information
@Wodann Wodann force-pushed the improvement/struct-mapping branch from b7fcf06 to 8a4e9b1 Compare May 13, 2020 22:32
@Wodann Wodann merged commit 7acbad6 into mun-lang:master May 14, 2020
@Wodann Wodann added this to the Mun v0.2 milestone May 14, 2020
@Wodann Wodann deleted the improvement/struct-mapping branch May 14, 2020 15:10
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.

2 participants