diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-11-14 06:28:30 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-11-14 06:28:30 +0300 |
commit | aec50fda7522c9e53eb2cea0968c51a8a29a8f08 (patch) | |
tree | 63dda68f018d72577a9b96ce15fb88d950637203 /src/JitInterface | |
parent | 3c9a8d00b9a9cca85acb65c7439a197235db9782 (diff) | |
parent | 9713772c1168053ae00030b58100e184ac69fb85 (diff) |
Merge pull request #261 from MichalStrehovsky/todos
Remove casting to EcmaMethod from JitInterface
Diffstat (limited to 'src/JitInterface')
-rw-r--r-- | src/JitInterface/src/CorInfoImpl.cs | 106 |
1 files changed, 44 insertions, 62 deletions
diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs index 648ab25a1..42e64c277 100644 --- a/src/JitInterface/src/CorInfoImpl.cs +++ b/src/JitInterface/src/CorInfoImpl.cs @@ -356,80 +356,62 @@ namespace Internal.JitInterface { CorInfoFlag result = 0; - EcmaMethod ecmaMethod = method.GetTypicalMethodDefinition() as EcmaMethod; - if (ecmaMethod != null) - { - var attribs = ecmaMethod.Attributes; - - // CORINFO_FLG_PROTECTED - verification only - - if ((attribs & MethodAttributes.Static) != 0) - result |= CorInfoFlag.CORINFO_FLG_STATIC; + // CORINFO_FLG_PROTECTED - verification only - // TODO: if (pMD->IsSynchronized()) - // result |= CORINFO_FLG_SYNCH; + if (method.Signature.IsStatic) + result |= CorInfoFlag.CORINFO_FLG_STATIC; - if (ecmaMethod.IsIntrinsic) - result |= CorInfoFlag.CORINFO_FLG_INTRINSIC; - - if ((attribs & MethodAttributes.Virtual) != 0) - result |= CorInfoFlag.CORINFO_FLG_VIRTUAL; - if ((attribs & MethodAttributes.Abstract) != 0) - result |= CorInfoFlag.CORINFO_FLG_ABSTRACT; - if ((attribs & MethodAttributes.SpecialName) != 0) - { - string name = method.Name; - if (name == ".ctor" || name == ".cctor") - result |= CorInfoFlag.CORINFO_FLG_CONSTRUCTOR; - } + // TODO: if (pMD->IsSynchronized()) + // result |= CORINFO_FLG_SYNCH; - // - // See if we need to embed a .cctor call at the head of the - // method body. - // + if (method.IsIntrinsic) + result |= CorInfoFlag.CORINFO_FLG_INTRINSIC; + if (method.IsVirtual) + result |= CorInfoFlag.CORINFO_FLG_VIRTUAL; + if (method.IsAbstract) + result |= CorInfoFlag.CORINFO_FLG_ABSTRACT; + if (method.IsConstructor || method.IsStaticConstructor) + result |= CorInfoFlag.CORINFO_FLG_CONSTRUCTOR; - var owningType = method.OwningType; + // + // See if we need to embed a .cctor call at the head of the + // method body. + // - var typeAttribs = ((EcmaType)owningType.GetTypeDefinition()).Attributes; + var owningType = method.OwningType; + var owningMetadataType = owningType as MetadataType; - // method or class might have the final bit - if ((attribs & MethodAttributes.Final) != 0 || (typeAttribs & TypeAttributes.Sealed) != 0) - result |= CorInfoFlag.CORINFO_FLG_FINAL; + // method or class might have the final bit + if (method.IsFinal || (owningMetadataType != null && owningMetadataType.IsSealed)) + result |= CorInfoFlag.CORINFO_FLG_FINAL; - // TODO: Generics - // if (pMD->IsSharedByGenericInstantiations()) - // result |= CORINFO_FLG_SHAREDINST; - - // TODO: PInvoke - // if ((attribs & MethodAttributes.PinvokeImpl) != 0) - // result |= CorInfoFlag.CORINFO_FLG_PINVOKE; + // TODO: Generics + // if (pMD->IsSharedByGenericInstantiations()) + // result |= CORINFO_FLG_SHAREDINST; - // TODO: Cache inlining hits - // Check for an inlining directive. + // TODO: PInvoke + // if ((attribs & MethodAttributes.PinvokeImpl) != 0) + // result |= CorInfoFlag.CORINFO_FLG_PINVOKE; - var implAttribs = ecmaMethod.ImplAttributes; - if ((implAttribs & MethodImplAttributes.NoInlining) != 0) - { - /* Function marked as not inlineable */ - result |= CorInfoFlag.CORINFO_FLG_DONT_INLINE; - } - else if ((implAttribs & MethodImplAttributes.AggressiveInlining) != 0) - { - result |= CorInfoFlag.CORINFO_FLG_FORCEINLINE; - } + // TODO: Cache inlining hits + // Check for an inlining directive. - if (owningType.IsDelegate) - { - if (method.Name == "Invoke") - // This is now used to emit efficient invoke code for any delegate invoke, - // including multicast. - result |= CorInfoFlag.CORINFO_FLG_DELEGATE_INVOKE; - } + if (method.IsNoInlining) + { + /* Function marked as not inlineable */ + result |= CorInfoFlag.CORINFO_FLG_DONT_INLINE; } - else + else if (method.IsAggressiveInlining) + { + result |= CorInfoFlag.CORINFO_FLG_FORCEINLINE; + } + + if (owningType.IsDelegate) { - if (method.Signature.IsStatic) - result |= CorInfoFlag.CORINFO_FLG_STATIC; + if (method.Name == "Invoke") + // This is now used to emit efficient invoke code for any delegate invoke, + // including multicast. + result |= CorInfoFlag.CORINFO_FLG_DELEGATE_INVOKE; } result |= CorInfoFlag.CORINFO_FLG_NOSECURITYWRAP; |