• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EETypePtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EETypePtr的典型用法代码示例。如果您正苦于以下问题:C# EETypePtr类的具体用法?C# EETypePtr怎么用?C# EETypePtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EETypePtr类属于命名空间,在下文中一共展示了EETypePtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RhBox

        public unsafe static object RhBox(EETypePtr pEEType, ref byte data)
        {
            EEType* ptrEEType = (EEType*)pEEType.ToPointer();
            int dataOffset = 0;
            object result;

            // If we're boxing a Nullable<T> then either box the underlying T or return null (if the
            // nullable's value is empty).
            if (ptrEEType->IsNullable)
            {
                // The boolean which indicates whether the value is null comes first in the Nullable struct.
                if (data == 0)
                    return null;

                // Switch type we're going to box to the Nullable<T> target type and advance the data pointer
                // to the value embedded within the nullable.
                dataOffset = ptrEEType->NullableValueOffset;
                ptrEEType = ptrEEType->NullableType;
            }

#if FEATURE_64BIT_ALIGNMENT
            if (ptrEEType->RequiresAlign8)
            {
                result = InternalCalls.RhpNewFastMisalign(ptrEEType);
            }
            else
#endif // FEATURE_64BIT_ALIGNMENT
            {
                result = InternalCalls.RhpNewFast(ptrEEType);
            }
            InternalCalls.RhpBox(result, ref Unsafe.Add(ref data, dataOffset));
            return result;
        }
开发者ID:nattress,项目名称:corert,代码行数:33,代码来源:RuntimeExports.cs


示例2: RhNewObject

        public unsafe static object RhNewObject(EETypePtr pEEType)
        {
            try
            {
                EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
                if (ptrEEType->RequiresAlign8)
                {
                    if (ptrEEType->IsValueType)
                        return InternalCalls.RhpNewFastMisalign(ptrEEType);
                    if (ptrEEType->IsFinalizable)
                        return InternalCalls.RhpNewFinalizableAlign8(ptrEEType);
                    return InternalCalls.RhpNewFastAlign8(ptrEEType);
                }
                else
#endif // FEATURE_64BIT_ALIGNMENT
                {
                    if (ptrEEType->IsFinalizable)
                        return InternalCalls.RhpNewFinalizable(ptrEEType);
                    return InternalCalls.RhpNewFast(ptrEEType);
                }
            }
            catch (OutOfMemoryException)
            {
                // Throw the out of memory exception defined by the classlib, using the input EEType* 
                // to find the correct classlib.

                ExceptionIDs exID = ExceptionIDs.OutOfMemory;

                IntPtr addr = pEEType.ToPointer()->GetAssociatedModuleAddress();
                Exception e = EH.GetClasslibException(exID, addr);
                throw e;
            }
        }
开发者ID:niemyjski,项目名称:corert,代码行数:34,代码来源:RuntimeExports.cs


示例3: RhNewArray

        public unsafe static object RhNewArray(EETypePtr pEEType, int length)
        {
            EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
            if (ptrEEType->RequiresAlign8)
            {
                return InternalCalls.RhpNewArrayAlign8(ptrEEType, length);
            }
            else
#endif // FEATURE_64BIT_ALIGNMENT
            {
                return InternalCalls.RhpNewArray(ptrEEType, length);
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:14,代码来源:RuntimeExports.cs


示例4: RhNewObject

        public unsafe static object RhNewObject(EETypePtr pEEType)
        {
            EEType* ptrEEType = (EEType*)pEEType.ToPointer();
#if FEATURE_64BIT_ALIGNMENT
            if (ptrEEType->RequiresAlign8)
            {
                if (ptrEEType->IsValueType)
                    return InternalCalls.RhpNewFastMisalign(ptrEEType);
                if (ptrEEType->IsFinalizable)
                    return InternalCalls.RhpNewFinalizableAlign8(ptrEEType);
                return InternalCalls.RhpNewFastAlign8(ptrEEType);
            }
            else
#endif // FEATURE_64BIT_ALIGNMENT
            {
                if (ptrEEType->IsFinalizable)
                    return InternalCalls.RhpNewFinalizable(ptrEEType);
                return InternalCalls.RhpNewFast(ptrEEType);
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:20,代码来源:RuntimeExports.cs


示例5: RhGetEETypeClassification

        public static unsafe RhEETypeClassification RhGetEETypeClassification(EETypePtr ptrEEType)
        {
            EEType* pEEType = ptrEEType.ToPointer();

            if (pEEType->IsArray)
                return RhEETypeClassification.Array;

            if (pEEType->IsGeneric)
                return RhEETypeClassification.Generic;

            if (pEEType->IsGenericTypeDefinition)
                return RhEETypeClassification.GenericTypeDefinition;

            if (pEEType->IsPointerTypeDefinition)
                return RhEETypeClassification.UnmanagedPointer;

            return RhEETypeClassification.Regular;
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:18,代码来源:RuntimeExports.cs


示例6: RhHasReferenceFields

 public static unsafe bool RhHasReferenceFields(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return pEEType->HasReferenceFields;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例7: RhIsNullable

 public static unsafe bool RhIsNullable(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return pEEType->IsNullable;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例8: RhIsArray

 public static unsafe bool RhIsArray(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return pEEType->IsArray;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例9: RhHasCctor

 public static unsafe bool RhHasCctor(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return pEEType->HasCctor;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例10: RhSetInterface

 public static unsafe void RhSetInterface(EETypePtr ptrEEType, int index, EETypePtr ptrInterfaceEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     EEType* pInterfaceEEType = ptrInterfaceEEType.ToPointer();
     pEEType->InterfaceMap[index].InterfaceType = pInterfaceEEType;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:6,代码来源:RuntimeExports.cs


示例11: RhUnboxAny

        public unsafe static void RhUnboxAny(object o, ref Hack_o_p data, EETypePtr pUnboxToEEType)
        {
            EEType* ptrUnboxToEEType = (EEType*)pUnboxToEEType.ToPointer();
            if (ptrUnboxToEEType->IsValueType)
            {
                // HACK: we would really want to take the address of o here,
                // but the rules of the C# language don't let us do that,
                // so we arrive at the same result by taking the address of p
                // and going back one pointer-sized unit
                fixed (IntPtr* pData = &data.p)
                {
                    bool isValid = false;

                    if (ptrUnboxToEEType->IsNullable)
                        isValid = (o == null) || (o.EEType == ptrUnboxToEEType->GetNullableType());
                    else
                        isValid = (o != null && o.EEType->CorElementType == ptrUnboxToEEType->CorElementType && TypeCast.IsInstanceOfClass(o, ptrUnboxToEEType) != null);

                    if (!isValid)
                    {
                        // Throw the invalid cast exception defined by the classlib, using the input unbox EEType* 
                        // to find the correct classlib.

                        ExceptionIDs exID = o == null ? ExceptionIDs.NullReference : ExceptionIDs.InvalidCast;

                        IntPtr addr = ptrUnboxToEEType->GetAssociatedModuleAddress();
                        Exception e = EH.GetClasslibException(exID, addr);

                        BinderIntrinsics.TailCall_RhpThrowEx(e);
                    }
                    InternalCalls.RhUnbox(o, pData - 1, ptrUnboxToEEType);
                }
            }
            else
                data.o = o;
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:36,代码来源:RuntimeExports.cs


示例12: RhBoxAny

 public unsafe static object RhBoxAny(ref Hack_o_p data, EETypePtr pEEType)
 {
     EEType* ptrEEType = (EEType*)pEEType.ToPointer();
     if (ptrEEType->IsValueType)
     {
         // HACK: we would really want to take the address of o here,
         // but the rules of the C# language don't let us do that,
         // so we arrive at the same result by taking the address of p
         // and going back one pointer-sized unit
         fixed (IntPtr* pData = &data.p)
             return RhBox(pEEType, pData - 1);
     }
     else
         return data.o;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:15,代码来源:RuntimeExports.cs


示例13: AreTypesEquivalent

 static unsafe public bool AreTypesEquivalent(EETypePtr pType1, EETypePtr pType2)
 {
     return (AreTypesEquivalentInternal(pType1.ToPointer(), pType2.ToPointer()));
 }
开发者ID:niemyjski,项目名称:corert,代码行数:4,代码来源:TypeCast.cs


示例14: FailedAllocation

        public static void FailedAllocation(EETypePtr pEEType, bool fIsOverflow)
        {
            ExceptionIDs exID = fIsOverflow ? ExceptionIDs.Overflow : ExceptionIDs.OutOfMemory;

            // Throw the out of memory exception defined by the classlib, using the input EEType* 
            // to find the correct classlib.

            throw pEEType.ToPointer()->GetClasslibException(exID);
        }
开发者ID:justinvp,项目名称:corert,代码行数:9,代码来源:ExceptionHandling.cs


示例15: RhBoxAny

 public unsafe static object RhBoxAny(ref byte data, EETypePtr pEEType)
 {
     EEType* ptrEEType = (EEType*)pEEType.ToPointer();
     if (ptrEEType->IsValueType)
     {
         return RhBox(pEEType, ref data);
     }
     else
     {
         return Unsafe.As<byte, Object>(ref data);
     }
 }
开发者ID:nattress,项目名称:corert,代码行数:12,代码来源:RuntimeExports.cs


示例16: RhGetNumInterfaces

 public static unsafe uint RhGetNumInterfaces(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return (uint)pEEType->NumInterfaces;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例17: RhGetInterface

        public static unsafe EETypePtr RhGetInterface(EETypePtr ptrEEType, uint index)
        {
            EEType* pEEType = ptrEEType.ToPointer();

            // The convoluted pointer arithmetic into the interface map below (rather than a simply array
            // dereference) is because C# will generate a 64-bit multiply for the lookup by default. This
            // causes us a problem on x86 because it uses a helper that's mapped directly into the CRT via
            // import magic and that technique doesn't work with the way we link this code into the runtime
            // image. Since we don't need a 64-bit multiply here (the classlib is trusted code) we manually
            // perform the calculation.
            EEInterfaceInfo* pInfo = (EEInterfaceInfo*)((byte*)pEEType->InterfaceMap + (index * (uint)sizeof(EEInterfaceInfo)));

            return new EETypePtr((IntPtr)pInfo->InterfaceType);
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:14,代码来源:RuntimeExports.cs


示例18: RhUnbox2

        static public unsafe void* RhUnbox2(EETypePtr pUnboxToEEType, Object obj)
        {
            EEType * ptrUnboxToEEType = (EEType *)pUnboxToEEType.ToPointer();
            if (obj.EEType != ptrUnboxToEEType)
            {
                // We allow enums and their primtive type to be interchangable
                if (obj.EEType->CorElementType != ptrUnboxToEEType->CorElementType)
                {
                    IntPtr addr = ptrUnboxToEEType->GetAssociatedModuleAddress();
                    Exception e = EH.GetClasslibException(ExceptionIDs.InvalidCast, addr);

                    BinderIntrinsics.TailCall_RhpThrowEx(e);
                }
            }

            fixed (void* pObject = &obj.m_pEEType)
            {
                // CORERT-TODO: This code has GC hole - the method return type should really be byref.
                // Requires byref returns in C# to fix cleanly (https://github.com/dotnet/roslyn/issues/118)
                return (IntPtr*)pObject + 1;
            }
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:22,代码来源:RuntimeExports.cs


示例19: RhIsDynamicType

 public static unsafe bool RhIsDynamicType(EETypePtr ptrEEType)
 {
     EEType* pEEType = ptrEEType.ToPointer();
     return pEEType->IsDynamicType;
 }
开发者ID:huamichaelchen,项目名称:corert,代码行数:5,代码来源:RuntimeExports.cs


示例20: RhUnboxNullable

        static public unsafe void RhUnboxNullable(ref Hack_o_p data, EETypePtr pUnboxToEEType, Object obj)
        {
            EEType* ptrUnboxToEEType = (EEType*)pUnboxToEEType.ToPointer();

            // HACK: we would really want to take the address of o here,
            // but the rules of the C# language don't let us do that,
            // so we arrive at the same result by taking the address of p
            // and going back one pointer-sized unit
            fixed (IntPtr* pData = &data.p)
            {
                if ((obj != null) && (obj.EEType != ptrUnboxToEEType->GetNullableType()))
                {
                    IntPtr addr = ptrUnboxToEEType->GetAssociatedModuleAddress();
                    Exception e = EH.GetClasslibException(ExceptionIDs.InvalidCast, addr);

                    BinderIntrinsics.TailCall_RhpThrowEx(e);
                }
                InternalCalls.RhUnbox(obj, pData - 1, ptrUnboxToEEType);
            }
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:20,代码来源:RuntimeExports.cs



注:本文中的EETypePtr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EFDal类代码示例发布时间:2022-05-24
下一篇:
C# EEType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap