* Further developed state tracking in whilerepeatn

This commit is contained in:
daniel 2002-07-19 12:55:27 +00:00
parent 399036f1c2
commit 7d66658fd4
3 changed files with 44 additions and 16 deletions

View File

@ -367,14 +367,23 @@ implementation
code:Tnode; code:Tnode;
done:boolean; done:boolean;
value:boolean; value:boolean;
change:boolean;
factval:Tnode;
begin begin
track_state_pass:=false; track_state_pass:=false;
done:=false; done:=false;
writeln('Oeps!');
repeat repeat
condition:=left.getcopy; condition:=left.getcopy;
if condition.track_state_pass(exec_known) then change:=condition.track_state_pass(exec_known);
factval:=aktstate.find_fact(left);
if factval<>nil then
begin
condition.destroy;
condition:=factval.getcopy;
change:=true;
end;
if change then
begin begin
track_state_pass:=true; track_state_pass:=true;
{Force new resulttype pass.} {Force new resulttype pass.}
@ -384,7 +393,7 @@ implementation
code:=right.getcopy; code:=right.getcopy;
if is_constboolnode(condition) then if is_constboolnode(condition) then
begin begin
value:=Tordconstnode(condition).value<>0; value:=(Tordconstnode(condition).value<>0) xor checknegate;
if value then if value then
begin begin
if code.track_state_pass(exec_known) then if code.track_state_pass(exec_known) then
@ -418,7 +427,7 @@ implementation
condition.resulttype.def:=nil; condition.resulttype.def:=nil;
do_resulttypepass(condition); do_resulttypepass(condition);
end; end;
aktstate.store_fact(condition,cordconstnode.create(0,booltype)); aktstate.store_fact(condition,cordconstnode.create(byte(checknegate),booltype));
end; end;
{$endif} {$endif}
@ -1204,7 +1213,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.38 2002-07-19 11:41:35 daniel Revision 1.39 2002-07-19 12:55:27 daniel
* Further developed state tracking in whilerepeatn
Revision 1.38 2002/07/19 11:41:35 daniel
* State tracker work * State tracker work
* The whilen and repeatn are now completely unified into whilerepeatn. This * The whilen and repeatn are now completely unified into whilerepeatn. This
allows the state tracker to change while nodes automatically into allows the state tracker to change while nodes automatically into

View File

@ -45,6 +45,9 @@ interface
function pass_1 : tnode;override; function pass_1 : tnode;override;
function det_resulttype:tnode;override; function det_resulttype:tnode;override;
function docompare(p: tnode): boolean; override; function docompare(p: tnode): boolean; override;
{$ifdef extdebug}
procedure dowrite;override;
{$endif}
end; end;
tloadnodeclass = class of tloadnode; tloadnodeclass = class of tloadnode;
@ -400,6 +403,13 @@ implementation
(symtableentry = tloadnode(p).symtableentry) and (symtableentry = tloadnode(p).symtableentry) and
(symtable = tloadnode(p).symtable); (symtable = tloadnode(p).symtable);
end; end;
procedure Tloadnode.dowrite;
begin
inherited dowrite;
write('[',symtableentry.name,']');
end;
{***************************************************************************** {*****************************************************************************
@ -983,7 +993,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.46 2002-07-19 11:41:36 daniel Revision 1.47 2002-07-19 12:55:27 daniel
* Further developed state tracking in whilerepeatn
Revision 1.46 2002/07/19 11:41:36 daniel
* State tracker work * State tracker work
* The whilen and repeatn are now completely unified into whilerepeatn. This * The whilen and repeatn are now completely unified into whilerepeatn. This
allows the state tracker to change while nodes automatically into allows the state tracker to change while nodes automatically into

View File

@ -197,15 +197,15 @@ implementation
begin begin
codegenerror:=false; codegenerror:=false;
firstpass(p); firstpass(p);
{$ifdef state_tracking} {$ifdef state_tracking}
writeln('TRACKSTART'); writeln('TRACKSTART');
writeln('before'); writeln('before');
writenode(p); writenode(p);
do_track_state_pass(p); do_track_state_pass(p);
writeln('after'); writeln('after');
writenode(p); writenode(p);
writeln('TRACKDONE'); writeln('TRACKDONE');
{$endif} {$endif}
do_firstpass:=codegenerror; do_firstpass:=codegenerror;
end; end;
@ -222,7 +222,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.26 2002-07-19 11:41:36 daniel Revision 1.27 2002-07-19 12:55:27 daniel
* Further developed state tracking in whilerepeatn
Revision 1.26 2002/07/19 11:41:36 daniel
* State tracker work * State tracker work
* The whilen and repeatn are now completely unified into whilerepeatn. This * The whilen and repeatn are now completely unified into whilerepeatn. This
allows the state tracker to change while nodes automatically into allows the state tracker to change while nodes automatically into