// 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); }
public void EmitTokenRid(mdToken token) { EmitUInt((uint)RidFromToken(token)); }
public static CorTokenType TypeFromToken(mdToken token) { return(TypeFromToken((int)token)); }
public static uint RidFromToken(mdToken token) { return(unchecked ((uint)token) & 0x00FFFFFFu); }
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; }
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(); }
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*); } }
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; }
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; }
public ModuleToken(EcmaModule module, Handle handle) { Module = module; Token = (mdToken)MetadataTokens.GetToken(handle); }
public ModuleToken(EcmaModule module, EntityHandle entityHandle) { Module = module; Token = (mdToken)MetadataTokens.GetToken(entityHandle); }
public ModuleToken(EcmaModule module, mdToken token) { Module = module; Token = token; }
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); } }
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; }
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); }
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; }