-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[MONO] Refactored code into marshal-ilgen and marshal-shared. #68656
[MONO] Refactored code into marshal-ilgen and marshal-shared. #68656
Conversation
10e305f
to
ec6c0b2
Compare
ec6c0b2
to
5715438
Compare
@lambdageek I believe this is ready for review. |
In general, marshal-shared.c still contains a lot of code, are you sure those are all going to be needed with the new style of marshaling ? |
This seems to be the most I can do statically. All of these functions are referenced by something that needs to stay in the runtime. But it is possible that some of them cannot actually be called at runtime in the new mode, or that the functions could be broken into pieces and parts of them put into the legacy component. Basically what I found that could be moved into legacy is these functions: runtime/src/mono/mono/metadata/marshal-ilgen.c Lines 6962 to 6971 in 0a2bc2f
This represents a clear size savings and is easy to implement. We plan to look at ways to squeeze even more out later, but its somewhat more complicated and I don't know how much it will save. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just need to address Zoltan's suggestions
@lambdageek @vargaz I've addressed all the suggestions/issues. |
static MonoJitICallId | ||
conv_to_icall (MonoMarshalConv conv, int *ind_store_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm surprised this needs to be shared.
in the lightweight marshaler this should never get called (again because conv
should never be anything other than NONE
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, taking that into account I can probably remove it. But can I actually make that change in this PR? It seems like I need to seperate out the lightweight and ilgen first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will probably have to wait until we have the lightweight marshaling code separated out. right now I think conv_to_icall is getting called from both marshal-ilgen and marshal-shared, so it would be difficult to just have a single copy. after the split, it will hopefully be easier to refactor the code so that -ilgen and -lightweight each get their own copy and the -ligthweight one is trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm a little surprised that any code that deals with marshaling conversions or anything like that needs to be shared. it seems like that stuff is only for the legacy marshaler not the lightweight marshaler.
I think once we have the lightweight marshaler separated out, we can delete a lot of code by un-sharing some of this stuff and implementing the lightweight marshaling versions as |
This PR refactors the marshaling code into ilgen and shared parts. This is one step in a change that will let move the legacy marshaling code into to a component; marshal-shared has the parts that will be shared by both legacy and ilgen. The next step is to factor out the legacy marshaling code, and then move it into a component.
Once componentization is complete, the runtime size will be reduced by approximately 100 KB (on x64) when the legacy component is not needed.
contributes to: #61685