From 64b47063f8ca8750dbcbadc6b0a1696214862288 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 23 Aug 2023 15:53:48 -0400 Subject: [PATCH 1/9] remove coreclr-ncalc references --- src/Libraries/CoreNodeModels/CoreNodeModels.csproj | 3 --- src/Libraries/CoreNodes/CoreNodes.csproj | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Libraries/CoreNodeModels/CoreNodeModels.csproj b/src/Libraries/CoreNodeModels/CoreNodeModels.csproj index 65517fc2627..d8ec29f9e71 100644 --- a/src/Libraries/CoreNodeModels/CoreNodeModels.csproj +++ b/src/Libraries/CoreNodeModels/CoreNodeModels.csproj @@ -28,9 +28,6 @@ - - - diff --git a/src/Libraries/CoreNodes/CoreNodes.csproj b/src/Libraries/CoreNodes/CoreNodes.csproj index 99ed8ac50bd..405dd745469 100644 --- a/src/Libraries/CoreNodes/CoreNodes.csproj +++ b/src/Libraries/CoreNodes/CoreNodes.csproj @@ -22,9 +22,6 @@ - - - From 816dccf115657891e6a6d4bf8671f1cdb6d8a50d Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 6 Dec 2023 09:27:48 -0500 Subject: [PATCH 2/9] add failing test for dropdown node --- src/Libraries/CoreNodeModels/DropDown.cs | 2 +- .../DynamoCoreWpfTests/NodeExecutionUITest.cs | 44 ++++++++++++++ test/TestUINodes/TestUINodes.cs | 60 ++++++++++++++++++- 3 files changed, 104 insertions(+), 2 deletions(-) diff --git a/src/Libraries/CoreNodeModels/DropDown.cs b/src/Libraries/CoreNodeModels/DropDown.cs index 71ec3ce9758..d44e47d49c5 100644 --- a/src/Libraries/CoreNodeModels/DropDown.cs +++ b/src/Libraries/CoreNodeModels/DropDown.cs @@ -83,7 +83,7 @@ public override NodeInputData InputData } } - private int selectedIndex = -1; + private int selectedIndex = 0; /// /// Index of current selection diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index 73bb94e40ca..62c249e26b4 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -328,5 +328,49 @@ public void TestSelectionNodeUpdate2() AssertPreviewValue(tsn.GUID.ToString(), 0); } + + [Test] + public void TestDropdownNodeUpdate() + { + var model = GetModel(); + var tdd = new TestDropdown + { + SelectedIndex = 0 + }; + + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); + + AssertPreviewValue(tdd.GUID.ToString(), "one"); + + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "two"); + + } + + [Test] + public void TestDropdownNodeUpdate1() + { + var model = GetModel(); + var tdd = new TestDropdown(); + + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); + + AssertPreviewValue(tdd.GUID.ToString(), "one"); + + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "two"); + + tdd.SelectedIndex = 2; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "three"); + + } } } diff --git a/test/TestUINodes/TestUINodes.cs b/test/TestUINodes/TestUINodes.cs index cd3e3581545..ea54add8e32 100644 --- a/test/TestUINodes/TestUINodes.cs +++ b/test/TestUINodes/TestUINodes.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -140,4 +140,62 @@ protected override int GetModelObjectFromIdentifer(string id) return id.Length; } } + + [NodeName("Test Dropdown Node")] + [NodeCategory("TestUINodes")] + [NodeDescription("test dropdown node")] + [OutPortTypes("string")] + [IsDesignScriptCompatible] + [IsVisibleInDynamoLibrary(false)] + public class TestDropdown : DSDropDownBase + { + public TestDropdown() : base("TestDropdown") { } + + + public override IEnumerable BuildOutputAst(List inputAstNodes) + { + AssociativeNode node; + if (SelectedIndex < 0 || SelectedIndex >= Items.Count) + { + node = AstFactory.BuildNullNode(); + return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) }; + } + else + { + //var args = new List + //{ + // AstFactory.BuildStringNode((string)Items[SelectedIndex].Item) + //}; + + //var func = new Func(DynamoUnits.Symbol.ByTypeID); + //node = AstFactory.BuildFunctionCall(func, args); + + // get the selected items name + var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Name); + + // assign the selected name to an actual enumeration value + var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), stringNode); + + // return the enumeration value + return new List { assign }; + } + } + + protected override SelectionState PopulateItemsCore(string currentSelection) + { + Items.Clear(); + + var symbols = new[] { "one", "two", "three" }; + + + foreach (var symbol in symbols) + { + + Items.Add(new DynamoDropDownItem(symbol, symbol)); + } + + return SelectionState.Restore; + } + + } } From fa51c824d6a4c13f883cc836e614765f4076944d Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 6 Dec 2023 11:01:59 -0500 Subject: [PATCH 3/9] cleanup --- src/Libraries/CoreNodeModels/DropDown.cs | 2 +- test/DynamoCoreWpfTests/NodeExecutionUITest.cs | 2 +- test/TestUINodes/TestUINodes.cs | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Libraries/CoreNodeModels/DropDown.cs b/src/Libraries/CoreNodeModels/DropDown.cs index d44e47d49c5..71ec3ce9758 100644 --- a/src/Libraries/CoreNodeModels/DropDown.cs +++ b/src/Libraries/CoreNodeModels/DropDown.cs @@ -83,7 +83,7 @@ public override NodeInputData InputData } } - private int selectedIndex = 0; + private int selectedIndex = -1; /// /// Index of current selection diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index 62c249e26b4..e89e5e125d6 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -350,7 +350,7 @@ public void TestDropdownNodeUpdate() } - [Test] + [Test, Category("Failure")] public void TestDropdownNodeUpdate1() { var model = GetModel(); diff --git a/test/TestUINodes/TestUINodes.cs b/test/TestUINodes/TestUINodes.cs index ea54add8e32..004c2ff971a 100644 --- a/test/TestUINodes/TestUINodes.cs +++ b/test/TestUINodes/TestUINodes.cs @@ -162,14 +162,6 @@ public override IEnumerable BuildOutputAst(List - //{ - // AstFactory.BuildStringNode((string)Items[SelectedIndex].Item) - //}; - - //var func = new Func(DynamoUnits.Symbol.ByTypeID); - //node = AstFactory.BuildFunctionCall(func, args); - // get the selected items name var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Name); From c48f42aa4a88f72f877c47cfe3efcbe0e5013b47 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 6 Dec 2023 20:58:49 -0500 Subject: [PATCH 4/9] update tests --- test/DynamoCoreWpfTests/NodeExecutionUITest.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index e89e5e125d6..55c3391837c 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -348,6 +348,11 @@ public void TestDropdownNodeUpdate() AssertPreviewValue(tdd.GUID.ToString(), "two"); + tdd.SelectedIndex = 2; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "three"); + } [Test, Category("Failure")] @@ -359,18 +364,13 @@ public void TestDropdownNodeUpdate1() var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); model.ExecuteCommand(command); - AssertPreviewValue(tdd.GUID.ToString(), "one"); + AssertPreviewValue(tdd.GUID.ToString(), null); tdd.SelectedIndex = 1; tdd.OnNodeModified(); + // fails here! AssertPreviewValue(tdd.GUID.ToString(), "two"); - - tdd.SelectedIndex = 2; - tdd.OnNodeModified(); - - AssertPreviewValue(tdd.GUID.ToString(), "three"); - } } } From 76b04a4589e0217b0fad7f53c13c81d038e949f3 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 14:01:14 -0500 Subject: [PATCH 5/9] attempt initial fix --- src/Engine/ProtoAssociative/CodeGen_SSA.cs | 52 +--------------- src/Libraries/CoreNodeModels/Enum.cs | 51 ++++++++++++++- .../DynamoCoreWpfTests/NodeExecutionUITest.cs | 62 +++++++++---------- 3 files changed, 83 insertions(+), 82 deletions(-) diff --git a/src/Engine/ProtoAssociative/CodeGen_SSA.cs b/src/Engine/ProtoAssociative/CodeGen_SSA.cs index 745092a71ad..f768cfe7171 100644 --- a/src/Engine/ProtoAssociative/CodeGen_SSA.cs +++ b/src/Engine/ProtoAssociative/CodeGen_SSA.cs @@ -1,4 +1,4 @@ -using ProtoCore.AST.AssociativeAST; +using ProtoCore.AST.AssociativeAST; using ProtoCore.DSASM; using ProtoCore.Utils; using System.Collections.Generic; @@ -275,7 +275,7 @@ private List BuildSSA(List astList, ProtoCore. BinaryExpressionNode bnode = (node as BinaryExpressionNode); int generatedUID = ProtoCore.DSASM.Constants.kInvalidIndex; - if (context.applySSATransform && core.Options.GenerateSSA) + if (context.applySSATransform && core.Options.GenerateSSA && !bnode.IsInputExpression) { int ssaID = ProtoCore.DSASM.Constants.kInvalidIndex; string name = ProtoCore.Utils.CoreUtils.GenerateIdentListNameString(bnode.LeftNode); @@ -382,53 +382,6 @@ private List BuildSSA(List astList, ProtoCore. return astList; } - private void DfsSSAIeentList(AssociativeNode node, ref Stack ssaStack, ref List astlist) - { - if (node is IdentifierListNode) - { - IdentifierListNode listNode = node as IdentifierListNode; - - bool isSingleDot = !(listNode.LeftNode is IdentifierListNode) && !(listNode.RightNode is IdentifierListNode); - if (isSingleDot) - { - BinaryExpressionNode bnode = BuildSSAIdentListAssignmentNode(listNode); - astlist.Add(bnode); - ssaStack.Push(bnode); - } - else - { - DfsSSAIeentList(listNode.LeftNode, ref ssaStack, ref astlist); - - IdentifierListNode newListNode = node as IdentifierListNode; - newListNode.Optr = Operator.dot; - - AssociativeNode leftnode = ssaStack.Pop(); - Validity.Assert(leftnode is BinaryExpressionNode); - - newListNode.LeftNode = (leftnode as BinaryExpressionNode).LeftNode; - newListNode.RightNode = listNode.RightNode; - - BinaryExpressionNode bnode = BuildSSAIdentListAssignmentNode(newListNode); - astlist.Add(bnode); - ssaStack.Push(bnode); - - } - } - else if (node is FunctionCallNode) - { - FunctionCallNode fcNode = node as FunctionCallNode; - for (int idx = 0; idx < fcNode.FormalArguments.Count; idx++) - { - AssociativeNode arg = fcNode.FormalArguments[idx]; - - Stack ssaStack1 = new Stack(); - DFSEmitSSA_AST(arg, ssaStack1, ref astlist); - AssociativeNode argNode = ssaStack.Pop(); - fcNode.FormalArguments[idx] = argNode is BinaryExpressionNode ? (argNode as BinaryExpressionNode).LeftNode : argNode; - } - } - } - private void DFSEmitSSA_AST(AssociativeNode node, Stack ssaStack, ref List astlist) { Validity.Assert(null != astlist && null != ssaStack); @@ -488,7 +441,6 @@ private void DFSEmitSSA_AST(AssociativeNode node, Stack ssaStac var bnode = AstFactory.BuildAssignment(leftNode, rightNode); bnode.isSSAAssignment = isSSAAssignment; - bnode.IsInputExpression = astBNode.IsInputExpression; astlist.Add(bnode); ssaStack.Push(bnode); diff --git a/src/Libraries/CoreNodeModels/Enum.cs b/src/Libraries/CoreNodeModels/Enum.cs index a6c1639c352..e74df7a5fa4 100644 --- a/src/Libraries/CoreNodeModels/Enum.cs +++ b/src/Libraries/CoreNodeModels/Enum.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -36,6 +36,55 @@ public override IEnumerable BuildOutputAst(List BuildOutputAst(List inputAstNodes) + { + AssociativeNode node; + if (SelectedIndex < 0 || SelectedIndex >= Items.Count) + { + node = AstFactory.BuildNullNode(); + return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) }; + } + else + { + // get the selected items name + var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Name); + + // assign the selected name to an actual enumeration value + var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), stringNode); + + // return the enumeration value + return new List { assign }; + } + } + + protected override SelectionState PopulateItemsCore(string currentSelection) + { + Items.Clear(); + + var symbols = new[] { "one", "two", "three" }; + + + foreach (var symbol in symbols) + { + + Items.Add(new DynamoDropDownItem(symbol, symbol)); + } + + return SelectionState.Restore; + } + + } + public abstract class EnumBase : DSDropDownBase { protected EnumBase() : base(typeof(T).ToString()) { } diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index 55c3391837c..935eccd7fda 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -329,48 +329,48 @@ public void TestSelectionNodeUpdate2() } - [Test] - public void TestDropdownNodeUpdate() - { - var model = GetModel(); - var tdd = new TestDropdown - { - SelectedIndex = 0 - }; + // [Test] + // public void TestDropdownNodeUpdate() + // { + // var model = GetModel(); + // var tdd = new TestDropdown + // { + // SelectedIndex = 0 + // }; - var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - model.ExecuteCommand(command); + // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + // model.ExecuteCommand(command); - AssertPreviewValue(tdd.GUID.ToString(), "one"); + // AssertPreviewValue(tdd.GUID.ToString(), "one"); - tdd.SelectedIndex = 1; - tdd.OnNodeModified(); + // tdd.SelectedIndex = 1; + // tdd.OnNodeModified(); - AssertPreviewValue(tdd.GUID.ToString(), "two"); + // AssertPreviewValue(tdd.GUID.ToString(), "two"); - tdd.SelectedIndex = 2; - tdd.OnNodeModified(); + // tdd.SelectedIndex = 2; + // tdd.OnNodeModified(); - AssertPreviewValue(tdd.GUID.ToString(), "three"); + // AssertPreviewValue(tdd.GUID.ToString(), "three"); - } + // } - [Test, Category("Failure")] - public void TestDropdownNodeUpdate1() - { - var model = GetModel(); - var tdd = new TestDropdown(); + // [Test, Category("Failure")] + // public void TestDropdownNodeUpdate1() + // { + // var model = GetModel(); + // var tdd = new TestDropdown(); - var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - model.ExecuteCommand(command); + // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + // model.ExecuteCommand(command); - AssertPreviewValue(tdd.GUID.ToString(), null); + // AssertPreviewValue(tdd.GUID.ToString(), null); - tdd.SelectedIndex = 1; - tdd.OnNodeModified(); + // tdd.SelectedIndex = 1; + // tdd.OnNodeModified(); - // fails here! - AssertPreviewValue(tdd.GUID.ToString(), "two"); - } + // // fails here! + // AssertPreviewValue(tdd.GUID.ToString(), "two"); + // } } } From 33c071bc9e31e211808a14c066217294c1008f30 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 14:04:14 -0500 Subject: [PATCH 6/9] cleanup --- src/Libraries/CoreNodeModels/Enum.cs | 49 --------------- .../DynamoCoreWpfTests/NodeExecutionUITest.cs | 62 +++++++++---------- 2 files changed, 31 insertions(+), 80 deletions(-) diff --git a/src/Libraries/CoreNodeModels/Enum.cs b/src/Libraries/CoreNodeModels/Enum.cs index e74df7a5fa4..a2c9860da3c 100644 --- a/src/Libraries/CoreNodeModels/Enum.cs +++ b/src/Libraries/CoreNodeModels/Enum.cs @@ -36,55 +36,6 @@ public override IEnumerable BuildOutputAst(List BuildOutputAst(List inputAstNodes) - { - AssociativeNode node; - if (SelectedIndex < 0 || SelectedIndex >= Items.Count) - { - node = AstFactory.BuildNullNode(); - return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) }; - } - else - { - // get the selected items name - var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Name); - - // assign the selected name to an actual enumeration value - var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), stringNode); - - // return the enumeration value - return new List { assign }; - } - } - - protected override SelectionState PopulateItemsCore(string currentSelection) - { - Items.Clear(); - - var symbols = new[] { "one", "two", "three" }; - - - foreach (var symbol in symbols) - { - - Items.Add(new DynamoDropDownItem(symbol, symbol)); - } - - return SelectionState.Restore; - } - - } - public abstract class EnumBase : DSDropDownBase { protected EnumBase() : base(typeof(T).ToString()) { } diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index 935eccd7fda..a8660254a70 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -329,48 +329,48 @@ public void TestSelectionNodeUpdate2() } - // [Test] - // public void TestDropdownNodeUpdate() - // { - // var model = GetModel(); - // var tdd = new TestDropdown - // { - // SelectedIndex = 0 - // }; + [Test] + public void TestDropdownNodeUpdate() + { + var model = GetModel(); + var tdd = new TestDropdown + { + SelectedIndex = 0 + }; - // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - // model.ExecuteCommand(command); + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); - // AssertPreviewValue(tdd.GUID.ToString(), "one"); + AssertPreviewValue(tdd.GUID.ToString(), "one"); - // tdd.SelectedIndex = 1; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); - // AssertPreviewValue(tdd.GUID.ToString(), "two"); + AssertPreviewValue(tdd.GUID.ToString(), "two"); - // tdd.SelectedIndex = 2; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 2; + tdd.OnNodeModified(); - // AssertPreviewValue(tdd.GUID.ToString(), "three"); + AssertPreviewValue(tdd.GUID.ToString(), "three"); - // } + } - // [Test, Category("Failure")] - // public void TestDropdownNodeUpdate1() - // { - // var model = GetModel(); - // var tdd = new TestDropdown(); + [Test] + public void TestDropdownNodeUpdate1() + { + var model = GetModel(); + var tdd = new TestDropdown(); - // var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); - // model.ExecuteCommand(command); + var command = new DynamoModel.CreateNodeCommand(tdd, 0, 0, true, false); + model.ExecuteCommand(command); - // AssertPreviewValue(tdd.GUID.ToString(), null); + AssertPreviewValue(tdd.GUID.ToString(), null); - // tdd.SelectedIndex = 1; - // tdd.OnNodeModified(); + tdd.SelectedIndex = 1; + tdd.OnNodeModified(); - // // fails here! - // AssertPreviewValue(tdd.GUID.ToString(), "two"); - // } + // fails here! + AssertPreviewValue(tdd.GUID.ToString(), "two"); + } } } From 600fea5f9a23e1cfd99536d327bbc29f3f222479 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 14:23:42 -0500 Subject: [PATCH 7/9] update test --- test/DynamoCoreWpfTests/NodeExecutionUITest.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs index a8660254a70..8662c69d72e 100644 --- a/test/DynamoCoreWpfTests/NodeExecutionUITest.cs +++ b/test/DynamoCoreWpfTests/NodeExecutionUITest.cs @@ -366,11 +366,20 @@ public void TestDropdownNodeUpdate1() AssertPreviewValue(tdd.GUID.ToString(), null); + tdd.SelectedIndex = 0; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "one"); + tdd.SelectedIndex = 1; tdd.OnNodeModified(); - // fails here! AssertPreviewValue(tdd.GUID.ToString(), "two"); + + tdd.SelectedIndex = 2; + tdd.OnNodeModified(); + + AssertPreviewValue(tdd.GUID.ToString(), "three"); } } } From d6882943a10a407298b59c61fda3eda5f78b278c Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 16:43:23 -0500 Subject: [PATCH 8/9] review comments --- src/Engine/ProtoAssociative/CodeGen_SSA.cs | 2 ++ src/Engine/ProtoCore/DSASM/InstructionSet.cs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Engine/ProtoAssociative/CodeGen_SSA.cs b/src/Engine/ProtoAssociative/CodeGen_SSA.cs index f768cfe7171..9629d77b6b4 100644 --- a/src/Engine/ProtoAssociative/CodeGen_SSA.cs +++ b/src/Engine/ProtoAssociative/CodeGen_SSA.cs @@ -441,6 +441,8 @@ private void DFSEmitSSA_AST(AssociativeNode node, Stack ssaStac var bnode = AstFactory.BuildAssignment(leftNode, rightNode); bnode.isSSAAssignment = isSSAAssignment; + // TODO: SSA is not called for ASTs that are input expressions. Revisit this if there are any issues. + // bnode.IsInputExpression = astBNode.IsInputExpression; astlist.Add(bnode); ssaStack.Push(bnode); diff --git a/src/Engine/ProtoCore/DSASM/InstructionSet.cs b/src/Engine/ProtoCore/DSASM/InstructionSet.cs index 259f07197a2..801c4d50351 100644 --- a/src/Engine/ProtoCore/DSASM/InstructionSet.cs +++ b/src/Engine/ProtoCore/DSASM/InstructionSet.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using ProtoCore.Exceptions; @@ -10,6 +10,7 @@ namespace ProtoCore.DSASM public enum Registers { RX, + // Register used to temporarily store primitive values for graph update cycles. LX, } From ba8f011189283dc591732b77fc3608fb996cc699 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Thu, 7 Dec 2023 21:48:48 -0500 Subject: [PATCH 9/9] add code comments --- src/Engine/ProtoAssociative/CodeGen_SSA.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Engine/ProtoAssociative/CodeGen_SSA.cs b/src/Engine/ProtoAssociative/CodeGen_SSA.cs index 9629d77b6b4..2958837dfc1 100644 --- a/src/Engine/ProtoAssociative/CodeGen_SSA.cs +++ b/src/Engine/ProtoAssociative/CodeGen_SSA.cs @@ -275,6 +275,10 @@ private List BuildSSA(List astList, ProtoCore. BinaryExpressionNode bnode = (node as BinaryExpressionNode); int generatedUID = ProtoCore.DSASM.Constants.kInvalidIndex; + // Skip SSA for input ASTs that are first assigned null such as this: + // a = null; (update "a") => a = ; + // SSA would break up the null AST into two assignments, which then breaks update: + // a = null; (SSA) => temp = null; a = temp; if (context.applySSATransform && core.Options.GenerateSSA && !bnode.IsInputExpression) { int ssaID = ProtoCore.DSASM.Constants.kInvalidIndex;