Skip to content

Commit

Permalink
Исправлен алгоритм авторазметки прогонки (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaelena committed Jun 29, 2020
1 parent b0828b9 commit 6ae6e3b
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 32 deletions.
4 changes: 3 additions & 1 deletion src/compiler/OptTree-AutoMarkup-BasisVertexesExtractor.ref
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ $INCLUDE "LibraryEx";
$EXTERN OptTree-AutoMarkup-GetSetDifference,
OptTree-AutoMarkup-Contains,
OptTree-AutoMarkup-GetElemByKey,
OptTree-AutoMarkup-GetParents;
OptTree-AutoMarkup-GetParents,
OptTree-AutoMarkup-Equal;

/**
<OptTree-AutoMarkup-ExtractBasisVertexes e.ExtractedGraph>
Expand Down Expand Up @@ -47,6 +48,7 @@ OptTree-AutoMarkup-GetGraphRoots {
Children (e.ChildrenHead (e.FuncName) e.ChildrenTail)
)
e.GraphTail
, <OptTree-AutoMarkup-Equal (e.ParentName) (e.FuncName)> : False
= ((e.Result) (e.Graph));

((e.Result) (e.Graph^))
Expand Down
12 changes: 12 additions & 0 deletions src/compiler/OptTree-AutoMarkup-Common.ref
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ $ENTRY OptTree-AutoMarkup-Contains {
= False;
}

/**
<OptTree-AutoMarkup-Equal (e.First) (e.Second)> == True|False
*/

$ENTRY OptTree-AutoMarkup-Equal {
(e.X) (e.X)
= True;

(e.X) (e.Y)
= False;
}

/**
<OptTree-AutoMarkup-GetElemByKey (e.Key) (e.Graph)>
== e.GraphNode (e.Graph)
Expand Down
63 changes: 37 additions & 26 deletions src/compiler/OptTree-AutoMarkup-GraphExtractor.ref
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,10 @@ $ENTRY OptTree-AutoMarkup-ExtractFunctionCallsGraph {
((/*graph nodes*/) (/*indirect children*/)) e.AST
>
: ((e.ExtractedFuncs) (e.IndirectChildren))
= <Map &OptTree-AutoMarkup-GetMetatablesNames e.AST>
= <Map &OptTree-AutoMarkup-GetMetatablesNames e.AST>
: e.MetatablesNames
= <Map &OptTree-AutoMarkup-GetMetatables e.AST>
: e.ExtractedMetaTables
= <OptTree-AutoMarkup-InlineFuncCallsWithMetatable
(e.ExtractedFuncs)
(e.ExtractedMetaTables)
>
: e.InlinedGraph
= <Map &OptTree-AutoMarkup-GetEntryPoints e.AST>
: e.EntryPoints
= <OptTree-AutoMarkup-GetClearedByEntryPointsGraph
(e.InlinedGraph)
(e.EntryPoints)
>
: ((e.ResultGraph) (e.InlinedGraph^))
= <Unique e.IndirectChildren>
: e.UniqueIndirectChildren
= <Map &OptTree-AutoMarkup-GetMetatablesNames e.AST>
: e.MetatablesNames
= <Map
{
(e.FuncName)
Expand All @@ -68,7 +52,26 @@ $ENTRY OptTree-AutoMarkup-ExtractFunctionCallsGraph {
: e.ClearedUniqueIndirectChildren
= (Func (Indirect function for implicit calls)
Children (e.ClearedUniqueIndirectChildren))
<Unique e.ResultGraph>;
: e.IndirectFuncNode
= <Map &OptTree-AutoMarkup-GetMetatablesNames e.AST>
: e.MetatablesNames
= <Map &OptTree-AutoMarkup-GetMetatables e.AST>
: e.ExtractedMetaTables
= <OptTree-AutoMarkup-InlineFuncCallsWithMetatable
(e.ExtractedFuncs)
(e.ExtractedMetaTables)
>
: e.InlinedGraph
= <Map &OptTree-AutoMarkup-GetEntryPoints e.AST>
: e.EntryPoints
= e.EntryPoints e.UniqueIndirectChildren
: e.EntryPoints^
= <OptTree-AutoMarkup-GetClearedByEntryPointsGraph
(e.InlinedGraph)
(e.EntryPoints)
>
: ((e.ResultGraph) (e.InlinedGraph^))
= <Unique e.IndirectFuncNode e.ResultGraph>;
}

OptTree-AutoMarkup-GetEntryPoints {
Expand Down Expand Up @@ -190,11 +193,12 @@ OptTree-AutoMarkup-GetFuncs {
= (e.ImplicitCalls)
: {
()
=;
= ;

(e._)
= (Indirect function for implicit calls)
} : e.IndirectChild
}
: e.IndirectChild
= (Func (e.Name) Children (e.UniqueDirectCalls e.IndirectChild))
(e.IndirectChildren);

Expand Down Expand Up @@ -306,11 +310,18 @@ OptTree-AutoMarkup-InnerExtractExpressionName {
(Symbol Name e.IndirectChild)
e.NestedTail
)
= (
e.NestedHead
= (e.IndirectChild)
<Map
{
(Symbol Name e.NextInderectChild)
= (e.NextInderectChild);

e.Other
= ;
}
e.NestedTail
)
: e.Nested
>
: e.AdditionaIndirectChildren
= <Map
{
(Symbol Name e._)
Expand All @@ -319,7 +330,7 @@ OptTree-AutoMarkup-InnerExtractExpressionName {
e.Other
= e.Other;
}
e.Nested
e.NestedHead e.NestedTail
>
: e.Nested^
= <OptTree-AutoMarkup-InnerExtractExpressionName
Expand All @@ -336,7 +347,7 @@ OptTree-AutoMarkup-InnerExtractExpressionName {
= (
(e.DirectCalls (e.Name))
(e.IndirectDetected)
(e.IndirectChildren (e.IndirectChild))
(e.IndirectChildren e.AdditionaIndirectChildren)
);

((e.DirectCalls^) (e.IndirectDetected^) (e.IndirectChildren^))
Expand Down
29 changes: 24 additions & 5 deletions src/compiler/OptTree-AutoMarkup.ref
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ $ENTRY OptTree-AutoMarkup {
(e.BasisVertexes)
>
: e.DrivenFunctions
= <OptTree-AutoMarkup-GetAlreadyMarkedFunctions e.AST>
: e.AlreadyMarkedFunctions
= <OptTree-AutoMarkup-GetForbiddenToDriveFunctions e.AST>
: e.ForbiddenToDriveFuncs
= <OptTree-AutoMarkup-GetSetDifference
(e.DrivenFunctions)
(e.AlreadyMarkedFunctions)
(e.ForbiddenToDriveFuncs)
>
: (e.FunctionToDrive)
= <OptTree-AutoMarkup-GetUpdatedWithDrivenFunctionsAst
Expand Down Expand Up @@ -110,9 +110,10 @@ OptTree-AutoMarkup-GetSpecializePatterns {
>
}

OptTree-AutoMarkup-GetAlreadyMarkedFunctions {
OptTree-AutoMarkup-GetForbiddenToDriveFunctions {
e.AST
= <Map
= (INIT) (FINAL)
<Map
{
(s.Label e.Name)
, <OptTree-AutoMarkup-Contains
Expand All @@ -121,6 +122,24 @@ OptTree-AutoMarkup-GetAlreadyMarkedFunctions {
> : True
= (e.Name);

(Declaration GN-Entry e.FuncName)
= (e.FuncName);

(Function GN-Entry (e.FuncName) Sentences e.Body)
= (e.FuncName);

(Function s.Scope (e.FuncName) Sentences e.Body)
= <Lenw e.Body>
: s.SentencesCount e.Body^
= <TermCompare s.SentencesCount 20>
: {
'>'
= (e.FuncName);

e.Other
= ;
};

e.Other
= ;
}
Expand Down

0 comments on commit 6ae6e3b

Please sign in to comment.