Skip to content

Commit

Permalink
Цикл прогонки продолжается, пока есть «тёплые» функции (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazdaywik committed Dec 5, 2020
1 parent 18ec9ad commit adb8aef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
15 changes: 12 additions & 3 deletions src/compiler/OptTree-Drive.ref
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,18 @@ OptFunction {
(t.OptInfo (/*sentences*/) (/*functions*/))
e.Sentences
>
: (t.OptInfo^ (e.Sentences^) (e.NewFunctions))
= t.OptInfo
(Function s.ScopeClass (e.Name) Sentences e.Sentences) e.NewFunctions;
: {
(t.OptInfo^ (e.Sentences /* SAME */) (/* пусто */))
= t.OptInfo
(ColdFunction DRIVE
s.ScopeClass (e.Name) Sentences <CleanupCold-Body e.Sentences>
);

(t.OptInfo^ (e.Sentences^) (e.NewFunctions))
= t.OptInfo
(Function s.ScopeClass (e.Name) Sentences e.Sentences)
e.NewFunctions;
}
}

/*
Expand Down
22 changes: 2 additions & 20 deletions src/compiler/OptTree.ref
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ $ENTRY OptTree {
(define DriveLoop
(if (or s.OptDrive s.OptIntrinsic)
(begin
(loop-for-fix-point
(loop-for-warm-functions
(pass
(trace 'before Drive')
(call &ExpandClosures)
(call &OptTree-Drive t.OptDrive)))
(call &WarmColdFunctions DRIVE)
(call &OptTree-Drive-CleanupColdCalls))
(call &ExpandClosures)))

Expand Down Expand Up @@ -200,7 +201,6 @@ ExpandClosures-ResultTerm {
$SPEC Int-Code e.arg;
$SPEC Int-Command e.arg;
$SPEC Int-LoopForWarmFunctions e.arg;
$SPEC Int-FixPoint e.arg;


Int {
Expand Down Expand Up @@ -264,9 +264,6 @@ Int-Command {
loop-for-warm-functions e.Code
= <Int-LoopForWarmFunctions (e.Defines) e.Code s.Cycles (e.AST)>;

loop-for-fix-point e.Code
= <Int-FixPoint (e.Defines) e.Code s.Cycles (e.AST)>;

s.Proc
= <Int-Lookup s.Proc e.Defines> : e.Code
= <Int-Code (e.Defines) e.Code s.Cycles (e.AST)>;
Expand Down Expand Up @@ -320,21 +317,6 @@ Int-LoopForWarmFunctions {
(e.Defines) e.Code s.Cycles (e.AST) = s.Cycles e.AST;
}

Int-FixPoint {
(e.Defines) e.Code 0 (e.AST) = 0 e.AST;

(e.Defines) e.Code s.Cycles (e.AST)
= e.AST : e.OriginAST

= <Int-Code (e.Defines) e.Code s.Cycles (e.AST)> : s.Cycles^ e.AST^

= e.AST
: {
e.OriginAST = s.Cycles e.OriginAST;
e.AST^ = <Int-FixPoint (e.Defines) e.Code s.Cycles (e.AST)>;
};
}

$INLINE Int-Lookup;

Int-Lookup {
Expand Down

0 comments on commit adb8aef

Please sign in to comment.