示例#1
0
        public override Task <IDeployedPackage> DeploySinglePackageAsync(IBuiltPackage package, bool isTopLevel)
        {
            var functionDeployedPackage = LLVM.FunctionDeployedPackage.DeployFunction((LLVM.FunctionBuiltPackage)package, _executionTarget, _llvmExecutionContext);

            _executionTarget.OnExecutableCreated(functionDeployedPackage.Executable);
            return(Task.FromResult <IDeployedPackage>(functionDeployedPackage));
        }
        /// <inheritdoc />
        public override async Task <Tuple <CompileCacheEntry, CompileSignature> > BackEndCompileAsyncCore(
            SpecAndQName specAndQName,
            DfirRoot targetDfir,
            CompileCancellationToken cancellationToken,
            ProgressToken progressToken,
            CompileThreadState compileThreadState)
        {
            CompileSignature topSignature = new CompileSignature(
                targetDfir.Name,
                Enumerable.Empty <CompileSignatureParameter>(), // GenerateParameters(targetDfir),
                targetDfir.GetDeclaringType(),
                targetDfir.Reentrancy,
                true,
                true,
                ThreadAffinity.Standard,
                false,
                true,
                ExecutionPriority.Normal,
                CallingConvention.StdCall);
            BuildSpec htmlVIBuildSpec = specAndQName.BuildSpec;

            foreach (var dependency in targetDfir.Dependencies.OfType <CompileInvalidationDfirDependency>().ToList())
            {
                var compileSignature = await Compiler.GetCompileSignatureAsync(dependency.SpecAndQName, cancellationToken, progressToken, compileThreadState);

                if (compileSignature != null)
                {
                    targetDfir.AddDependency(
                        targetDfir,
                        new CompileSignatureDependency(dependency.SpecAndQName, compileSignature));
                }
            }

            IBuiltPackage builtPackage = null;

            if (!RebarFeatureToggles.IsLLVMCompilerEnabled)
            {
                Function compiledFunction = CompileFunctionForBytecodeInterpreter(targetDfir, cancellationToken);
                builtPackage = new FunctionBuiltPackage(specAndQName, Compiler.TargetName, compiledFunction);
            }
            else
            {
                Module compiledFunctionModule = CompileFunctionForLLVM(targetDfir, cancellationToken);
                builtPackage = new LLVM.FunctionBuiltPackage(specAndQName, Compiler.TargetName, compiledFunctionModule);
            }

            BuiltPackageToken token = Compiler.AddToBuiltPackagesCache(builtPackage);
            CompileCacheEntry entry = await Compiler.CreateStandardCompileCacheEntryFromDfirRootAsync(
                CompileState.Complete,
                targetDfir,
                new Dictionary <ExtendedQualifiedName, CompileSignature>(),
                token,
                cancellationToken,
                progressToken,
                compileThreadState,
                false);

            return(new Tuple <CompileCacheEntry, CompileSignature>(entry, topSignature));
        }
示例#3
0
        /// <inheritdoc />
        public override async Task <Tuple <CompileCacheEntry, CompileSignature> > CompileCoreAsync(
            CompileSpecification compileSpecification,
            DfirRoot targetDfir,
            CompileCancellationToken cancellationToken,
            ProgressToken progressToken,
            CompileThreadState compileThreadState)
        {
            CompileSignature topSignature = new CompileSignature(
                targetDfir.Name,
                Enumerable.Empty <CompileSignatureParameter>(), // GenerateParameters(targetDfir),
                targetDfir.GetDeclaringType(),
                targetDfir.Reentrancy,
                true,
                true,
                ThreadAffinity.Standard,
                false,
                true,
                ExecutionPriority.Normal,
                CallingConvention.StdCall);
            BuildSpec typeDiagramBuildSpec = compileSpecification.BuildSpec;

#if FALSE
            foreach (var dependency in targetDfir.Dependencies.OfType <CompileInvalidationDfirDependency>().ToList())
            {
                var compileSignature = await Compiler.GetCompileSignatureAsync(dependency.SpecAndQName, cancellationToken, progressToken, compileThreadState);

                if (compileSignature != null)
                {
                    targetDfir.AddDependency(
                        targetDfir,
                        new CompileSignatureDependency(dependency.SpecAndQName, compileSignature));
                }
            }
#endif

            IBuiltPackage builtPackage = null;
            // TODO: create TypeDiagramBuiltPackage
            builtPackage = new EmptyBuiltPackage(
                compileSpecification,
                Compiler.TargetName,
                Enumerable.Empty <CompileSpecification>(),
                CompileMetadata.Empty);

            BuiltPackageToken token = Compiler.AddToBuiltPackagesCache(builtPackage);
            CompileCacheEntry entry = await Compiler.CreateStandardCompileCacheEntryFromDfirRootAsync(
                CompileState.Complete,
                targetDfir,
                new Dictionary <CompilableDefinitionName, CompileSignature>(),
                token,
                cancellationToken,
                progressToken,
                compileThreadState,
                false);

            return(new Tuple <CompileCacheEntry, CompileSignature>(entry, topSignature));
        }
示例#4
0
        private void HandleDeploymentStarting(IBuiltPackage topLevelPackage)
        {
            var executionServices = new HostExecutionServices(_executionTarget.Host);

            if (_llvmExecutionContext != null)
            {
                _llvmExecutionContext.Dispose();
            }
            _llvmExecutionContext = new LLVM.ExecutionContext(executionServices);
        }
        private void HandleDeploymentStarting(IBuiltPackage topLevelPackage)
        {
            var executionServices = new HostExecutionServices(_executionTarget.Host);

            if (!RebarFeatureToggles.IsLLVMCompilerEnabled)
            {
                _bytecodeInterpreterExecutionContext = new BytecodeInterpreter.ExecutionContext(executionServices);
            }
            else
            {
                _llvmExecutionContext = new LLVM.ExecutionContext(executionServices);
            }
        }
        public override Task <IDeployedPackage> DeploySinglePackageAsync(IBuiltPackage package, bool isTopLevel)
        {
            IDeployedPackage deployedPackage = null;

            if (!RebarFeatureToggles.IsLLVMCompilerEnabled)
            {
                var functionDeployedPackage = BytecodeInterpreter.FunctionDeployedPackage.DeployFunction((BytecodeInterpreter.FunctionBuiltPackage)package, _executionTarget, _bytecodeInterpreterExecutionContext);
                _executionTarget.OnExecutableCreated(functionDeployedPackage.Executable);
                deployedPackage = functionDeployedPackage;
            }
            else
            {
                var functionDeployedPackage = LLVM.FunctionDeployedPackage.DeployFunction((LLVM.FunctionBuiltPackage)package, _executionTarget, _llvmExecutionContext);
                _executionTarget.OnExecutableCreated(functionDeployedPackage.Executable);
                deployedPackage = functionDeployedPackage;
            }
            return(Task.FromResult(deployedPackage));
        }
示例#7
0
 public override void Store(IBuiltPackage package, Stream stream)
 {
     throw new NotImplementedException();
 }
示例#8
0
 public override Task PrepareToDeploySinglePackageAsync(IBuiltPackage package, bool isTopLevel)
 {
     return(base.PrepareToDeploySinglePackageAsync(package, isTopLevel));
 }