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

Make hidden methods inline #67

Open
mshami85 opened this issue Mar 31, 2018 · 5 comments
Open

Make hidden methods inline #67

mshami85 opened this issue Mar 31, 2018 · 5 comments

Comments

@mshami85
Copy link

Hi, I think it is making advice code inline with methods is very useful option.
is there a chance to see so?

@pamidur
Copy link
Owner

pamidur commented Mar 31, 2018

Hi, do you mean MethodIplm - Inlining or something else?

Do you mind provide a code sample how you think it might work?

@mshami85
Copy link
Author

Yes just like MethodIplm , But unfortunately I use .net 4.0 which has no inlining, is it possible to make it?

@mshami85
Copy link
Author

for example
instead of being like this

this.__a$_TraceAspect.YYY();
MessageBox.Show("Test");
this.__a$_TraceAspect.XXX();

the code must be like this

Console.Write("Starting....");
MessageBox.Show("Test");
Console.Write("Ended");

@pamidur
Copy link
Owner

pamidur commented Apr 1, 2018

Ok I got it. It will never be inlined explicitly. So you will always see those aspect methods calls in debugger for example. What you can do however, is to tell JIT try to aggressively inline when translating to native code by applying [MethodImpl] to your Advice Methods.

@pamidur
Copy link
Owner

pamidur commented Apr 2, 2018

Just want to add the reason why:
Aspects has access to their class fileds, so they can share data. This means that making calls inline (in fact copying code to the target methods) means that we need to track and keep references to aspect class fields.
Another reason - inline prevents aspect debugging.

@pamidur pamidur changed the title Is there a way to make advice inline? Make hidden methods inline Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants