Esempio n. 1
0
        // compress a token
        // The least significant bit of the first compress byte will indicate the token type.
        //
        public void EmitToken(mdToken token)
        {
            uint         rid  = RidFromToken(token);
            CorTokenType type = (CorTokenType)TypeFromToken(token);

            if (rid > 0x3FFFFFF)
            {
                // token is too big to be compressed
                throw new NotImplementedException();
            }

            rid = (rid << 2);

            // TypeDef is encoded with low bits 00
            // TypeRef is encoded with low bits 01
            // TypeSpec is encoded with low bits 10
            // BaseType is encoded with low bit 11
            switch (type)
            {
            case CorTokenType.mdtTypeDef:
                break;

            case CorTokenType.mdtTypeRef:
                // make the last two bits 01
                rid |= 0x1;
                break;

            case CorTokenType.mdtTypeSpec:
                // make last two bits 0
                rid |= 0x2;
                break;

            case CorTokenType.mdtBaseType:
                rid |= 0x3;
                break;

            default:
                throw new NotImplementedException();
            }

            EmitUInt(rid);
        }
Esempio n. 2
0
 public void EmitTokenRid(mdToken token)
 {
     EmitUInt((uint)RidFromToken(token));
 }
Esempio n. 3
0
 public static CorTokenType TypeFromToken(mdToken token)
 {
     return(TypeFromToken((int)token));
 }
Esempio n. 4
0
 public static uint RidFromToken(mdToken token)
 {
     return(unchecked ((uint)token) & 0x00FFFFFFu);
 }
Esempio n. 5
0
 private InfoAccessType constructStringLiteral(IntPtr _this, CORINFO_MODULE_STRUCT_* module, mdToken metaTok, ref void* ppValue)
 {
     MethodIL methodIL = (MethodIL)HandleToObject((IntPtr)module);
     object literal = methodIL.GetObject((int)metaTok);
     ppValue = (void*)ObjectToHandle(_compilation.NodeFactory.StringIndirection((string)literal));
     return InfoAccessType.IAT_PPVALUE;
 }
Esempio n. 6
0
 private byte* findNameOfToken(IntPtr _this, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity)
 { throw new NotImplementedException("findNameOfToken"); }
 public IMethodNode CreateUnboxingStubNode(MethodDesc method, mdToken token)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
 static byte* _findNameOfToken(IntPtr thisHandle, IntPtr* ppException, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.findNameOfToken(moduleHandle, token, szFQName, FQNameCapacity);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(byte*);
     }
 }
Esempio n. 9
0
        public virtual byte* findNameOfToken_wrapper(IntPtr _this, out IntPtr exception, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity)
        {
            exception = IntPtr.Zero;
            try
            {
                return findNameOfToken(moduleHandle, token, szFQName, FQNameCapacity);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (byte*)0;
        }
Esempio n. 10
0
 private InfoAccessType constructStringLiteral(CORINFO_MODULE_STRUCT_* module, mdToken metaTok, ref void* ppValue)
 {
     MethodIL methodIL = (MethodIL)HandleToObject((IntPtr)module);
     object literal = methodIL.GetObject((int)metaTok);
     ISymbolNode stringObject = _compilation.NodeFactory.SerializedStringObject((string)literal);
     ppValue = (void*)ObjectToHandle(stringObject);
     return stringObject.RepresentsIndirectionCell ? InfoAccessType.IAT_PVALUE : InfoAccessType.IAT_VALUE;
 }
Esempio n. 11
0
 public ModuleToken(EcmaModule module, Handle handle)
 {
     Module = module;
     Token  = (mdToken)MetadataTokens.GetToken(handle);
 }
Esempio n. 12
0
 public ModuleToken(EcmaModule module, EntityHandle entityHandle)
 {
     Module = module;
     Token  = (mdToken)MetadataTokens.GetToken(entityHandle);
 }
Esempio n. 13
0
 public ModuleToken(EcmaModule module, mdToken token)
 {
     Module = module;
     Token  = token;
 }
Esempio n. 14
0
 static InfoAccessType _constructStringLiteral(IntPtr thisHandle, IntPtr* ppException, CORINFO_MODULE_STRUCT_* module, mdToken metaTok, ref void* ppValue)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.constructStringLiteral(module, metaTok, ref ppValue);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(InfoAccessType);
     }
 }
Esempio n. 15
0
        public virtual InfoAccessType constructStringLiteral_wrapper(IntPtr _this, out IntPtr exception, CORINFO_MODULE_STRUCT_* module, mdToken metaTok, ref void* ppValue)
        {
            exception = IntPtr.Zero;
            try
            {
                return constructStringLiteral(module, metaTok, ref ppValue);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (InfoAccessType)0;
        }
Esempio n. 16
0
        private InfoAccessType constructStringLiteral(CORINFO_MODULE_STRUCT_ *module, mdToken metaTok, ref void *ppValue)
        {
            ISymbolNode stringObject = _compilation.SymbolNodeFactory.StringLiteral(new ModuleToken(_tokenContext, metaTok));

            ppValue = (void *)ObjectToHandle(stringObject);
            return(InfoAccessType.IAT_PPVALUE);
        }
Esempio n. 17
0
 InfoAccessType constructStringLiteral(IntPtr _this, CORINFO_MODULE_STRUCT_* module, mdToken metaTok, ref void* ppValue)
 {
     MethodIL methodIL = (MethodIL) HandleToObject((IntPtr)module);
     object literal = methodIL.GetObject((int)metaTok);
     ppValue = (void*) ObjectToHandle(literal);
     return InfoAccessType.IAT_PPVALUE;
 }