On Aug 26, 2015, at 6:06 AM, Rémi Forax <fo...@univ-mlv.fr> wrote:
> 
> it's less powerful but it seems you can encode all your examples of loops too.

No, I don't think so.  Multiple pred/fini pairs implement multiple loop exits.
Any loop with an "if-return" in it has an exit distinct from the loop's main 
test.
And each exit requires a different fini function, to encode a special result.

The match loop has this multi-exit character:

  for (int i; i < a.len; i++) {
    Object e = a[i];
    if (ok(e))  return e;  // first fini function; could also be e.payload
  }
  return null;  // second fini function; could also be throwNotFound or 
Optional.none

Sometimes even "&&" type predicate logic expands into multi-exit code, if the 
loop needs to return a value that encodes which sub-predicate caused the exit.

— John


_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to