diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunExternalTypeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunExternalTypeMapNode.cs index 3d7b839650a730..323986eef8b6b7 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunExternalTypeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunExternalTypeMapNode.cs @@ -39,13 +39,14 @@ public override int CompareToImpl(ISortableNode other, CompilerComparer comparer public Vertex CreateTypeMap(NodeFactory factory, NativeWriter writer, Section section, INativeFormatTypeReferenceProvider externalReferences) { + Vertex typeMapGroupVertex = externalReferences.EncodeReferenceToType(writer, TypeMapGroup); if (map.ThrowingMethodStub is not null) { // We don't write out the throwing method stub for R2R // as emitting loose methods is not supported/very expensive. // Instead, we defer to the runtime to generate the type map // and throw on error cases. - return section.Place(writer.GetUnsignedConstant(0)); // Invalid type map state + return section.Place(writer.GetTuple(typeMapGroupVertex, writer.GetUnsignedConstant(0))); // Invalid type map state } VertexHashtable typeMapHashTable = new(); @@ -61,7 +62,6 @@ public Vertex CreateTypeMap(NodeFactory factory, NativeWriter writer, Section se } Vertex typeMapStateVertex = writer.GetUnsignedConstant(1); // Valid type map state - Vertex typeMapGroupVertex = externalReferences.EncodeReferenceToType(writer, TypeMapGroup); Vertex tuple = writer.GetTuple(typeMapGroupVertex, typeMapStateVertex, typeMapHashTable); return section.Place(tuple); } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunProxyTypeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunProxyTypeMapNode.cs index d002fba34c8123..8fae8fc1108eb5 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunProxyTypeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunProxyTypeMapNode.cs @@ -37,6 +37,7 @@ public override int CompareToImpl(ISortableNode other, CompilerComparer comparer public Vertex CreateTypeMap(NodeFactory factory, NativeWriter writer, Section section, INativeFormatTypeReferenceProvider ProxyReferences) { + Vertex typeMapGroupVertex = ProxyReferences.EncodeReferenceToType(writer, TypeMapGroup); if (map.ThrowingMethodStub is not null) { // We don't write out the throwing method stub for R2R @@ -45,7 +46,7 @@ public Vertex CreateTypeMap(NodeFactory factory, NativeWriter writer, Section se // in the managed type system. // Instead, we defer to the runtime to generate the type map // and throw on error cases. - return section.Place(writer.GetUnsignedConstant(0)); // Invalid type map state + return section.Place(writer.GetTuple(typeMapGroupVertex, writer.GetUnsignedConstant(0))); // Invalid type map state } VertexHashtable typeMapHashTable = new(); @@ -61,7 +62,6 @@ public Vertex CreateTypeMap(NodeFactory factory, NativeWriter writer, Section se } Vertex typeMapStateVertex = writer.GetUnsignedConstant(1); // Valid type map state - Vertex typeMapGroupVertex = ProxyReferences.EncodeReferenceToType(writer, TypeMapGroup); Vertex tuple = writer.GetTuple(typeMapGroupVertex, typeMapStateVertex, typeMapHashTable); return section.Place(tuple); }