Skip to content

Commit 8b03ff9

Browse files
Revert "[DNM] Optimize live execution of modified graphs (#9485)"
This reverts commit dac8353.
1 parent dac8353 commit 8b03ff9

File tree

13 files changed

+60
-284
lines changed

13 files changed

+60
-284
lines changed

src/DynamoCore/Engine/EngineController.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -428,23 +428,6 @@ private bool VerifyGraphSyncData(IEnumerable<NodeModel> nodes)
428428
}
429429
}
430430

431-
var subtrees = new List<Subtree>();
432-
subtrees.AddRange(graphSyncdata.AddedSubtrees);
433-
subtrees.AddRange(graphSyncdata.ModifiedSubtrees);
434-
foreach (var node in nodes)
435-
{
436-
if (node.IsInputNode)
437-
{
438-
for (int i = 0; i < subtrees.Count; i++)
439-
{
440-
if (subtrees[i].GUID == node.GUID)
441-
{
442-
subtrees[i].IsInput = true;
443-
}
444-
}
445-
}
446-
}
447-
448431
if (graphSyncdata.AddedSubtrees.Any() || graphSyncdata.ModifiedSubtrees.Any() || graphSyncdata.DeletedSubtrees.Any())
449432
{
450433
lock (graphSyncDataQueue)

src/Engine/ProtoAssociative/CodeGen.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5420,18 +5420,6 @@ private void EmitBinaryExpressionNode(AssociativeNode node, ref ProtoCore.Type i
54205420
EmitCast(castType.UID, castType.rank);
54215421
}
54225422

5423-
if (bnode.IsInputExpression)
5424-
{
5425-
StackValue regLX = StackValue.BuildRegister(Registers.LX);
5426-
EmitInstrConsole(ProtoCore.DSASM.kw.pop, ProtoCore.DSASM.kw.regLX);
5427-
EmitPop(regLX, globalClassIndex);
5428-
5429-
graphNode.updateBlock.updateRegisterStartPC = pc;
5430-
5431-
EmitInstrConsole(ProtoCore.DSASM.kw.push, ProtoCore.DSASM.kw.regLX);
5432-
EmitPush(regLX);
5433-
}
5434-
54355423
if (core.Options.RunMode != ProtoCore.DSASM.InterpreterMode.Expression)
54365424
{
54375425
if (dimensions == 0)

src/Engine/ProtoAssociative/CodeGen_SSA.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ private void DFSEmitSSA_AST(AssociativeNode node, Stack<AssociativeNode> ssaStac
488488

489489
var bnode = AstFactory.BuildAssignment(leftNode, rightNode);
490490
bnode.isSSAAssignment = isSSAAssignment;
491-
bnode.IsInputExpression = astBNode.IsInputExpression;
492491

493492
astlist.Add(bnode);
494493
ssaStack.Push(bnode);

src/Engine/ProtoCore/AssociativeGraph.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ public static ProtoCore.AssociativeGraph.GraphNode GetFirstSSAGraphnode(int inde
746746
/// <param name="core"></param>
747747
/// <param name="nodeList"></param>
748748
/// <returns></returns>
749-
public static AssociativeGraph.GraphNode MarkGraphNodesDirtyAtGlobalScope(
750-
RuntimeCore core, IEnumerable<AST.AssociativeAST.AssociativeNode> nodeList)
749+
public static AssociativeGraph.GraphNode MarkGraphNodesDirtyAtGlobalScope
750+
(RuntimeCore core, IEnumerable<AST.AssociativeAST.AssociativeNode> nodeList)
751751
{
752752
if (nodeList == null)
753753
{
@@ -767,7 +767,9 @@ public static AssociativeGraph.GraphNode MarkGraphNodesDirtyAtGlobalScope(
767767
{
768768
if (gnode.isActive && gnode.OriginalAstID == bNode.OriginalAstID)
769769
{
770+
770771
gnode.isDirty = true;
772+
gnode.isActive = true;
771773
if (gnode.updateBlock.updateRegisterStartPC != Constants.kInvalidIndex)
772774
{
773775
gnode.updateBlock.startpc = gnode.updateBlock.updateRegisterStartPC;

src/Engine/ProtoCore/DSASM/Executive.cs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public RuntimeCore RuntimeCore
3636
private InstructionStream istream;
3737
public RuntimeMemory rmem { get; set; }
3838

39-
private StackValue LX;
4039
public StackValue RX { get; set; }
4140
public StackValue TX { get; set; }
4241

@@ -67,12 +66,7 @@ enum DebugFlags
6766
/// This is updated for every bounce and function call
6867
/// </summary>
6968
private List<AssociativeGraph.GraphNode> graphNodesInProgramScope;
70-
71-
public void SetAssociativeUpdateRegister(StackValue sv)
72-
{
73-
LX = sv;
74-
}
75-
69+
7670
public Executive(RuntimeCore runtimeCore, bool isFep = false)
7771
{
7872
IsExplicitCall = false;
@@ -1347,12 +1341,8 @@ private int UpdateGraph(int exprUID, bool isSSAAssign)
13471341

13481342
// Mark reachable nodes as dirty
13491343
Validity.Assert(reachableGraphNodes != null);
1350-
//int nextPC;
13511344
if (reachableGraphNodes.Count > 0)
13521345
{
1353-
// Get the next pc to jump to
1354-
//nextPC = reachableGraphNodes[0].updateBlock.startpc;
1355-
//LX = StackValue.BuildInt(nextPC);
13561346
for (int n = 0; n < reachableGraphNodes.Count; ++n)
13571347
{
13581348
AssociativeGraph.GraphNode gnode = reachableGraphNodes[n];
@@ -1646,7 +1636,6 @@ private void ResumeRegistersFromStack()
16461636
int fp = rmem.FramePointer;
16471637
if (fp >= rmem.GlobOffset + StackFrame.StackFrameSize)
16481638
{
1649-
LX = rmem.GetAtRelative(StackFrame.FrameIndexLX);
16501639
RX = rmem.GetAtRelative(StackFrame.FrameIndexRX);
16511640
TX = rmem.GetAtRelative(StackFrame.FrameIndexTX);
16521641
}
@@ -1657,7 +1646,6 @@ private void ResumeRegistersFromStackExceptRX()
16571646
int fp = rmem.FramePointer;
16581647
if (fp >= rmem.GlobOffset + StackFrame.StackFrameSize)
16591648
{
1660-
LX = rmem.GetAtRelative(StackFrame.FrameIndexLX);
16611649
TX = rmem.GetAtRelative(StackFrame.FrameIndexTX);
16621650
}
16631651
}
@@ -1667,15 +1655,14 @@ private void SaveRegistersToStack()
16671655
int fp = rmem.FramePointer;
16681656
if (fp >= rmem.GlobOffset + StackFrame.StackFrameSize)
16691657
{
1670-
rmem.SetAtRelative(StackFrame.FrameIndexLX, LX);
16711658
rmem.SetAtRelative(StackFrame.FrameIndexRX, RX);
16721659
rmem.SetAtRelative(StackFrame.FrameIndexTX, TX);
16731660
}
16741661
}
16751662

16761663
public List<StackValue> GetRegisters()
16771664
{
1678-
return new List<StackValue> { RX, TX, LX };
1665+
return new List<StackValue> { RX, TX };
16791666
}
16801667

16811668
/// <summary>
@@ -2352,9 +2339,6 @@ private StackValue GetOperandData(int blockId, StackValue opSymbol, StackValue o
23522339
case AddressType.Register:
23532340
switch (opSymbol.Register)
23542341
{
2355-
case Registers.LX:
2356-
data = LX;
2357-
break;
23582342
case Registers.RX:
23592343
data = RX;
23602344
break;
@@ -2468,10 +2452,6 @@ protected StackValue PopTo(int blockId, StackValue op1, StackValue op2, StackVal
24682452
StackValue data = opVal;
24692453
switch (op1.Register)
24702454
{
2471-
case Registers.LX:
2472-
opPrev = LX;
2473-
LX = data;
2474-
break;
24752455
case Registers.RX:
24762456
opPrev = RX;
24772457
RX = data;

src/Engine/ProtoCore/DSASM/InstructionSet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace ProtoCore.DSASM
1010
public enum Registers
1111
{
1212
RX,
13-
LX,
1413
}
1514

1615
public enum AddressType: int

src/Engine/ProtoCore/DSASM/Stack.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ public class StackFrame
3333
public const int FrameIndexBlockIndex = -12;
3434
public const int FrameIndexRX = -13;
3535
public const int FrameIndexTX = -14;
36-
public const int FrameIndexLX = -15;
37-
public const int FrameIndexFramePointer = -16;
38-
public const int StackFrameSize = 16;
36+
public const int FrameIndexFramePointer = -15;
37+
public const int StackFrameSize = 15;
3938

4039
private struct AbsoluteIndex
4140
{
@@ -53,7 +52,6 @@ private struct AbsoluteIndex
5352
public const int BlockIndex = -FrameIndexBlockIndex - 1;
5453
public const int RX = -FrameIndexRX - 1;
5554
public const int TX = -FrameIndexTX - 1;
56-
public const int LX = -FrameIndexLX - 1;
5755
public const int FramePointer = -FrameIndexFramePointer - 1;
5856
}
5957

@@ -91,7 +89,6 @@ private void Init(
9189
Frame[AbsoluteIndex.BlockIndex] = StackValue.BuildBlockIndex(blockIndex);
9290
Frame[AbsoluteIndex.RX] = registers[0];
9391
Frame[AbsoluteIndex.TX] = registers[1];
94-
Frame[AbsoluteIndex.LX] = registers[2];
9592
Frame[AbsoluteIndex.FramePointer] = StackValue.BuildInt(framePointer);
9693
}
9794

@@ -220,19 +217,12 @@ public StackValue TX
220217
set { Frame[AbsoluteIndex.TX] = value; }
221218
}
222219

223-
public StackValue LX
224-
{
225-
get { return Frame[AbsoluteIndex.LX]; }
226-
set { Frame[AbsoluteIndex.LX] = value; }
227-
}
228-
229220
public List<StackValue> GetRegisters()
230221
{
231222
List<StackValue> registers = new List<StackValue>();
232223

233224
registers.Add(Frame[AbsoluteIndex.RX]);
234225
registers.Add(Frame[AbsoluteIndex.TX]);
235-
registers.Add(Frame[AbsoluteIndex.LX]);
236226

237227
return registers;
238228
}

src/Engine/ProtoCore/Lang/FunctionPointerEvaluator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public StackValue Evaluate(List<StackValue> args, StackFrame stackFrame)
107107
interpreter.runtime.TX = StackValue.BuildCallingConversion((int)ProtoCore.DSASM.CallingConvention.BounceType.Implicit);
108108

109109
StackValue svBlockDecl = StackValue.BuildBlockIndex(blockDecl);
110+
// interpreter.runtime.SX = svBlockDecl;
110111

111112
List<StackValue> registers = interpreter.runtime.GetRegisters();
112113
var newStackFrame = new StackFrame(thisPtr,

src/Engine/ProtoCore/Parser/AssociativeAST.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,6 @@ public class BinaryExpressionNode : AssociativeNode
20822082
public AssociativeNode LeftNode { get; set; }
20832083
public Operator Optr { get; set; }
20842084
public AssociativeNode RightNode { get; set; }
2085-
public bool IsInputExpression { get; set; }
20862085
public bool isSSAPointerAssignment { get; set; }
20872086
public bool IsFirstIdentListNode { get; set; }
20882087

@@ -2098,7 +2097,6 @@ public BinaryExpressionNode(AssociativeNode left = null, AssociativeNode right =
20982097
LeftNode = left;
20992098
Optr = optr;
21002099
RightNode = right;
2101-
IsInputExpression = false;
21022100
IsFirstIdentListNode = false;
21032101
}
21042102

@@ -2119,7 +2117,6 @@ public BinaryExpressionNode(BinaryExpressionNode rhs) : base(rhs)
21192117
{
21202118
RightNode = NodeUtils.Clone(rhs.RightNode);
21212119
}
2122-
IsInputExpression = rhs.IsInputExpression;
21232120
IsFirstIdentListNode = rhs.IsFirstIdentListNode;
21242121
}
21252122

@@ -2143,8 +2140,7 @@ public BinaryExpressionNode(IdentifierNode lhs, AssociativeNode rhs)
21432140
Optr = Operator.assign;
21442141
LeftNode = lhs;
21452142
RightNode = NodeUtils.Clone(rhs);
2146-
IsInputExpression = false;
2147-
IsFirstIdentListNode = false;
2143+
IsFirstIdentListNode = false;
21482144

21492145
}
21502146

src/Engine/ProtoCore/RuntimeCore.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Diagnostics;
44
using System.Linq;
55
using ProtoCore.AssociativeGraph;
6-
using ProtoCore.AST.AssociativeAST;
76
using ProtoCore.DSASM;
87
using ProtoCore.Lang;
98
using ProtoCore.Lang.Replication;
@@ -334,21 +333,6 @@ public TimeSpan GetCurrentTime()
334333
return ts;
335334
}
336335

337-
/// <summary>
338-
/// Set the value of a variable at runtime
339-
/// Returns the entry pc
340-
/// </summary>
341-
/// <param name="astID"></param>
342-
/// <param name="sv"></param>
343-
/// <returns></returns>
344-
public int SetValue(List<AssociativeNode> modifiedNodes, StackValue sv)
345-
{
346-
ExecutionInstance.CurrentDSASMExec.SetAssociativeUpdateRegister(sv);
347-
GraphNode gnode = AssociativeEngine.Utils.MarkGraphNodesDirtyAtGlobalScope(this, modifiedNodes);
348-
Validity.Assert(gnode != null);
349-
return gnode.updateBlock.startpc;
350-
}
351-
352336
/// <summary>
353337
/// This function determines what the starting pc should be for the next execution session
354338
/// The StartPC takes precedence if set. Otherwise, the entry pc in the global codeblock is the entry point

src/Engine/ProtoCore/Utils/CoreUtils.cs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -952,50 +952,5 @@ public static StackValue AddStackValueString(StackValue sv1, StackValue sv2, Run
952952
}
953953
return StackValue.BuildNull();
954954
}
955-
956-
/// <summary>
957-
/// Checks if an AST node is a primitive
958-
/// </summary>
959-
/// <param name="node"></param>
960-
/// <returns></returns>
961-
public static bool IsPrimitiveASTNode(AssociativeNode node)
962-
{
963-
if (node is IntNode
964-
|| node is DoubleNode
965-
|| node is BooleanNode
966-
|| node is StringNode)
967-
{
968-
return true;
969-
}
970-
return false;
971-
}
972-
973-
974-
public static StackValue BuildStackValueForPrimitive(AssociativeNode node, RuntimeCore rt)
975-
{
976-
Validity.Assert(IsPrimitiveASTNode(node) == true);
977-
978-
if (node is IntNode)
979-
{
980-
return StackValue.BuildInt((node as IntNode).Value);
981-
}
982-
983-
if (node is DoubleNode)
984-
{
985-
return StackValue.BuildDouble((node as DoubleNode).Value);
986-
}
987-
988-
if (node is BooleanNode)
989-
{
990-
return StackValue.BuildBoolean((node as BooleanNode).Value);
991-
}
992-
993-
if (node is StringNode)
994-
{
995-
return StackValue.BuildString((node as StringNode).Value, rt.Heap);
996-
}
997-
998-
return StackValue.BuildNull();
999-
}
1000955
}
1001956
}

0 commit comments

Comments
 (0)