protected EventSourceImplementerBase(ModuleDefinition module, EventSourceTemplate template) { this.module = module; this.template = template; typeDefs = template.TypeDefs; ensureOpcodes = EnsureNestedBuilder("Opcodes"); ensureTasks = EnsureNestedBuilder("Tasks"); #if ENABLE_UNSAFE unsafeWriteEventBuilder = new UnsafeWriteEventBuilder(module, typeDefs); #endif }
private CustomAttribute CreateEventSourceAttribute(IEventSourceTypeDefs typeDefs, string name, string guid) { var ca = module.NewAttr(typeDefs.EventSourceAttribute); if (!String.IsNullOrEmpty(name)) ca.SetPropertyValue("Name", module.TypeSystem.String, name); if (!String.IsNullOrEmpty(guid)) ca.SetPropertyValue("Guid", module.TypeSystem.String, guid); return ca; }
public EventSourceTemplate(TypeDefinition template, IEventSourceTypeDefs typeDefs) { this.typeDefs = typeDefs; Type = template; TypeDefs = typeDefs; Keywords = GetNamedNestedType(template, "Keywords"); Tasks = GetNamedNestedType(template, "Tasks"); Opcodes = GetNamedNestedType(template, "Opcodes"); traces = new Lazy <IReadOnlyList <TraceMethod> >(() => GetTraceMethods().ToArray()); guards = new Lazy <IReadOnlyList <GuardMethod> >(() => GetGuardMethods().ToArray()); }
private CustomAttribute CreateEventSourceAttribute(IEventSourceTypeDefs typeDefs, string name, string guid) { var source = Module.NewAttr(typeDefs.EventSourceAttribute); if (!string.IsNullOrEmpty(name)) { source.SetPropertyValue("Name", Module.TypeSystem.String, name); } if (!string.IsNullOrEmpty(guid)) { source.SetPropertyValue("Guid", Module.TypeSystem.String, guid); } return(source); }
public UnsafeWriteEventBuilder(ModuleDefinition module, IEventSourceTypeDefs typeDefs) { this.module = module; this.typeDefs = typeDefs; var ts = module.TypeSystem; emitters = new Dictionary <string, Func <BodyBuilder, VariableDefinition, ParameterDefinition, IEnumerable <Instruction> > >() { [ts.String.FullName] = StoreStringInEventData, [ts.Int32.FullName] = StoreInt32InEventData, [ts.Boolean.FullName] = StoreBoolInEventData, }; supportedTypes = new HashSet <string>(emitters.Keys); }
public StaticTemplate(TypeDefinition type, IEventSourceTypeDefs typeDefs) : base(type, typeDefs) { }