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

safety-checker: support #copy #312

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
([PR #303](https://github.com/jasmin-lang/jasmin/pull/303);
fixes [#301](https://github.com/jasmin-lang/jasmin/issues/301)).

- Safety checker handles the `#copy` operator
([PR #312](https://github.com/jasmin-lang/jasmin/pull/312);
fixes [#308](https://github.com/jasmin-lang/jasmin/issues/308)).

## Other changes

- Explicit if-then-else in flag combinations is no longer supported
Expand Down
8 changes: 8 additions & 0 deletions compiler/safety/success/copy.jazz
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export fn test(reg u64 x) -> reg u64 {
reg u64[1] r;
stack u64[1] s;
r[0] = x;
s = #copy(r);
x = s[0];
return x;
}
1 change: 1 addition & 0 deletions compiler/src/safety/safetyInterpreter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ end = struct
let cr = { ginstr with i_desc = Cassgn (lv, tag, Bty (U sz), er) } in
aeval_if asmOp ginstr c [cl] [cr] state

| Copn ([ lv ], _, Ocopy _, [ e ])
| Cassgn (lv, _, _, e) ->
let abs = AbsExpr.abs_assign
state.abs
Expand Down