@@ -1370,7 +1370,7 @@ type ILInstr =
13701370
13711371 | I_ call of ILTailcall * ILMethodSpec * ILVarArgs
13721372 | I_ callvirt of ILTailcall * ILMethodSpec * ILVarArgs
1373- | I_ callconstraint of ILTailcall * ILType * ILMethodSpec * ILVarArgs
1373+ | I_ callconstraint of callvirt : bool * ILTailcall * ILType * ILMethodSpec * ILVarArgs
13741374 | I_ calli of ILTailcall * ILCallingSignature * ILVarArgs
13751375 | I_ ldftn of ILMethodSpec
13761376 | I_ newobj of ILMethodSpec * ILVarArgs
@@ -3410,9 +3410,6 @@ let mkNormalCall mspec = I_call(Normalcall, mspec, None)
34103410
34113411let mkNormalCallvirt mspec = I_ callvirt( Normalcall, mspec, None)
34123412
3413- let mkNormalCallconstraint ( ty , mspec ) =
3414- I_ callconstraint( Normalcall, ty, mspec, None)
3415-
34163413let mkNormalNewobj mspec = I_ newobj( mspec, None)
34173414
34183415/// Comment on common object cache sizes:
@@ -3822,18 +3819,24 @@ let mkILClassCtor impl =
38223819let mk_ospec ( ty : ILType , callconv , nm , genparams , formal_args , formal_ret ) =
38233820 OverridesSpec( mkILMethRef ( ty.TypeRef, callconv, nm, genparams, formal_ args, formal_ ret), ty)
38243821
3825- let mkILGenericVirtualMethod ( nm , access , genparams , actual_args , actual_ret , impl ) =
3822+ let mkILGenericVirtualMethod ( nm , callconv : ILCallingConv , access , genparams , actual_args , actual_ret , impl ) =
3823+ let attributes =
3824+ convertMemberAccess access
3825+ ||| MethodAttributes.CheckAccessOnOverride
3826+ ||| ( match impl with
3827+ | MethodBody.Abstract -> MethodAttributes.Abstract ||| MethodAttributes.Virtual
3828+ | _ -> MethodAttributes.Virtual)
3829+ ||| ( if callconv.IsInstance then
3830+ enum 0
3831+ else
3832+ MethodAttributes.Static)
3833+
38263834 ILMethodDef(
38273835 name = nm,
3828- attributes =
3829- ( convertMemberAccess access
3830- ||| MethodAttributes.CheckAccessOnOverride
3831- ||| ( match impl with
3832- | MethodBody.Abstract -> MethodAttributes.Abstract ||| MethodAttributes.Virtual
3833- | _ -> MethodAttributes.Virtual)),
3836+ attributes = attributes,
38343837 implAttributes = MethodImplAttributes.Managed,
38353838 genericParams = genparams,
3836- callingConv = ILCallingConv.Instance ,
3839+ callingConv = callconv ,
38373840 parameters = actual_ args,
38383841 ret = actual_ ret,
38393842 isEntryPoint = false ,
@@ -3842,8 +3845,11 @@ let mkILGenericVirtualMethod (nm, access, genparams, actual_args, actual_ret, im
38423845 body = notlazy impl
38433846 )
38443847
3845- let mkILNonGenericVirtualMethod ( nm , access , args , ret , impl ) =
3846- mkILGenericVirtualMethod ( nm, access, mkILEmptyGenericParams, args, ret, impl)
3848+ let mkILNonGenericVirtualMethod ( nm , callconv , access , args , ret , impl ) =
3849+ mkILGenericVirtualMethod ( nm, callconv, access, mkILEmptyGenericParams, args, ret, impl)
3850+
3851+ let mkILNonGenericVirtualInstanceMethod ( nm , access , args , ret , impl ) =
3852+ mkILNonGenericVirtualMethod ( nm, ILCallingConv.Instance, access, args, ret, impl)
38473853
38483854let mkILGenericNonVirtualMethod ( nm , access , genparams , actual_args , actual_ret , impl ) =
38493855 ILMethodDef(
@@ -4267,7 +4273,7 @@ let mkILDelegateMethods access (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IAsy
42674273
42684274 let one nm args ret =
42694275 let mdef =
4270- mkILNonGenericVirtualMethod ( nm, access, args, mkILReturn ret, MethodBody.Abstract)
4276+ mkILNonGenericVirtualInstanceMethod ( nm, access, args, mkILReturn ret, MethodBody.Abstract)
42714277
42724278 mdef.WithAbstract( false ) .WithHideBySig( true ) .WithRuntime( true )
42734279
@@ -5298,7 +5304,7 @@ and refsOfILInstr s x =
52985304 | I_ callvirt (_, mr, varargs) ->
52995305 refsOfILMethodSpec s mr
53005306 refsOfILVarArgs s varargs
5301- | I_ callconstraint (_, tr, mr, varargs) ->
5307+ | I_ callconstraint (_, _, tr, mr, varargs) ->
53025308 refsOfILType s tr
53035309 refsOfILMethodSpec s mr
53045310 refsOfILVarArgs s varargs
0 commit comments