-
Notifications
You must be signed in to change notification settings - Fork 147
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
pass module version id to instrumentation wrappers #488
pass module version id to instrumentation wrappers #488
Conversation
@@ -153,16 +156,15 @@ public static object ExecuteAsync(object executionStrategy, object context, int | |||
try | |||
{ | |||
var graphQLAssembly = AppDomain.CurrentDomain.GetAssemblies() | |||
.Where(a => a.GetName().Name.Equals(GraphQLAssemblyName)) | |||
.Single(); | |||
.Single(a => a.GetName().Name.Equals(GraphQLAssemblyName)); |
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.
Completely unrelated, but I couldn't help myself. Resharper points it out in bright green on my dark background.
|
||
// insert the opcode and signature token as | ||
// additional arguments for the wrapper method | ||
ILRewriterWrapper rewriter_wrapper(&rewriter); | ||
rewriter_wrapper.SetILPosition(pInstr); | ||
rewriter_wrapper.LoadInt32(pInstr->m_opcode); | ||
rewriter_wrapper.LoadInt32(method_def_md_token); | ||
rewriter_wrapper.LoadInt64(reinterpret_cast<INT64>(module_version_id_ptr)); |
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.
We treat the address of module_version_id
as an INT64
and we push it into the stack before calling the wrapper method.
@@ -105,6 +105,16 @@ private static string GetMethodSignature(MethodInfo method) | |||
var returnType = method.ReturnType; | |||
var parameters = method.GetParameters().Select(p => p.ParameterType).ToArray(); | |||
|
|||
var requiredParameterTypes = new[] { typeof(int), typeof(int), typeof(long) }; |
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.
Since I was adding another parameter to all wrappers, I though it useful to add this validation.
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.
Looks good to me! 🎉 🎉 🎉
@@ -494,21 +494,25 @@ HRESULT STDMETHODCALLTYPE CorProfiler::JITCompilationStarted( | |||
continue; | |||
} | |||
|
|||
// we add 3 parameters to every wrapper method: opcode, mdToken, and | |||
// module_version_id | |||
const short added_parameters_count = 3; |
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.
Thanks for this change, this helps my sanity 😄
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.
Looks good!
Changes proposed in this pull request:
module_version_id
pointer onto stack before calling wrapper methodslong moduleVersionPtr
parameter to every integration wrapper methodMethodBuild.Start()
overload that takeslong moduleVersionPtr
Assembly.GetCallingAssembly()
withmoduleVersionPtr