Skip to content

stage2 ARM: basic slice + basic struct support #10455

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

Merged
merged 4 commits into from
Dec 30, 2021

Conversation

joachimschmidt557
Copy link
Contributor

Further progress towards zig test

});

// memcpy(src, dst, len)
try self.genArmInlineMemcpy(src_reg, dst_reg, len_reg, count_reg, tmp_reg);
Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind that we also have the ability to call an external memcpy function if it makes sense to. It will be provided by libc, or in freestanding mode, zig provides a "freestanding libc" which has memcpy in it. Related: #7265

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, in future, we should definitely do that. However, currently, extern function calls aren't supported by the Elf linking backend, so this is the best I could do 😆 . Also (this was @kubkon's idea) a potential for optimization is analyzing how often memcpy is needed and if e.g. memcpy is needed only once, it could be inlined, else emit calls to the extern memset.

@@ -372,11 +372,32 @@ pub fn generateSymbol(
return Result{ .appended = {} };
},
.Struct => {
// TODO debug info
// TODO padding of struct members
Copy link
Member

Choose a reason for hiding this comment

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

I'll help with this in a future patch :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! It shouldn't be too hard as Type.structFieldOffset() already provides a lot of relevant information I think.

@andrewrk andrewrk merged commit 4645ec8 into ziglang:master Dec 30, 2021
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