Replaces inline for loops with proper runtime loops.#241
Open
LucasSantos91 wants to merge 3 commits into
Open
Conversation
Owner
|
Ah, interesting note. I don't mind changing it, but
This is not true for a non-extern struct. I guess we could change the layout of the dispatch structs to extern though (I doubt that it changes anything in practice). Also, can you rebase? Master branch should be fixed again now. |
224caba to
3cef569
Compare
Also, change `loader` function back to being `anytype`, as a concrete type was causing problems related to callconv.
3cef569 to
a4ae68c
Compare
Contributor
Author
You're right. For some reason I had it in my head that it was true even for non-extern structs (in practice, it is true). Rebased and added the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current
loadfunctions make use of inline loops:This generates a lot of bloat. Here's a small program for code analysis:
Here's the generated assembly:
I truncated it. It just goes on forever.
We can make this better by noticing that
Dispatchis supposed to be just an array of pointers. Since fields of same size follow source code order, we can cast the dispatch to a slice, and replace the loop with a proper runtime loop. Also, all handles lower to just ausize.Here's the generated
loadfunction with this patch:And here's the generated assembly from that sample program:
That's the entire thing.