diff options
author | Michal Strehovský <michals@microsoft.com> | 2015-10-28 01:26:44 +0300 |
---|---|---|
committer | Michal Strehovský <michals@microsoft.com> | 2015-10-28 04:09:45 +0300 |
commit | 26b7bfce3750a1dc8ba876fe65e94810b489ea33 (patch) | |
tree | f7ead3a95ba4fe5f87ae54eb43164920b37a473d /src/JitInterface | |
parent | 1cf9d9fa942f47023f4d75bbfeb7c06ad4ba9cd9 (diff) |
Fix a few issues around compiling Hello World on Linux
* We need to properly report CONTAINS_GC_PTR because RyuJIT can catch us lying.
* getUnboxHelper gets called (the implementation is easy enough so I just did it).
* While I was at it, I removed the cast to EcmaType from getClassAttribs.
* Added a bunch of obvious comments.
Diffstat (limited to 'src/JitInterface')
-rw-r--r-- | src/JitInterface/src/CorInfoImpl.cs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs index bd9e17d50..23a7a5876 100644 --- a/src/JitInterface/src/CorInfoImpl.cs +++ b/src/JitInterface/src/CorInfoImpl.cs @@ -680,22 +680,20 @@ namespace Internal.JitInterface // if (type.IsUnsafeValueType) // result |= CorInfoFlag.CORINFO_FLG_UNSAFE_VALUECLASS; } - - // TODO - // if (type.ContainsPointers) - // result |= CorInfoFlag.CORINFO_FLG_CONTAINS_GC_PTR; - + if (type.IsDelegate) result |= CorInfoFlag.CORINFO_FLG_DELEGATE; - var ecmaType = type.GetTypeDefinition() as EcmaType; - if (ecmaType != null) + var metadataType = type as MetadataType; + if (metadataType != null) { - var attr = ecmaType.Attributes; - if ((attr & TypeAttributes.BeforeFieldInit) != 0) + if (metadataType.ContainsPointers) + result |= CorInfoFlag.CORINFO_FLG_CONTAINS_GC_PTR; + + if (metadataType.IsBeforeFieldInit) result |= CorInfoFlag.CORINFO_FLG_BEFOREFIELDINIT; - if ((attr & TypeAttributes.Sealed) != 0) + if (metadataType.IsSealed) result |= CorInfoFlag.CORINFO_FLG_FINAL; } @@ -887,7 +885,11 @@ namespace Internal.JitInterface } CorInfoHelpFunc getUnBoxHelper(IntPtr _this, CORINFO_CLASS_STRUCT_* cls) - { throw new NotImplementedException(); } + { + var type = HandleToObject(cls); + + return type.IsNullable ? CorInfoHelpFunc.CORINFO_HELP_UNBOX_NULLABLE : CorInfoHelpFunc.CORINFO_HELP_UNBOX; + } void getReadyToRunHelper(IntPtr _this, ref CORINFO_RESOLVED_TOKEN pResolvedToken, CorInfoHelpFunc id, ref CORINFO_CONST_LOOKUP pLookup) { |