本文整理汇总了C#中ILCompiler.DependencyAnalysis.NodeFactory.GenericDictionaryLayout方法的典型用法代码示例。如果您正苦于以下问题:C# NodeFactory.GenericDictionaryLayout方法的具体用法?C# NodeFactory.GenericDictionaryLayout怎么用?C# NodeFactory.GenericDictionaryLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILCompiler.DependencyAnalysis.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.GenericDictionaryLayout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMarked
protected sealed override void OnMarked(NodeFactory factory)
{
// When the helper call gets marked, ensure the generic layout for the associated dictionaries
// includes the signature.
factory.GenericDictionaryLayout(_dictionaryOwner).EnsureEntry(_lookupSignature);
if ((_id == ReadyToRunHelperId.GetGCStaticBase || _id == ReadyToRunHelperId.GetThreadStaticBase) &&
factory.TypeSystemContext.HasLazyStaticConstructor((TypeDesc)_target))
{
// If the type has a lazy static constructor, we also need the non-GC static base
// because that's where the class constructor context is.
factory.GenericDictionaryLayout(_dictionaryOwner).EnsureEntry(factory.GenericLookup.TypeNonGCStaticBase((TypeDesc)_target));
}
}
示例2: EmitDictionaryLookup
protected void EmitDictionaryLookup(NodeFactory factory, ref X64Emitter encoder, Register context, Register result, GenericLookupResult lookup, bool relocsOnly)
{
// INVARIANT: must not trash context register
// Find the generic dictionary slot
int dictionarySlot = 0;
if (!relocsOnly)
{
// The concrete slot won't be known until we're emitting data - don't ask for it in relocsOnly.
dictionarySlot = factory.GenericDictionaryLayout(_dictionaryOwner).GetSlotForEntry(lookup);
}
// Load the generic dictionary cell
AddrMode loadEntry = new AddrMode(
context, null, dictionarySlot * factory.Target.PointerSize, 0, AddrModeSize.Int64);
encoder.EmitMOV(result, ref loadEntry);
}
示例3: EmitCode
//.........这里部分代码省略.........
encoder.EmitMOV(encoder.TargetRegister.Arg1, encoder.TargetRegister.Result);
encoder.EmitJMP(factory.HelperEntrypoint(HelperEntrypoint.EnsureClassConstructorRunAndReturnGCStaticBase));
}
}
break;
case ReadyToRunHelperId.DelegateCtor:
{
DelegateCreationInfo target = (DelegateCreationInfo)Target;
encoder.EmitLEAQ(encoder.TargetRegister.Arg2, target.Target);
if (target.Thunk != null)
{
Debug.Assert(target.Constructor.Method.Signature.Length == 3);
encoder.EmitLEAQ(encoder.TargetRegister.Arg3, target.Thunk);
}
else
{
Debug.Assert(target.Constructor.Method.Signature.Length == 2);
}
encoder.EmitJMP(target.Constructor);
}
break;
case ReadyToRunHelperId.ResolveVirtualFunction:
{
MethodDesc targetMethod = (MethodDesc)Target;
if (targetMethod.OwningType.IsInterface)
{
encoder.EmitLEAQ(encoder.TargetRegister.Arg1, factory.InterfaceDispatchCell(targetMethod));
encoder.EmitJMP(factory.ExternSymbol("RhpResolveInterfaceMethod"));
}
else
{
if (relocsOnly)
break;
AddrMode loadFromThisPtr = new AddrMode(encoder.TargetRegister.Arg0, null, 0, 0, AddrModeSize.Int64);
encoder.EmitMOV(encoder.TargetRegister.Result, ref loadFromThisPtr);
int slot = VirtualMethodSlotHelper.GetVirtualMethodSlot(factory, targetMethod);
Debug.Assert(slot != -1);
AddrMode loadFromSlot = new AddrMode(encoder.TargetRegister.Result, null, EETypeNode.GetVTableOffset(factory.Target.PointerSize) + (slot * factory.Target.PointerSize), 0, AddrModeSize.Int64);
encoder.EmitMOV(encoder.TargetRegister.Result, ref loadFromSlot);
encoder.EmitRET();
}
}
break;
case ReadyToRunHelperId.GenericLookupFromThis:
{
int pointerSize = factory.Target.PointerSize;
var lookupInfo = (GenericLookupDescriptor)Target;
// Arg0 points to the EEType
// Locate the VTable slot that points to the dictionary
int vtableSlot = 0;
if (!relocsOnly)
vtableSlot = VirtualMethodSlotHelper.GetGenericDictionarySlot(factory, (TypeDesc)lookupInfo.CanonicalOwner);
int slotOffset = EETypeNode.GetVTableOffset(pointerSize) + (vtableSlot * pointerSize);
// Load the dictionary pointer from the VTable
AddrMode loadDictionary = new AddrMode(encoder.TargetRegister.Arg0, null, slotOffset, 0, AddrModeSize.Int64);
encoder.EmitMOV(encoder.TargetRegister.Arg0, ref loadDictionary);
// What's left now is the actual dictionary lookup
goto case ReadyToRunHelperId.GenericLookupFromDictionary;
}
case ReadyToRunHelperId.GenericLookupFromDictionary:
{
var lookupInfo = (GenericLookupDescriptor)Target;
// Find the generic dictionary slot
int dictionarySlot = 0;
if (!relocsOnly)
{
// The concrete slot won't be known until we're emitting data.
dictionarySlot = factory.GenericDictionaryLayout(lookupInfo.CanonicalOwner).GetSlotForEntry(lookupInfo.Signature);
}
// Load the generic dictionary cell
AddrMode loadEntry = new AddrMode(
encoder.TargetRegister.Arg0, null, dictionarySlot * factory.Target.PointerSize, 0, AddrModeSize.Int64);
encoder.EmitMOV(encoder.TargetRegister.Result, ref loadEntry);
encoder.EmitRET();
}
break;
default:
throw new NotImplementedException();
}
}
示例4: GetDictionaryLayout
protected override DictionaryLayoutNode GetDictionaryLayout(NodeFactory factory)
{
return factory.GenericDictionaryLayout(_owningMethod.GetCanonMethodTarget(CanonicalFormKind.Specific));
}
示例5: OnMarked
protected override void OnMarked(NodeFactory factory)
{
switch (_id)
{
case ReadyToRunHelperId.GenericLookupFromThis:
case ReadyToRunHelperId.GenericLookupFromDictionary:
{
// When the helper call gets marked, ensure the generic layout for the associated dictionaries
// includes the signature.
var lookupInfo = (GenericLookupDescriptor)_target;
factory.GenericDictionaryLayout(lookupInfo.CanonicalOwner).EnsureEntry(lookupInfo.Signature);
}
break;
}
}