go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit 8a54d65719b9a4a39f0d470d4e8c16fd3a031637
parent 3e96e45839350b63e9f50b9cd76c0a69732384c9
Author: lash <dev@holbrook.no>
Date:   Fri, 20 Dec 2024 11:12:46 +0000

Skip loops, empty bytecodes, all rels in parse traversal

Diffstat:
Mdebug/map.go | 9++++++++-
Mdebug/parse.go | 23++++++++++++++++++++---
2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/debug/map.go b/debug/map.go @@ -37,7 +37,14 @@ func(nm *NodeMap) Run(ctx context.Context, rs resource.Resource) error { } func(nm *NodeMap) processNode(ctx context.Context, node *Node, rs resource.Resource) error { + for i, v := range(nm.st.ExecPath) { + if v == node.Name { + logg.InfoCtxf(ctx, "loop detected", "pos", i, "node", node.Name, "path", nm.st.ExecPath) + return nil + } + } nm.st.Down(node.Name) + logg.DebugCtxf(ctx, "processnode", "path", nm.st.ExecPath) for true { n := node.Next() if n == nil { @@ -46,7 +53,7 @@ func(nm *NodeMap) processNode(ctx context.Context, node *Node, rs resource.Resou ph := NewNodeParseHandler(n) b, err := rs.GetCode(ctx, n.Name) if err != nil { - return err + continue } _, err = ph.ParseAll(b) if err != nil { diff --git a/debug/parse.go b/debug/parse.go @@ -14,6 +14,7 @@ type NodeParseHandler struct { node *Node parentMoveFunc func(string) error parentInCmpFunc func(string, string) error + parentCatchFunc func(string, uint32, bool) error } func NewNodeParseHandler(node *Node) *NodeParseHandler { @@ -24,15 +25,17 @@ func NewNodeParseHandler(node *Node) *NodeParseHandler { np.node.Name = node.Name np.parentMoveFunc = np.ParseHandler.Move np.parentInCmpFunc = np.ParseHandler.InCmp + np.parentCatchFunc = np.ParseHandler.Catch np.Move = np.move np.InCmp = np.incmp + np.Catch = np.catch return np } func (np *NodeParseHandler) move(sym string) error { var node Node - if (sym == "<" || sym == ">" || sym == "^" || sym == "_") { + if (sym == "<" || sym == ">" || sym == "^" || sym == "_" || sym == ".") { logg.Debugf("skip lateral move") return np.parentMoveFunc(sym) } @@ -46,9 +49,9 @@ func (np *NodeParseHandler) move(sym string) error { func (np *NodeParseHandler) incmp(sym string, sel string) error { var node Node - if (sym == "<" || sym == ">" || sym == "^" || sym == "_") { + if (sym == "<" || sym == ">" || sym == "^" || sym == "_" || sym == ".") { logg.Debugf("skip relative move") - return np.parentMoveFunc(sym) + return np.parentInCmpFunc(sym, sel) } @@ -57,3 +60,17 @@ func (np *NodeParseHandler) incmp(sym string, sel string) error { logg.Debugf("connect INCMP", "src", np.node.Name, "dst", node.Name) return np.parentInCmpFunc(sym, sel) } + +func (np *NodeParseHandler) catch(sym string, flag uint32, inv bool) error { + var node Node + + if (sym == "<" || sym == ">" || sym == "^" || sym == "_" || sym == ".") { + logg.Debugf("skip relative move") + return np.parentMoveFunc(sym) + } + + node.Name = sym + np.node.Connect(node) + logg.Debugf("connect CATCH", "src", np.node.Name, "dst", node.Name) + return np.parentCatchFunc(sym, flag, inv) +}