private MethodDefinition MakeExecuteMethod_Entities(LambdaParameterValueInformations providerInformations) { var executeMethod = CecilHelpers.AddMethodImplementingInterfaceMethod(TypeDefinition.Module, TypeDefinition, typeof(IJobChunk).GetMethod(nameof(IJobChunk.Execute))); providerInformations.EmitInvocationToPrepareToRunOnEntitiesInIntoJobChunkExecute(executeMethod); var ilProcessor = executeMethod.Body.GetILProcessor(); var iterateOnEntitiesMethod = CreateIterateEntitiesMethod(providerInformations); ilProcessor.Emit(OpCodes.Ldarg_0); ilProcessor.Emit(OpCodes.Ldarga, 1); ilProcessor.Emit(OpCodes.Ldarg_0); ilProcessor.Emit(OpCodes.Ldfld, providerInformations._runtimesField); ilProcessor.Emit(OpCodes.Call, iterateOnEntitiesMethod); EmitCallToDeallocateOnCompletion(ilProcessor); ilProcessor.Emit(OpCodes.Ret); return(executeMethod); }
private MethodDefinition MakeExecuteMethod_Job() { var executeMethod = CecilHelpers.AddMethodImplementingInterfaceMethod(TypeDefinition.Module, TypeDefinition, typeof(IJob).GetMethod(nameof(IJob.Execute))); var executeIL = executeMethod.Body.GetILProcessor(); executeIL.Emit(OpCodes.Ldarg_0); executeIL.Emit(OpCodes.Call, ClonedLambdaBody); EmitCallToDeallocateOnCompletion(executeIL); executeIL.Emit(OpCodes.Ret); return(executeMethod); }
private MethodDefinition MakeExecuteMethod_Chunk(LambdaParameterValueInformations lambdaParameterValueInformations) { var executeMethod = CecilHelpers.AddMethodImplementingInterfaceMethod(TypeDefinition.Module, TypeDefinition, typeof(IJobChunk).GetMethod(nameof(IJobChunk.Execute))); lambdaParameterValueInformations.EmitInvocationToPrepareToRunOnEntitiesInIntoJobChunkExecute(executeMethod); var executeIL = executeMethod.Body.GetILProcessor(); executeIL.Emit(OpCodes.Ldarg_0); executeIL.Emit(OpCodes.Ldarg_1); executeIL.Emit(OpCodes.Ldarg_2); executeIL.Emit(OpCodes.Ldarg_3); executeIL.Emit(OpCodes.Call, ClonedLambdaBody); EmitCallToDeallocateOnCompletion(executeIL); executeIL.Emit(OpCodes.Ret); return(executeMethod); }