[Tizen] Fix module setup in mcj-edit for generic args and fnptr args
authorGleb Balykov <g.balykov@samsung.com>
Tue, 9 Aug 2022 10:00:51 +0000 (13:00 +0300)
committerGleb Balykov <g.balykov@samsung.com>
Tue, 27 Sep 2022 12:50:22 +0000 (15:50 +0300)
See usage of GetTypeHandleThrowing in src/coreclr/vm/siginfo.cpp for more details.

src/coreclr/tools/mcj-edit/mcj-edit.py

index 751af502cb54be11b106b3a54759f948754174f5..6c34d2be23137bb2b9c07684620678728dcdf32a 100644 (file)
@@ -2414,6 +2414,8 @@ class MethodBinarySignatureDecoder: # pylint: disable=too-few-public-methods
             return TypeSimple.createByRef(typ)
 
         # III. Decode non-primitive type
+        origModuleIndex = self._moduleIndex
+
         if (typ == CorTypeInfo.CorElementType.ELEMENT_TYPE_TYPEDBYREF): # pylint: disable=no-else-raise
             # TODO: support this?
             raise UnsupportedError()
@@ -2452,7 +2454,7 @@ class MethodBinarySignatureDecoder: # pylint: disable=too-few-public-methods
                 numArgs = self._decodeValue()
                 args = []
                 for i in range(numArgs): # pylint: disable=unused-variable
-                    args.append(self._decodeSignatureForTypeHandle(moduleIndex))
+                    args.append(self._decodeSignatureForTypeHandle(origModuleIndex))
 
                 return TypeGeneric.createByRef(typ, TypeToken.createByRef(nextTyp, moduleIndex, typeToken), args)
         elif (typ in (CorTypeInfo.CorElementType.ELEMENT_TYPE_CLASS,
@@ -2491,7 +2493,7 @@ class MethodBinarySignatureDecoder: # pylint: disable=too-few-public-methods
             cArgs = self._decodeValue()
             retAndArgs = []
             for i in range(cArgs):
-                retAndArgs.append(self._decodeSignatureForTypeHandle(moduleIndex))
+                retAndArgs.append(self._decodeSignatureForTypeHandle(origModuleIndex))
             return TypeFNPtr.createByRef(typ, callConv, retAndArgs)
         elif (typ == CorTypeInfo.CorElementType.ELEMENT_TYPE_INTERNAL): # pylint: disable=no-else-raise
             # TODO: support this?