Skip to content

Commit

Permalink
Add support for nested types in the corelib.h parser for rooting de…
Browse files Browse the repository at this point in the history
…scriptors (#105432)
  • Loading branch information
jkoritzinsky committed Jul 25, 2024
1 parent 6bd555e commit f060387
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
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

0 comments on commit f060387

Please sign in to comment.