Пример #1
0
        private static void ScheduleEagerCompilation()
        {
            lock (EagerCompilationLockObject)
            {
                if (EagerCompilationTokenSource.IsCancellationRequested)
                {
                    return;
                }

                if (_cachedCompileTargets == null)
                {
                    throw new InvalidOperationException();
                }

                if (DebuggingLevel > 2)
                {
                    UnityEngine.Debug.Log($"Burst - Starting scheduling eager-compilation");
                }

                var methodsToCompile = new List <EagerCompilationRequest>();
                foreach (var compileTarget in _cachedCompileTargets)
                {
                    var member = compileTarget.IsStaticMethod
                        ? (MemberInfo)compileTarget.Method
                        : compileTarget.JobType;

                    if (compileTarget.Options.TryGetOptions(member, true, out var optionsString, isForEagerCompilation: true))
                    {
                        var encodedMethod = BurstCompilerService.GetMethodSignature(compileTarget.Method);
                        methodsToCompile.Add(new EagerCompilationRequest(encodedMethod, optionsString));
                    }
                }

                BurstCompiler.EagerCompileMethods(methodsToCompile);

                if (DebuggingLevel > 2)
                {
                    UnityEngine.Debug.Log($"Burst - Finished scheduling eager-compilation of {methodsToCompile.Count} methods");
                }
            }
        }