From: Michal Strehovský Date: Fri, 10 Feb 2023 14:43:15 +0000 (+0900) Subject: Fix `getMethodSig` for array methods (#81942) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~4106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7802c395bfa00fdfaf81086dc24aed4cc88e4473;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix `getMethodSig` for array methods (#81942) Found by JIT tests. This also affects crossgen2, wonder why we haven't seen it. --- diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index c092df8..fbb17f2 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -1151,12 +1151,19 @@ namespace Internal.JitInterface // supplied by RyuJIT is a concrete instantiation. if (type != method.OwningType) { - Debug.Assert(type.HasSameTypeDefinition(method.OwningType)); - Instantiation methodInst = method.Instantiation; - method = _compilation.TypeSystemContext.GetMethodForInstantiatedType(method.GetTypicalMethodDefinition(), (InstantiatedType)type); - if (methodInst.Length > 0) + if (type.IsArray) { - method = method.MakeInstantiatedMethod(methodInst); + method = ((ArrayType)type).GetArrayMethod(((ArrayMethod)method).Kind); + } + else + { + Debug.Assert(type.HasSameTypeDefinition(method.OwningType)); + Instantiation methodInst = method.Instantiation; + method = _compilation.TypeSystemContext.GetMethodForInstantiatedType(method.GetTypicalMethodDefinition(), (InstantiatedType)type); + if (methodInst.Length > 0) + { + method = method.MakeInstantiatedMethod(methodInst); + } } } }