FAUST compiler
0.9.9.6b8
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
evaluate
loopDetector.cpp
Go to the documentation of this file.
1
#include "
loopDetector.hh
"
2
#include "
ppbox.hh
"
3
4
bool
loopDetector::detect
(
Tree
t)
5
{
6
fPhase
++;
7
int
w =
fPhase
%
fBuffersize
;
8
fBuffer
[w] = t;
9
if
((
fPhase
%
fCheckperiod
) == 0) {
10
// time to check for a cycle
11
for
(
int
i=1; i<
fBuffersize
; i++) {
12
int
r = w-i;
if
(r < 0) { r +=
fBuffersize
; }
13
assert(r>=0);
14
assert(r<fBuffersize);
15
assert(r != w);
16
if
(
fBuffer
[r] == t) {
17
cerr <<
"ERROR : after "
18
<<
fPhase
19
<<
" evaluation steps, the compiler has detected an endless evaluation cycle of "
20
<< i
21
<<
" steps"
22
<< endl;
23
exit(1);
24
}
25
}
26
}
27
return
false
;
28
}
loopDetector::fPhase
int fPhase
Definition:
loopDetector.hh:46
CTree
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition:
tree.hh:109
loopDetector.hh
Detect evaluation loops.
loopDetector::fCheckperiod
const int fCheckperiod
Definition:
loopDetector.hh:44
loopDetector::fBuffersize
const int fBuffersize
Definition:
loopDetector.hh:43
loopDetector::fBuffer
vector< Tree > fBuffer
Definition:
loopDetector.hh:45
ppbox.hh
loopDetector::detect
bool detect(Tree t)
Definition:
loopDetector.cpp:4
Generated on Fri Sep 5 2014 18:06:36 for FAUST compiler by
1.8.7