예제 #1
0
        public override MocTransformManager GenerateMocTransformManager(
            CompileSpecification compileSpecification,
            DfirRoot sourceDfir,
            CompileCancellationToken cancellationToken)
        {
            var semanticAnalysisTransforms = new List <IDfirTransformBase>()
            {
                new CreateTypeDiagramNodeFacadesTransform(),
                new UnifyTypesAcrossWiresTransform(),
                new ValidateTypeUsagesTransform(),
                new ReflectVariablesToTerminalsTransform(),
                new StandardTypeReflectionTransform()
            };

            ReflectErrorsTransform.AddErrorReflection(semanticAnalysisTransforms, CompilePhase.SemanticAnalysis);

            var toTargetDfirTransforms = new List <IDfirTransformBase>()
            {
            };

            return(new StandardMocTransformManager(
                       compileSpecification,
                       sourceDfir,
                       semanticAnalysisTransforms,
                       toTargetDfirTransforms,
                       _host.GetSharedExportedValue <ScheduledActivityManager>()));
        }
예제 #2
0
        public CompileDialog(CompileSpecification specification, BuildProfileRegister buildProfileRegister)
        {
            InitializeComponent();

            _specification        = specification;
            _buildProfileRegister = buildProfileRegister;

            // Hide the panels
            AdvancedPanel.Size = Size.Empty;
            SimplePanel.Size   = Size.Empty;

            // Open the default mode
            SimplePanel.Dock = DockStyle.Fill;
            Size             = _simpleSize;

            Text = _specification.Name;

            PresetTable.Controls.Clear();
            PresetTable.RowStyles.Clear();

            PopulatePresets();
            PopulateTabs();
            PopulateProfiles();

            var translate = Sledge.Common.Container.Get <ITranslationStringProvider>();

            translate.Translate(this);
        }
예제 #3
0
 /// <inheritdoc />
 public Task <CompileInformation> GetCompileInformationAsync(
     CompileSpecification itemCompileSpecification,
     CompileCancellationToken cancellationToken,
     ProgressToken progressToken,
     CompileThreadState compileThreadState)
 {
     return(Compiler.CompileAsTopLevelAsync(itemCompileSpecification, cancellationToken, progressToken, compileThreadState));
 }
예제 #4
0
 /// <inheritdoc />
 protected override IBuiltPackage CreateExecutionBuiltPackage(
     CompileSpecification compileSpecification,
     string absoluteDirectoryForComponent,
     IEnumerable <FileBuilder> builders,
     ComponentBuildResult componentBuildResult,
     CompileMetadata compileMetadata)
 {
     throw new NotImplementedException();
 }
예제 #5
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));
        }
 /// <summary>
 /// Base constructor of <see cref="ApplicationComponentMocReflector"/>
 /// </summary>
 /// <param name="source">An interface allowing the reflector to talk to the source model</param>
 /// <param name="reflectionCancellationToken">A token to poll for whether to do reflection or not</param>
 /// <param name="scheduledActivityManager">The activity used to flip over into the UI thread as needed to do reflections</param>
 /// <param name="additionalErrorTexts">Supplies third-party message descriptions for this MoC</param>
 /// <param name="buildSpecSource">Source of the BuildSpec for which to reflect messages</param>
 /// <param name="compileSpecification">The <see cref="CompileSpecification"/> for which to reflect messages</param>
 internal ApplicationComponentMocReflector(
     IReflectableModel source,
     ReflectionCancellationToken reflectionCancellationToken,
     IScheduledActivityManager scheduledActivityManager,
     IMessageDescriptorTranslator additionalErrorTexts,
     Envoy buildSpecSource,
     CompileSpecification compileSpecification)
     : base(source, reflectionCancellationToken, scheduledActivityManager, additionalErrorTexts, buildSpecSource, compileSpecification)
 {
 }
예제 #7
0
 public FunctionMocReflector(
     IReflectableModel source,
     ReflectionCancellationToken reflectionCancellationToken,
     IScheduledActivityManager scheduledActivityManager,
     IMessageDescriptorTranslator additionalErrorTexts,
     Envoy buildSpecSource,
     CompileSpecification compileSpecification,
     DfirModelMap map)
     : base(source, reflectionCancellationToken, scheduledActivityManager, additionalErrorTexts, buildSpecSource, compileSpecification)
 {
     _map = map;
 }
예제 #8
0
 public FunctionBuiltPackage(
     CompileSpecification identity,
     QualifiedName targetIdentity,
     CompileSpecification[] dependencyIdentities,
     ContextFreeModule module,
     bool isYielding)
 {
     Version = CurrentVersion;
     RuntimeEntityIdentity = identity;
     TargetIdentity        = targetIdentity;
     DependencyIdentities  = dependencyIdentities;
     Module     = module;
     IsYielding = isYielding;
 }
예제 #9
0
 public override MocReflector CreateMocReflector(
     ICompilableModel source,
     ReflectionCancellationToken reflectionCancellationToken,
     Envoy buildSpecSource,
     CompileSpecification compileSpecification)
 {
     return(new ApplicationComponentMocReflector(
                source,
                reflectionCancellationToken,
                ScheduledActivityManager,
                AdditionalErrorTexts,
                buildSpecSource,
                compileSpecification));
 }
예제 #10
0
        public override MocTransformManager GenerateMocTransformManager(
            CompileSpecification compileSpecification,
            DfirRoot sourceDfir,
            CompileCancellationToken cancellationToken)
        {
            TerminalTypeUnificationResults unificationResults          = new TerminalTypeUnificationResults();
            LifetimeVariableAssociation    lifetimeVariableAssociation = new LifetimeVariableAssociation();
            List <IDfirTransformBase>      semanticAnalysisTransforms  = new List <IDfirTransformBase>()
            {
                new CreateNodeFacadesTransform(),
                new MergeVariablesAcrossWiresTransform(lifetimeVariableAssociation, unificationResults),
                new FinalizeAutoBorrowsTransform(),
                new MarkConsumedVariablesTransform(lifetimeVariableAssociation),
                new ValidateVariableUsagesTransform(unificationResults),
                new ReflectVariablesToTerminalsTransform(),
            };

            if (RebarFeatureToggles.IsRebarTargetEnabled)
            {
                semanticAnalysisTransforms.Add(new RebarSupportedTargetTransform(SemanticAnalysisTargetInfo));
            }
            semanticAnalysisTransforms.Add(new StandardTypeReflectionTransform());
            ReflectErrorsTransform.AddErrorReflection(semanticAnalysisTransforms, CompilePhase.SemanticAnalysis);
            if (!RebarFeatureToggles.IsRebarTargetEnabled)
            {
                semanticAnalysisTransforms.Add(new EmptyTargetDfirTransform());
            }

            var nodeInsertionTypeUnificationResultFactory    = new NodeInsertionTypeUnificationResultFactory();
            List <IDfirTransformBase> toTargetDfirTransforms = new List <IDfirTransformBase>()
            {
                new AutoBorrowTransform(lifetimeVariableAssociation),
                new InsertTerminateLifetimeTransform(lifetimeVariableAssociation, nodeInsertionTypeUnificationResultFactory),
                new InsertDropTransform(lifetimeVariableAssociation, nodeInsertionTypeUnificationResultFactory),
            };

            return(new StandardMocTransformManager(
                       compileSpecification,
                       sourceDfir,
                       semanticAnalysisTransforms,
                       toTargetDfirTransforms,
                       _host.GetSharedExportedValue <ScheduledActivityManager>()));
        }
        /// <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>(),
                targetDfir.GetDeclaringType(),
                targetDfir.Reentrancy,
                true,
                true,
                ThreadAffinity.Standard,
                false,
                true,
                ExecutionPriority.Normal,
                CallingConvention.StdCall);

            var 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));
        }
예제 #12
0
 /// <inheritdoc />
 public Task <DebugSource> GetDebugSourceAsync(CompileSpecification itemCompileSpecification, CompileCancellationToken cancellationToken)
 {
     return(Task.FromResult <DebugSource>(null));
 }
예제 #13
0
        /// <inheritdoc />
        public override async Task <Tuple <CompileCacheEntry, CompileSignature> > CompileCoreAsync(
            CompileSpecification compileSpecification,
            DfirRoot targetDfir,
            CompileCancellationToken cancellationToken,
            ProgressToken progressToken,
            CompileThreadState compileThreadState)
        {
            var compileSignatureParameters = new List <CompileSignatureParameter>();

            foreach (DataItem dataItem in targetDfir.DataItems.OrderBy(dataItem => dataItem.ConnectorPaneIndex))
            {
                var compileSignatureParameter = new CompileSignatureParameter(
                    dataItem.Name,
                    dataItem.Name,
                    dataItem.DataType,
                    dataItem.ConnectorPaneInputPassingRule,
                    dataItem.ConnectorPaneOutputPassingRule,
                    dataItem.ConnectorPaneIndex);
                compileSignatureParameters.Add(compileSignatureParameter);
            }

            var compileSignatures    = new Dictionary <CompilableDefinitionName, CompileSignature>();
            var dependencyIdentities = new HashSet <CompileSpecification>();

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

                if (compileSignature != null)
                {
                    targetDfir.AddDependency(
                        targetDfir,
                        new CompileSignatureDependency(dependency.DependeeName, compileSignature));
                    compileSignatures[ConvertToCompilableDefinitionNameDuringMigration(dependency.DependeeName)] = compileSignature;
                }
            }

            var calleesIsYielding = new Dictionary <CompilableDefinitionName, bool>();
            var calleesMayPanic   = new Dictionary <CompilableDefinitionName, bool>();

            foreach (var methodCallNode in targetDfir.GetAllNodesIncludingSelf().OfType <MethodCallNode>())
            {
                CompileSignature calleeSignature = compileSignatures[methodCallNode.TargetName];
                var  functionCompileSignature    = calleeSignature as FunctionCompileSignature;
                bool mayPanic = functionCompileSignature?.MayPanic ?? false;
                calleesIsYielding[methodCallNode.TargetName] = calleeSignature.IsYielding;
                calleesMayPanic[methodCallNode.TargetName]   = mayPanic;
            }

            LLVM.FunctionCompileResult functionCompileResult = CompileFunctionForLLVM(
                targetDfir,
                cancellationToken,
                calleesIsYielding,
                calleesMayPanic);
            var builtPackage = new LLVM.FunctionBuiltPackage(
                compileSpecification,
                Compiler.TargetName,
                dependencyIdentities.ToArray(),
                functionCompileResult.Module,
                functionCompileResult.IsYielding);

            BuiltPackageToken token = Compiler.AddToBuiltPackagesCache(builtPackage);
            CompileCacheEntry entry = await Compiler.CreateStandardCompileCacheEntryFromDfirRootAsync(
                CompileState.Complete,
                targetDfir,
                compileSignatures,
                token,
                cancellationToken,
                progressToken,
                compileThreadState,
                false);

            var topSignature = new FunctionCompileSignature(
                functionName: targetDfir.Name,
                compileSignatureParameters: compileSignatureParameters,
                isYielding: functionCompileResult.IsYielding,
                mayPanic: functionCompileResult.MayPanic);

            return(new Tuple <CompileCacheEntry, CompileSignature>(entry, topSignature));
        }