Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[herd] Asl bool condition #906

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[herd] Asl bool condition #906

wants to merge 2 commits into from

Conversation

maranget
Copy link
Member

The choice operator of the "concurrent" ASL interpreted now assigns unresolved condition to TRUE or FALSE depending on the selected branch.

As a result the "SomeBoolean" primitive can now reduce to a simple non-resolved variable and could have been replaced by the construct UNKNOWN : boolean. Typically the following running herd7 on the following test will result in two outcomes with values 0 and 1 for x. Moreover the final values of b are FALSE and TRUE, respectively.

ASL U
{}

func main() => integer
begin
  var x = 0;
  let b = UNKNOWN : boolean;
  if b then
    x = 1;
  end
  return 0;
end

locations [0:main.0.x;]

Previously, the same result could be achieved by adding option -variant ASL or by replacing the UNKNOWN expression by a primitive call SomeBoolean ().

Unfortunately this "complete" resolution does not succeed in general. See the example herd/tests/instructions/ASL/unknown-integer.litmus for instance.

The choice operator of the "concurrent" ASL interpreted
now assigns unresolved condition  to TRUE or FALSE depending
on the selected branch. As a result the "SomeBoolean"
primitive can now reduce to a simple non-resolved variable
and could have been replaced by the construct `UNKNOWN : boolean`.
@HadrienRenaud
Copy link
Collaborator

Hi Luc,

Thank you very much for this, this is very interesting.

This looks great to me.

I am wondering if we could write can_predict_from in ASL as the following:

func can_predict_from (a: integer, b: integer) => integer
begin
  return
    if a != b then a
    else
      if UNKNOWN: boolean then a
      else b;
end

@maranget
Copy link
Member Author

Hi @HadrienRenaud, if you could write it with SomeBoolean() before, it would work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants