public bool TryGetMethodNameAndSignaturePointersFromNativeLayoutSignature(TypeManagerHandle module, uint methodNameAndSigToken, out RuntimeSignature methodNameSig, out RuntimeSignature methodSig) { methodNameSig = default(RuntimeSignature); methodSig = default(RuntimeSignature); NativeReader reader = GetNativeLayoutInfoReader(module); NativeParser parser = new NativeParser(reader, methodNameAndSigToken); if (parser.IsNull) { return(false); } methodNameSig = RuntimeSignature.CreateFromNativeLayoutSignature(module, parser.Offset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); methodSig = RuntimeSignature.CreateFromNativeLayoutSignature(module, sigParser.Offset); return(true); }
public bool TryGetMethodNameAndSignaturePointersFromNativeLayoutSignature(IntPtr module, uint methodNameAndSigToken, out IntPtr methodNameSigPtr, out IntPtr methodSigPtr) { methodNameSigPtr = default(IntPtr); methodSigPtr = default(IntPtr); NativeReader reader = GetNativeLayoutInfoReader(module); uint offset = methodNameAndSigToken; NativeParser parser = new NativeParser(reader, offset); if (parser.IsNull) { return(false); } methodNameSigPtr = parser.Reader.OffsetToAddress(parser.Offset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); methodSigPtr = sigParser.Reader.OffsetToAddress(sigParser.Offset); return(true); }
private unsafe bool TryGetStaticRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName) { fieldName = null; declaringTypeHandle = default(RuntimeTypeHandle); // Make sure it's not a dynamically allocated RuntimeFieldHandle before we attempt to use it to parse native layout data Debug.Assert(((*(IntPtr *)&runtimeFieldHandle).ToInt64() & 0x1) == 0); RuntimeFieldHandleInfo *fieldData = *(RuntimeFieldHandleInfo **)&runtimeFieldHandle; IntPtr remainingSignature; if (!GetTypeFromSignatureAndContext(fieldData->NativeLayoutInfoSignature, null, null, out declaringTypeHandle, out remainingSignature)) { return(false); } // GetTypeFromSignatureAndContext parses the type from the signature and returns a pointer to the next // part of the native layout signature to read which we get the field name from var reader = GetNativeLayoutInfoReader(RuntimeAugments.GetModuleFromPointer(remainingSignature)); var parser = new NativeParser(reader, reader.AddressToOffset(remainingSignature)); fieldName = parser.GetString(); return(true); }
internal MethodNameAndSignature GetMethodNameAndSignature(ref NativeParser parser, TypeManagerHandle moduleHandle, out RuntimeSignature methodNameSig, out RuntimeSignature methodSig) { methodNameSig = RuntimeSignature.CreateFromNativeLayoutSignature(moduleHandle, parser.Offset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); methodSig = RuntimeSignature.CreateFromNativeLayoutSignature(moduleHandle, sigParser.Offset); return(new MethodNameAndSignature(methodName, methodSig)); }
private unsafe bool TryGetStaticRuntimeFieldHandleComponents(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out string fieldName) { fieldName = null; declaringTypeHandle = default(RuntimeTypeHandle); // Make sure it's not a dynamically allocated RuntimeFieldHandle before we attempt to use it to parse native layout data Debug.Assert(((*(IntPtr *)&runtimeFieldHandle).ToInt64() & 0x1) == 0); RuntimeFieldHandleInfo *fieldData = *(RuntimeFieldHandleInfo **)&runtimeFieldHandle; RuntimeSignature signature; #if !CORERT // If the system module is compiled with as a type manager, all modules are compiled as such if (ModuleList.Instance.SystemModule.Handle.IsTypeManager) #endif { // The native layout info signature is a pair. // The first is a pointer that points to the TypeManager indirection cell. // The second is the offset into the native layout info blob in that TypeManager, where the native signature is encoded. IntPtr *nativeLayoutInfoSignatureData = (IntPtr *)fieldData->NativeLayoutInfoSignature; signature = RuntimeSignature.CreateFromNativeLayoutSignature( new TypeManagerHandle(*(IntPtr *)nativeLayoutInfoSignatureData[0]), (uint)nativeLayoutInfoSignatureData[1].ToInt32()); } #if !CORERT else { IntPtr moduleHandle = RuntimeAugments.GetOSModuleFromPointer(fieldData->NativeLayoutInfoSignature); signature = RuntimeSignature.CreateFromNativeLayoutSignature( new TypeManagerHandle(moduleHandle), GetNativeLayoutInfoReader(new TypeManagerHandle(moduleHandle)).AddressToOffset(fieldData->NativeLayoutInfoSignature)); } #endif RuntimeSignature remainingSignature; if (!GetTypeFromSignatureAndContext(signature, null, null, out declaringTypeHandle, out remainingSignature)) { return(false); } // GetTypeFromSignatureAndContext parses the type from the signature and returns a pointer to the next // part of the native layout signature to read which we get the field name from var reader = GetNativeLayoutInfoReader(remainingSignature); var parser = new NativeParser(reader, remainingSignature.NativeLayoutOffset); fieldName = parser.GetString(); return(true); }
internal MethodNameAndSignature GetMethodNameAndSignature(ref NativeParser parser, out IntPtr methodNameSigPtr, out IntPtr methodSigPtr) { methodNameSigPtr = parser.Reader.OffsetToAddress(parser.Offset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); methodSigPtr = sigParser.Reader.OffsetToAddress(sigParser.Offset); return(new MethodNameAndSignature(methodName, RuntimeMethodSignature.CreateFromNativeLayoutSignature(methodSigPtr))); }
private MethodNameAndSignature GetMethodNameAndSignatureFromNativeReader(NativeReader nativeLayoutReader, IntPtr moduleHandle, uint nativeLayoutOffset) { NativeParser parser = new NativeParser(nativeLayoutReader, nativeLayoutOffset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); RuntimeSignature methodSig = RuntimeSignature.CreateFromNativeLayoutSignature(moduleHandle, sigParser.Offset); return(new MethodNameAndSignature(methodName, methodSig)); }
public MethodNameAndSignature GetMethodNameAndSignatureFromNativeReader(NativeReader nativeLayoutReader, uint nativeLayoutOffset) { NativeParser parser = new NativeParser(nativeLayoutReader, nativeLayoutOffset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); IntPtr methodSigPtr = sigParser.Reader.OffsetToAddress(sigParser.Offset); return new MethodNameAndSignature(methodName, methodSigPtr); }
public MethodNameAndSignature GetMethodNameAndSignatureFromNativeReader(NativeReader nativeLayoutReader, uint nativeLayoutOffset) { NativeParser parser = new NativeParser(nativeLayoutReader, nativeLayoutOffset); string methodName = parser.GetString(); // Signatures are indirected to through a relative offset so that we don't have to parse them // when not comparing signatures (parsing them requires resolving types and is tremendously // expensive). NativeParser sigParser = parser.GetParserFromRelativeOffset(); IntPtr methodSigPtr = sigParser.Reader.OffsetToAddress(sigParser.Offset); return(new MethodNameAndSignature(methodName, methodSigPtr)); }