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

Add support for nested types in the corelib.h parser for rooting descriptors #105432

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/coreclr/vm/corelib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1123,15 +1123,10 @@ DEFINE_METHOD(UTF8STRINGMARSHALLER, CONVERT_TO_MANAGED, ConvertToManaged, SM_Ptr
DEFINE_METHOD(UTF8STRINGMARSHALLER, CONVERT_TO_UNMANAGED, ConvertToUnmanaged, SM_Str_RetPtrByte)
DEFINE_METHOD(UTF8STRINGMARSHALLER, FREE, Free, SM_PtrByte_RetVoid)

// The generator for the ILLink XML doesn't understand inner classes so generation
// needs to skip the following type.
// See https://github.com/dotnet/runtime/issues/71847
#ifndef FOR_ILLINK
DEFINE_CLASS(UTF8STRINGMARSHALLER_IN, Marshalling, Utf8StringMarshaller+ManagedToUnmanagedIn)
DEFINE_METHOD(UTF8STRINGMARSHALLER_IN, FROM_MANAGED, FromManaged, IM_Str_SpanOfByte_RetVoid)
DEFINE_METHOD(UTF8STRINGMARSHALLER_IN, TO_UNMANAGED, ToUnmanaged, IM_RetPtrByte)
DEFINE_METHOD(UTF8STRINGMARSHALLER_IN, FREE, Free, IM_RetVoid)
#endif // FOR_ILLINK

DEFINE_CLASS(UTF8BUFFERMARSHALER, StubHelpers, UTF8BufferMarshaler)
DEFINE_METHOD(UTF8BUFFERMARSHALER, CONVERT_TO_NATIVE, ConvertToNative, NoSig)
Expand Down Expand Up @@ -1180,9 +1175,7 @@ DEFINE_CLASS(EXCEPTIONSERVICES_INTERNALCALLS, ExceptionServices, InternalCalls)
DEFINE_CLASS(STACKFRAMEITERATOR, Runtime, StackFrameIterator)
#endif // FEATURE_EH_FUNCLETS

#ifndef FOR_ILLINK
DEFINE_CLASS(EXINFO, Runtime, EH+ExInfo)
#endif // FOR_ILLINK

DEFINE_CLASS_U(System, GCMemoryInfoData, GCMemoryInfoData)
DEFINE_FIELD_U(_highMemoryLoadThresholdBytes, GCMemoryInfoData, highMemLoadThresholdBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,10 @@ string GetFullClassName (string classNamespace, string className)
Log.LogError ($"Unknown namespace '{classNamespace}'.");
}

return namespaceDictionary[classNamespace] + "." + className;
// Convert from the System.Reflection/CoreCLR nested type name format to the IL/Cecil format.
string classNameWithCecilNestedFormat = className.Replace ('+', '/');

return namespaceDictionary[classNamespace] + "." + classNameWithCecilNestedFormat;
}

void InitializeDefineConstants ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public void TestCoreLibClassGen ()
"#endif // FEATURE_BOTH",
"#if FOR_ILLINK",
"DEFINE_METHOD(TESTCLASS, TESTMETHODFORILLINK, TestMethodForILLink, 5)",
"#endif"
"#endif",
"DEFINE_CLASS(NESTEDTESTCLASS, TestNS, TestClass+Nested)",
"DEFINE_METHOD(NESTEDTESTCLASS, TESTMETHOD, TestMethod, 0)"
});

File.WriteAllText ("namespace.h",
Expand Down Expand Up @@ -90,6 +92,8 @@ public void TestCoreLibClassGen ()
new XElement ("method", new XAttribute ("name", "TestMethodIfNotBoth")),
new XElement ("method", new XAttribute ("name", "TestMethodIfNotBothForILLink")),
new XElement ("method", new XAttribute ("name", "TestMethodForILLink"))),
new XElement ("type", new XAttribute("fullname", "TestNS.TestClass/Nested"),
new XElement ("method", new XAttribute("name", "TestMethod"))),
new XElement ("type", new XAttribute ("fullname", "TestNS.TestAlwaysException"),
new XElement ("method", new XAttribute ("name", ".ctor"))),
new XElement ("type", new XAttribute ("fullname", "TestNS.TestFeatureOnException"),
Expand Down
Loading