Hi Henrique,

The behavior you're seeing is expected. Reverse Post-Order iteration is 
actually a very weak claim: its guarantee is only that when a block is being 
visited, all dominators of that block have already been visited.

The CFG from that function has the following links between blocks:
0->1, 0->4
1->2, 1->3
3->5

Each "->" in the above list can be read as "must precede" for purposes of RPO.
So all of the following would be valid orderings in RPO:

012345
012354
041325
014325
014352

And so on.

Best,
Sean

----- Original Message -----
From: "Henrique Santos" <[email protected]>
To: [email protected]
Sent: Tuesday, August 7, 2012 4:10:44 PM
Subject: [JS-internals] Iteration in reverse postorder

Hello, guys.

 I'm working on IonMonkey together with Pericles and Igor, and I would like to 
check with you if a behavior in the compiler might be a bug. I wrote a dead 
code elimination algorithm that uses IonMonkey's RPO iterator. In a block with 
an MTest instruction at the end, I expected the iterator to reach all blocks of 
one of its true or false subgraphs before moving on to the other one, but I've 
got a case where that doesn't happen. Is this behavior expected?

 I've attached to this email a test case that reproduces this. I've also pasted 
the code down below. If you generate the program's control flow graph, then you 
can see that the RPO iterator moves from block 3 to block 4 then to block 5, 
but 5 is the only successor to 3, and 4 is in a completely different subgraph 
than 3 and 5. A PDF file with the 'Renumber Blocks' graph is also attached to 
this email. Could this be a possible bug, or is this expected?

 // Code:
 function f(b) {
 if (b) {
 if (!b) return;
 } else
 return;
 };

 f(true);


 Any help is highly appreciated.

 Regards,
 Henrique.

_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to