//-------------------------------------------------------------------------
// The "this" pointer
- if (!(mflags & CORINFO_FLG_STATIC) && !((opcode == CEE_NEWOBJ) && (newobjThis == nullptr)))
+ if (((mflags & CORINFO_FLG_STATIC) == 0) && ((sig->callConv & CORINFO_CALLCONV_EXPLICITTHIS) == 0) &&
+ !((opcode == CEE_NEWOBJ) && (newobjThis == nullptr)))
{
GenTree* obj;
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// This tests a calli with explicit this in the signature
+
+.assembly extern System.Runtime {}
+.assembly GitHub_35384 {}
+
+.class private sequential ansi sealed beforefieldinit Struct
+ extends [System.Runtime]System.ValueType
+{
+ .field public int32 a
+
+ .method public hidebysig instance string
+ InstanceMethod() cil managed noinlining
+ {
+ .maxstack 1
+ ldstr "Instance method"
+ ret
+ } // end of method Struct::InstanceMethod
+
+} // end of class Struct
+
+.class public auto beforefieldinit Program
+ extends [System.Runtime]System.Object
+{
+ .method private hidebysig static string
+ ValueTypeExplicitThisInstanceMethodCalli() cil managed noinlining
+ {
+ .maxstack 2
+ .locals init (valuetype Struct V_0)
+ ldloca.s V_0
+ initobj Struct
+ ldloca.s V_0
+ ldftn instance string Struct::InstanceMethod()
+ calli explicit instance string(valuetype Struct&)
+ ret
+ } // end of method Program::ValueTypeExplicitThisInstanceMethodCalli
+
+ .method private hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ .maxstack 1
+ call string Program::ValueTypeExplicitThisInstanceMethodCalli()
+ pop
+ ldc.i4 100
+ ret
+ } // end of method Program::Main
+} // end of class Program
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk.IL">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ </PropertyGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+</Project>